0015-ollama-debug-tensor.patch 1.09 KB
Newer Older
Michael Yang's avatar
Michael Yang committed
1
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2
3
From: jmorganca <jmorganca@gmail.com>
Date: Tue, 8 Apr 2025 20:36:41 -0700
Michael Yang's avatar
Michael Yang committed
4
5
6
7
8
9
10
Subject: [PATCH] ollama debug tensor

---
 ggml/src/ggml-cpu/ggml-cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ggml/src/ggml-cpu/ggml-cpu.c b/ggml/src/ggml-cpu/ggml-cpu.c
11
index 34624cca..59bd3c62 100644
Michael Yang's avatar
Michael Yang committed
12
13
--- a/ggml/src/ggml-cpu/ggml-cpu.c
+++ b/ggml/src/ggml-cpu/ggml-cpu.c
14
15
@@ -15,6 +15,8 @@
 #include "ops.h"
Michael Yang's avatar
Michael Yang committed
16
17
18
19
20
21
22
 #include "ggml.h"
 
+#include "ollama-debug.h"
+
 #if defined(_MSC_VER) || defined(__MINGW32__)
 #include <malloc.h> // using malloc.h with MSC/MINGW
 #elif !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
23
@@ -2859,6 +2861,10 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
Michael Yang's avatar
Michael Yang committed
24
25
26
27
28
29
30
31
32
33
 
         ggml_compute_forward(&params, node);
 
+#ifdef OLLAMA_DEBUG
+        ollama_debug(node, true);
+#endif
+
         if (state->ith == 0 && cplan->abort_callback &&
                 cplan->abort_callback(cplan->abort_callback_data)) {
             atomic_store_explicit(&tp->abort, node_n + 1, memory_order_relaxed);