From 027d54ca941f2669306d7b2374b790923f592984 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 7 Jan 2016 18:29:35 +0000 Subject: [PATCH] Enlarge coredevice buffers to 2.5MiB (fixes #215). This should be enough for sending a 2MiB int32 list. --- artiq/runtime/session.c | 12 +++++++++--- artiq/test/coredevice/embedding.py | 26 ++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/artiq/runtime/session.c b/artiq/runtime/session.c index ef4bf5adf..c6e215ace 100644 --- a/artiq/runtime/session.c +++ b/artiq/runtime/session.c @@ -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); diff --git a/artiq/test/coredevice/embedding.py b/artiq/test/coredevice/embedding.py index 04a136164..190ec23b9 100644 --- a/artiq/test/coredevice/embedding.py +++ b/artiq/test/coredevice/embedding.py @@ -2,7 +2,7 @@ from artiq.language import * from artiq.test.hardware_testbench import ExperimentCase -class Roundtrip(EnvExperiment): +class _Roundtrip(EnvExperiment): def build(self): self.setattr_device("core") @@ -12,7 +12,7 @@ class Roundtrip(EnvExperiment): 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 @@ class RoundtripTest(ExperimentCase): self.assertRoundtrip(obj) -class DefaultArg(EnvExperiment): +class _DefaultArg(EnvExperiment): def build(self): self.setattr_device("core") @@ -55,5 +55,23 @@ class DefaultArg(EnvExperiment): 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()