From d5ebd79c76abd4887f0283cd6f6f9689122094d0 Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Mon, 21 Oct 2024 13:35:40 +0300 Subject: [PATCH] rpc : pack only RPC structs (#9959) --- ggml/src/ggml-rpc.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/ggml/src/ggml-rpc.cpp b/ggml/src/ggml-rpc.cpp index f95233284..0e936b343 100644 --- a/ggml/src/ggml-rpc.cpp +++ b/ggml/src/ggml-rpc.cpp @@ -57,8 +57,9 @@ struct socket_t { } }; +// all RPC structures must be packed +#pragma pack(push, 1) // ggml_tensor is serialized into rpc_tensor -#pragma pack(1) struct rpc_tensor { uint64_t id; uint32_t type; @@ -95,76 +96,64 @@ enum rpc_cmd { RPC_CMD_COUNT, }; -#pragma pack(1) struct rpc_msg_alloc_buffer_req { uint64_t size; }; -#pragma pack(1) struct rpc_msg_alloc_buffer_rsp { uint64_t remote_ptr; uint64_t remote_size; }; -#pragma pack(1) struct rpc_msg_get_alignment_rsp { uint64_t alignment; }; -#pragma pack(1) struct rpc_msg_get_max_size_rsp { uint64_t max_size; }; -#pragma pack(1) struct rpc_msg_buffer_get_base_req { uint64_t remote_ptr; }; -#pragma pack(1) struct rpc_msg_buffer_get_base_rsp { uint64_t base_ptr; }; -#pragma pack(1) struct rpc_msg_free_buffer_req { uint64_t remote_ptr; }; -#pragma pack(1) struct rpc_msg_buffer_clear_req { uint64_t remote_ptr; uint8_t value; }; -#pragma pack(1) struct rpc_msg_get_tensor_req { rpc_tensor tensor; uint64_t offset; uint64_t size; }; -#pragma pack(1) struct rpc_msg_copy_tensor_req { rpc_tensor src; rpc_tensor dst; }; -#pragma pack(1) struct rpc_msg_copy_tensor_rsp { uint8_t result; }; -#pragma pack(1) struct rpc_msg_graph_compute_rsp { uint8_t result; }; -#pragma pack(1) struct rpc_msg_get_device_memory_rsp { uint64_t free_mem; uint64_t total_mem; }; +#pragma pack(pop) // RPC data structures