forked from M-Labs/artiq
1
0
Fork 0

Enlarge coredevice buffers to 2.5MiB (fixes #215).

This should be enough for sending a 2MiB int32 list.
This commit is contained in:
whitequark 2016-01-07 18:29:35 +00:00
parent dcc4763914
commit 027d54ca94
2 changed files with 31 additions and 7 deletions

View File

@ -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);

View File

@ -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()