Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8778aef6a1ea
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 027d54ca941f
Choose a head ref
  • 3 commits
  • 6 files changed
  • 1 contributor

Commits on Jan 7, 2016

  1. Move kernel CPU address space up to 0x40800000.

    whitequark committed Jan 7, 2016
    Copy the full SHA
    5771085 View commit details
  2. Remove kernel-related constants from runtime.ld.

    It's not used anywhere and it's one more place to adjust, which
    will someday lead to obscure copy-paste bugs.
    whitequark committed Jan 7, 2016
    Copy the full SHA
    dcc4763 View commit details
  3. Enlarge coredevice buffers to 2.5MiB (fixes #215).

    This should be enough for sending a 2MiB int32 list.
    whitequark committed Jan 7, 2016
    Copy the full SHA
    027d54c View commit details
Showing with 37 additions and 25 deletions.
  1. +1 −1 artiq/gateware/amp/kernel_cpu.py
  2. +2 −2 artiq/runtime/kloader.h
  3. +2 −2 artiq/runtime/ksupport.ld
  4. +1 −13 artiq/runtime/runtime.ld
  5. +9 −3 artiq/runtime/session.c
  6. +22 −4 artiq/test/coredevice/embedding.py
2 changes: 1 addition & 1 deletion artiq/gateware/amp/kernel_cpu.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

class KernelCPU(Module):
def __init__(self, platform,
exec_address=0x40400000,
exec_address=0x40800000,
main_mem_origin=0x40000000,
l2_size=8192):
self._reset = CSRStorage(reset=1)
4 changes: 2 additions & 2 deletions artiq/runtime/kloader.h
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@

#include "artiq_personality.h"

#define KERNELCPU_EXEC_ADDRESS 0x40400000
#define KERNELCPU_PAYLOAD_ADDRESS 0x40420000
#define KERNELCPU_EXEC_ADDRESS 0x40800000
#define KERNELCPU_PAYLOAD_ADDRESS 0x40820000
#define KERNELCPU_LAST_ADDRESS (0x4fffffff - 1024*1024)
#define KSUPPORT_HEADER_SIZE 0x80

4 changes: 2 additions & 2 deletions artiq/runtime/ksupport.ld
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@ ENTRY(_start)

INCLUDE generated/regions.ld

/* First 4M of main memory are reserved for runtime code/data
/* First 8M of main memory are reserved for runtime code/data
* then comes kernel memory. First 128K of kernel memory are for support code.
*/
MEMORY {
ksupport (RWX) : ORIGIN = 0x40400000, LENGTH = 0x20000
ksupport (RWX) : ORIGIN = 0x40800000, LENGTH = 0x20000
}

/* On AMP systems, kernel stack is at the end of main RAM,
14 changes: 1 addition & 13 deletions artiq/runtime/runtime.ld
Original file line number Diff line number Diff line change
@@ -7,14 +7,7 @@ INCLUDE generated/regions.ld
* ld does not allow this expression here.
*/
MEMORY {
runtime : ORIGIN = 0x40000000, LENGTH = 0x400000 /* 4M */
}

/* First 4M of main memory are reserved for runtime code/data
* then comes kernel memory. First 32K of kernel memory are for support code.
*/
MEMORY {
kernel : ORIGIN = 0x40400000, LENGTH = 0x8000
runtime : ORIGIN = 0x40000000, LENGTH = 0x800000 /* 8M */
}

/* Kernel memory space start right after the runtime,
@@ -24,11 +17,6 @@ MEMORY {
*/
PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 4);

/* On AMP systems, kernel stack is at the end of main RAM,
* before the runtime stack. Leave 1M for runtime stack.
*/
PROVIDE(_kernel_fstack = 0x40000000 + LENGTH(main_ram) - 1024*1024 - 4);

SECTIONS
{
.text :
12 changes: 9 additions & 3 deletions artiq/runtime/session.c
Original file line number Diff line number Diff line change
@@ -16,8 +16,12 @@
#include "rtiocrg.h"
#include "session.h"

#define BUFFER_IN_SIZE (1024*1024)
#define BUFFER_OUT_SIZE (1024*1024)
// 2.5MiB in payload + 1KiB for headers.
// We need more than 1MiB to send a 1MiB list due to tags;
// about 5/4MiB for an 1MiB int32 list, 9/8MiB for an 1MiB int64 list.
#define BUFFER_SIZE (2560*1024 + 1024)
#define BUFFER_IN_SIZE BUFFER_SIZE
#define BUFFER_OUT_SIZE BUFFER_SIZE

static int process_input();
static int out_packet_available();
@@ -829,8 +833,10 @@ static int send_rpc_value(const char **tag, void **value)

for(int i = 0; i < list->length; i++) {
const char *tag_copy = *tag;
if(!send_rpc_value(&tag_copy, &element))
if(!send_rpc_value(&tag_copy, &element)) {
log("failed to send list at element %d/%d", i, list->length);
return 0;
}
}
skip_rpc_value(tag);

26 changes: 22 additions & 4 deletions artiq/test/coredevice/embedding.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
from artiq.test.hardware_testbench import ExperimentCase


class Roundtrip(EnvExperiment):
class _Roundtrip(EnvExperiment):
def build(self):
self.setattr_device("core")

@@ -12,7 +12,7 @@ def roundtrip(self, obj, fn):

class RoundtripTest(ExperimentCase):
def assertRoundtrip(self, obj):
exp = self.create(Roundtrip)
exp = self.create(_Roundtrip)
def callback(objcopy):
self.assertEqual(obj, objcopy)
exp.roundtrip(obj, callback)
@@ -42,7 +42,7 @@ def test_object(self):
self.assertRoundtrip(obj)


class DefaultArg(EnvExperiment):
class _DefaultArg(EnvExperiment):
def build(self):
self.setattr_device("core")

@@ -55,5 +55,23 @@ def run(self):

class DefaultArgTest(ExperimentCase):
def test_default_arg(self):
exp = self.create(DefaultArg)
exp = self.create(_DefaultArg)
self.assertEqual(exp.run(), 42)


class _Payload1MB(EnvExperiment):
def build(self):
self.setattr_device("core")

def devnull(self, d):
pass

@kernel
def run(self):
data = [0 for _ in range(1000000//4)]
self.devnull(data)

class LargePayloadTest(ExperimentCase):
def test_1MB(self):
exp = self.create(_Payload1MB)
exp.run()