@@ -27,14 +27,16 @@ float tensor_sum_elements(const ggml_tensor * tensor) {
27
27
return sum;
28
28
}
29
29
30
- void tensor_dump (const ggml_tensor * tensor) {
31
- printf (" %15s: type = %i (%5s) ne = %5d x %5d x %5d, nb = (%5li, %5li, %5li) - " , " tensor " ,
30
+ void tensor_dump (const ggml_tensor * tensor, const char * name ) {
31
+ printf (" %15s: type = %i (%5s) ne = %5d x %5d x %5d, nb = (%5li, %5li, %5li) - " , name ,
32
32
tensor->type , ggml_type_name (tensor->type ),
33
33
(int ) tensor->ne [0 ], (int ) tensor->ne [1 ], (int ) tensor->ne [2 ], tensor->nb [0 ], tensor->nb [1 ], tensor->nb [2 ]);
34
34
float sum = tensor_sum_elements (tensor);
35
- printf (" Sum of tensor %s is %6.2f\n " ," tensor " , sum);
35
+ printf (" Sum of tensor %s is %6.2f\n " , name , sum);
36
36
}
37
37
38
+ #define TENSOR_DUMP (tensor ) tensor_dump(tensor, #tensor)
39
+
38
40
struct benchmark_params_struct {
39
41
int32_t n_threads = 1 ;
40
42
int32_t n_iterations = 10 ;
@@ -155,12 +157,12 @@ int main(int argc, char ** argv) {
155
157
gf.n_threads =benchmark_params.n_threads ;
156
158
printf (" cgraph->n_threads=%i\n " ,gf.n_threads );
157
159
158
- tensor_dump (m11);
159
- tensor_dump (m2);
160
+ TENSOR_DUMP (m11);
161
+ TENSOR_DUMP (m2);
160
162
161
163
ggml_graph_compute (ctx, &gf);
162
164
163
- tensor_dump (gf.nodes [0 ]);
165
+ TENSOR_DUMP (gf.nodes [0 ]);
164
166
165
167
printf (" \n ------ Test 2 - Matrix Mult via Q4_0 code ------------------------------------------------------------------------------\n " );
166
168
@@ -224,7 +226,7 @@ int main(int argc, char ** argv) {
224
226
usec,gflops);
225
227
226
228
#ifdef VERBOSE_DEBUGGING
227
- tensor_dump (" res" ,gf31.nodes [0 ])
229
+ TENSOR_DUMP (" res" ,gf31.nodes [0 ])
228
230
#endif
229
231
230
232
// Check that the matrix multiplication result is in the right ballpark
0 commit comments