Skip to content

Commit 92306a8

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 c064ffb commit 92306a8

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
@@ -1256,16 +1256,12 @@ ggml_tensor * rpc_server::create_node(uint64_t id,
12561256
struct ggml_context * ctx,
12571257
const std::unordered_map<uint64_t, const rpc_tensor*> & tensor_ptrs,
12581258
std::unordered_map<uint64_t, struct ggml_tensor*> & tensor_map) {
1259-
if (id == 0) {
1260-
return nullptr;
1261-
}
12621259
if (tensor_map.find(id) != tensor_map.end()) {
12631260
return tensor_map[id];
12641261
}
12651262
// Safely find the tensor pointer
12661263
auto it_ptr = tensor_ptrs.find(id);
12671264
if (it_ptr == tensor_ptrs.end()) {
1268-
GGML_LOG_ERROR("[%s] tensor id %" PRIu64 " not found in provided tensors\n", __func__, id);
12691265
return nullptr;
12701266
}
12711267
const rpc_tensor * tensor = it_ptr->second;

0 commit comments

Comments
 (0)