From fcaed3ab4a2f3795198fa87c868e1a62689f740d Mon Sep 17 00:00:00 2001 From: Gilbert Montague Date: Wed, 23 Apr 2025 10:57:01 -0700 Subject: [PATCH 1/4] feat: Add controller node with output tensor --- api/datatype.proto | 30 +++++++++++++++++++++++++++++- api/node.proto | 3 +++ api/nodes/controller.proto | 7 +++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 api/nodes/controller.proto diff --git a/api/datatype.proto b/api/datatype.proto index 09c78b4..3d25735 100644 --- a/api/datatype.proto +++ b/api/datatype.proto @@ -10,4 +10,32 @@ enum DataType { kTimestamps = 4; kImage = 5; kWaveforms = 6; -} \ No newline at end of file +} + +// A simple tensor with timestamped data +message Tensor { + // Timestamp in ns since the unix epoch + uint64 timestamp_ns = 1; + + // Shape of the tensor + // The number of values should equal to the product of the dimensions + // e.g. shape = [2, 3] => 2 rows, 3 columns + repeated int32 shape = 2; + + // Data, stored in a flat array, see shape to reconstruct + // e.g. shape: [1, 3] would be: + // [10.0, 20.0, 30.0] + repeated float values = 3; + + // Expected data type to parse out + enum DType { + kFloat32 = 0; + kInt32 = 1; + kUint8 = 2; + // e.g. float 64 + kDouble = 3; + kInt64 = 4; + kBool = 5; + } + DType dtype = 4; +} diff --git a/api/node.proto b/api/node.proto index 1d3d59e..b3f0d54 100644 --- a/api/node.proto +++ b/api/node.proto @@ -13,6 +13,7 @@ import "api/nodes/stream_in.proto"; import "api/nodes/disk_writer.proto"; import "api/nodes/spike_source.proto"; import "api/nodes/spike_binner.proto"; +import "api/nodes/controller.proto"; enum NodeType { kNodeTypeUnknown = 0; @@ -26,6 +27,7 @@ enum NodeType { kSpectralFilter = 8; kDiskWriter = 9; kSpikeBinner = 10; + kController = 11; } message NodeConfig { @@ -42,6 +44,7 @@ message NodeConfig { DiskWriterConfig disk_writer = 11; SpikeSourceConfig spike_source = 12; SpikeBinnerConfig spike_binner = 13; + ControllerNodeConfig controller = 14; } } diff --git a/api/nodes/controller.proto b/api/nodes/controller.proto new file mode 100644 index 0000000..a37c3bb --- /dev/null +++ b/api/nodes/controller.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package synapse; + +message ControllerNodeConfig { + +} From e94100b2a792e9e890b90fbe2cbfb7af5693a0c5 Mon Sep 17 00:00:00 2001 From: Gilbert Montague Date: Wed, 23 Apr 2025 13:38:38 -0700 Subject: [PATCH 2/4] Formatting --- api/datatype.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/datatype.proto b/api/datatype.proto index 3d25735..c85625f 100644 --- a/api/datatype.proto +++ b/api/datatype.proto @@ -16,17 +16,17 @@ enum DataType { message Tensor { // Timestamp in ns since the unix epoch uint64 timestamp_ns = 1; - + // Shape of the tensor // The number of values should equal to the product of the dimensions // e.g. shape = [2, 3] => 2 rows, 3 columns repeated int32 shape = 2; - + // Data, stored in a flat array, see shape to reconstruct // e.g. shape: [1, 3] would be: // [10.0, 20.0, 30.0] repeated float values = 3; - + // Expected data type to parse out enum DType { kFloat32 = 0; From d999ef39f85f32772662807752039d269f795fc2 Mon Sep 17 00:00:00 2001 From: Gilbert Montague Date: Fri, 25 Apr 2025 10:29:04 -0700 Subject: [PATCH 3/4] Use bytes --- api/datatype.proto | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/api/datatype.proto b/api/datatype.proto index c85625f..029e3cc 100644 --- a/api/datatype.proto +++ b/api/datatype.proto @@ -22,20 +22,26 @@ message Tensor { // e.g. shape = [2, 3] => 2 rows, 3 columns repeated int32 shape = 2; - // Data, stored in a flat array, see shape to reconstruct - // e.g. shape: [1, 3] would be: - // [10.0, 20.0, 30.0] - repeated float values = 3; - // Expected data type to parse out enum DType { - kFloat32 = 0; - kInt32 = 1; - kUint8 = 2; - // e.g. float 64 - kDouble = 3; - kInt64 = 4; - kBool = 5; + DT_INVALID = 0; + DT_FLOAT = 1; + DT_DOUBLE = 2; + DT_UINT8 = 3; + DT_UINT16 = 4; + DT_UINT32 = 5; + DT_UINT64 = 6; + DT_INT8 = 7; + DT_INT16 = 8; + DT_INT32 = 9; + DT_INT64 = 10; + DT_BOOL = 11; + DT_STRING = 12; } - DType dtype = 4; + DType dtype = 3; + + // Data, stored in a flat array, see shape to reconstruct + // e.g. shape: [1, 3] would be: + // [10.0, 20.0, 30.0] + bytes data = 4; } From c5ef0f72cefccbfaf3900115861750f4470d44ea Mon Sep 17 00:00:00 2001 From: Gilbert Montague Date: Mon, 28 Apr 2025 09:54:20 -0700 Subject: [PATCH 4/4] endian --- api/datatype.proto | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/datatype.proto b/api/datatype.proto index 029e3cc..f461566 100644 --- a/api/datatype.proto +++ b/api/datatype.proto @@ -36,12 +36,18 @@ message Tensor { DT_INT32 = 9; DT_INT64 = 10; DT_BOOL = 11; - DT_STRING = 12; } DType dtype = 3; + enum Endianness { + LITTLE_ENDIAN = 0; + BIG_ENDIAN = 1; + } + // We default to little because that covers most of the use cases + Endianness endianness = 4; + // Data, stored in a flat array, see shape to reconstruct // e.g. shape: [1, 3] would be: // [10.0, 20.0, 30.0] - bytes data = 4; + bytes data = 5; }