Skip to content

Commit 08e0408

Browse files
committed
refactor: address pr comments
removed comments and unnecessary returns Signed-off-by: Ville Vesilehto <[email protected]>
1 parent b546280 commit 08e0408

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,6 @@ bool rpc_server::set_tensor(const std::vector<uint8_t> & input) {
10561056
const size_t p1 = p0 + ggml_backend_buffer_get_size(tensor->buffer);
10571057

10581058
if (in_tensor->data + offset < p0 || in_tensor->data + offset >= p1 || size > (p1 - in_tensor->data - offset)) {
1059-
// Replace GGML_ABORT with logging and error return
10601059
GGML_LOG_ERROR("[%s] tensor data region (data=0x%" PRIx64 ", offset=%" PRIu64 ", size=%zu) out of buffer bounds [0x%zx, 0x%zx)\n",
10611060
__func__, in_tensor->data, offset, size, p0, p1);
10621061
return false;
@@ -1134,10 +1133,8 @@ bool rpc_server::set_tensor_hash(const std::vector<uint8_t> & input, rpc_msg_set
11341133
const size_t p1 = p0 + ggml_backend_buffer_get_size(tensor->buffer);
11351134

11361135
if (in_tensor->data + offset < p0 || in_tensor->data + offset >= p1 || size > (p1 - in_tensor->data - offset)) {
1137-
// Replace GGML_ABORT with logging and error return
11381136
GGML_LOG_ERROR("[%s] tensor data region (data=0x%" PRIx64 ", offset=%" PRIu64 ", size=%zu, hash=0x%" PRIx64 ") out of buffer bounds [0x%zx, 0x%zx)\n",
11391137
__func__, in_tensor->data, offset, size, *hash, p0, p1);
1140-
response.result = 0;
11411138
return false;
11421139
}
11431140
}
@@ -1203,7 +1200,6 @@ bool rpc_server::get_tensor(const rpc_msg_get_tensor_req & request, std::vector<
12031200
if (request.tensor.data + request.offset < p0 ||
12041201
request.tensor.data + request.offset >= p1 ||
12051202
request.size > (p1 - request.tensor.data - request.offset)) {
1206-
// Replace GGML_ABORT with logging and error return
12071203
GGML_LOG_ERROR("[%s] requested tensor region (data=0x%" PRIx64 ", offset=%" PRIu64 ", size=%" PRIu64 ") out of buffer bounds [0x%zx, 0x%zx)\n",
12081204
__func__, request.tensor.data, request.offset, request.size, p0, p1);
12091205
return false;
@@ -1229,7 +1225,6 @@ bool rpc_server::copy_tensor(const rpc_msg_copy_tensor_req & request, rpc_msg_co
12291225
ggml_tensor * dst = deserialize_tensor(ctx, &request.dst);
12301226
if (src == nullptr || dst == nullptr) {
12311227
GGML_LOG_ERROR("[%s] error deserializing tensors\n", __func__);
1232-
response.result = 0;
12331228
return false;
12341229
}
12351230

@@ -1247,7 +1242,6 @@ bool rpc_server::copy_tensor(const rpc_msg_copy_tensor_req & request, rpc_msg_co
12471242
dst_data + src_size,
12481243
dst_base,
12491244
dst_base + dst_buf_sz);
1250-
response.result = 0;
12511245
return false;
12521246
}
12531247

@@ -1407,8 +1401,7 @@ bool rpc_server::graph_compute(const std::vector<uint8_t> & input, rpc_msg_graph
14071401
}
14081402
ggml_status status = ggml_backend_graph_compute(backend, graph);
14091403
response.result = status;
1410-
// Return true only if computation succeeded
1411-
return status == GGML_STATUS_SUCCESS;
1404+
return true;
14121405
}
14131406

14141407
rpc_server::~rpc_server() {

0 commit comments

Comments
 (0)