We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dccea3c commit 06a46ceCopy full SHA for 06a46ce
ggml/include/ggml.h
@@ -683,9 +683,14 @@ extern "C" {
683
extern __thread int ggml_current_numa_node;
684
685
static inline void * tensor_data(const struct ggml_tensor * tensor) {
686
- int numa_node = ggml_current_numa_node;
+ // Fast path: if no NUMA mirrors exist, avoid thread-local access entirely
687
+ if (tensor->__data[1] == NULL) {
688
+ return tensor->__data[0];
689
+ }
690
- if (numa_node >= 0 && numa_node < GGML_NUMA_MAX_NODES
691
+ // NUMA path: only read thread-local variable when NUMA mirrors exist
692
+ int numa_node = ggml_current_numa_node;
693
+ if (numa_node > 0 && numa_node < GGML_NUMA_MAX_NODES
694
&& tensor->__data[numa_node] != NULL) {
695
return tensor->__data[numa_node];
696
}
0 commit comments