Skip to content

Commit 93988db

Browse files
committed
use same rpc tensor name size limit as llama.cpp, from 128 to 64 (breaking change for RPC) (+1 squashed commits)
Squashed commits: [aba1dd4] use same rpc tensor name size limit as llama.cpp, from 128 to 64 (breaking change for RPC)
1 parent 60f7cfc commit 93988db

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

ggml/src/ggml-rpc/ggml-rpc.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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
3537
struct 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");
5356
static_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

0 commit comments

Comments
 (0)