@@ -181,7 +181,7 @@ struct ggml_backend_rpc_context {
181
181
182
182
struct ggml_backend_rpc_buffer_context {
183
183
std::shared_ptr<socket_t > sock;
184
- std::unordered_map< ggml_backend_buffer_t , void *> base_cache ;
184
+ void * base_ptr ;
185
185
uint64_t remote_ptr;
186
186
};
187
187
@@ -423,16 +423,15 @@ static void ggml_backend_rpc_buffer_free_buffer(ggml_backend_buffer_t buffer) {
423
423
424
424
static void * ggml_backend_rpc_buffer_get_base (ggml_backend_buffer_t buffer) {
425
425
ggml_backend_rpc_buffer_context * ctx = (ggml_backend_rpc_buffer_context *)buffer->context ;
426
- if (ctx->base_cache . find (buffer) != ctx-> base_cache . end () ) {
427
- return ctx->base_cache [buffer] ;
426
+ if (ctx->base_ptr != nullptr ) {
427
+ return ctx->base_ptr ;
428
428
}
429
429
rpc_msg_buffer_get_base_req request = {ctx->remote_ptr };
430
430
rpc_msg_buffer_get_base_rsp response;
431
431
bool status = send_rpc_cmd (ctx->sock , RPC_CMD_BUFFER_GET_BASE, &request, sizeof (request), &response, sizeof (response));
432
432
GGML_ASSERT (status);
433
- void * base_ptr = reinterpret_cast <void *>(response.base_ptr );
434
- ctx->base_cache [buffer] = base_ptr;
435
- return base_ptr;
433
+ ctx->base_ptr = reinterpret_cast <void *>(response.base_ptr );
434
+ return ctx->base_ptr ;
436
435
}
437
436
438
437
static rpc_tensor serialize_tensor (const ggml_tensor * tensor) {
@@ -557,7 +556,7 @@ static ggml_backend_buffer_t ggml_backend_rpc_buffer_type_alloc_buffer(ggml_back
557
556
if (response.remote_ptr != 0 ) {
558
557
ggml_backend_buffer_t buffer = ggml_backend_buffer_init (buft,
559
558
ggml_backend_rpc_buffer_interface,
560
- new ggml_backend_rpc_buffer_context{sock, {} , response.remote_ptr },
559
+ new ggml_backend_rpc_buffer_context{sock, nullptr , response.remote_ptr },
561
560
response.remote_size );
562
561
return buffer;
563
562
} else {
0 commit comments