Skip to content

Commit f9ede76

Browse files
committed
refactor(rpc): initial zero check in create_node
The caller (`graph_compute`) already checks `id != 0` when handling a `nullptr` return from `create_node`, correctly distinguishing intentional null links from actual errors. This makes the initial `if (id == 0)` check redundant. Also removes the log message when a tensor ID is not found in the provided map which was added in this branch. Signed-off-by: Ville Vesilehto <[email protected]>
1 parent 604f0a0 commit f9ede76

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,16 +1247,12 @@ ggml_tensor * rpc_server::create_node(uint64_t id,
12471247
struct ggml_context * ctx,
12481248
const std::unordered_map<uint64_t, const rpc_tensor*> & tensor_ptrs,
12491249
std::unordered_map<uint64_t, struct ggml_tensor*> & tensor_map) {
1250-
if (id == 0) {
1251-
return nullptr;
1252-
}
12531250
if (tensor_map.find(id) != tensor_map.end()) {
12541251
return tensor_map[id];
12551252
}
12561253
// Safely find the tensor pointer
12571254
auto it_ptr = tensor_ptrs.find(id);
12581255
if (it_ptr == tensor_ptrs.end()) {
1259-
GGML_LOG_ERROR("[%s] tensor id %" PRIu64 " not found in provided tensors\n", __func__, id);
12601256
return nullptr;
12611257
}
12621258
const rpc_tensor * tensor = it_ptr->second;

0 commit comments

Comments
 (0)