File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ namespace fs = std::filesystem;
3131
3232// all RPC structures must be packed
3333#pragma pack(push, 1)
34+ static constexpr size_t RPC_TENSOR_NAME_SIZE = 64 ;
35+
3436// ggml_tensor is serialized into rpc_tensor
3537struct rpc_tensor {
3638 uint64_t id;
@@ -45,11 +47,12 @@ struct rpc_tensor {
4547 uint64_t view_src;
4648 uint64_t view_offs;
4749 uint64_t data;
48- char name[GGML_MAX_NAME ];
50+ char name[RPC_TENSOR_NAME_SIZE ];
4951
5052 char padding[4 ];
5153};
5254
55+ static_assert (RPC_TENSOR_NAME_SIZE == 64 , " rpc_tensor name size must match the upstream RPC wire ABI" );
5356static_assert (sizeof (rpc_tensor) % 8 == 0 , " rpc_tensor size must be multiple of 8" );
5457
5558// RPC commands
@@ -441,7 +444,7 @@ static rpc_tensor serialize_tensor(const ggml_tensor * tensor) {
441444 memset (result.name , 0 , sizeof (result.name ));
442445 memset (result.padding , 0 , sizeof (result.padding ));
443446
444- snprintf (result.name , GGML_MAX_NAME , " %s" , tensor->name );
447+ snprintf (result.name , sizeof (result. name ) , " %s" , tensor->name );
445448 return result;
446449}
447450
You can’t perform that action at this time.
0 commit comments