21
21
#pragma warning(disable: 4244 4267) // possible loss of data
22
22
#endif
23
23
24
- void ggml_graph_compute_helper (std::vector<uint8_t > & buf, ggml_cgraph * graph, int n_threads) {
24
+ static void ggml_graph_compute_helper (std::vector<uint8_t > & buf, ggml_cgraph * graph, int n_threads) {
25
25
struct ggml_cplan plan = ggml_graph_plan (graph, n_threads);
26
26
27
27
if (plan.work_size > 0 ) {
@@ -32,7 +32,7 @@ void ggml_graph_compute_helper(std::vector<uint8_t> & buf, ggml_cgraph * graph,
32
32
ggml_graph_compute (graph, &plan);
33
33
}
34
34
35
- float tensor_sum_elements (const ggml_tensor * tensor) {
35
+ static float tensor_sum_elements (const ggml_tensor * tensor) {
36
36
double sum = 0 ;
37
37
if (tensor->type == GGML_TYPE_F32) {
38
38
for (int j = 0 ; j < tensor->ne [1 ]; j++) {
@@ -44,7 +44,7 @@ float tensor_sum_elements(const ggml_tensor * tensor) {
44
44
return sum;
45
45
}
46
46
47
- void tensor_dump (const ggml_tensor * tensor, const char * name) {
47
+ static void tensor_dump (const ggml_tensor * tensor, const char * name) {
48
48
printf (" %15s: type = %i (%5s) ne = %5" PRIi64 " x %5" PRIi64 " x %5" PRIi64 " , nb = (%5zi, %5zi, %5zi) - " , name,
49
49
tensor->type , ggml_type_name (tensor->type ),
50
50
tensor->ne [0 ], tensor->ne [1 ], tensor->ne [2 ], tensor->nb [0 ], tensor->nb [1 ], tensor->nb [2 ]);
@@ -59,7 +59,7 @@ struct benchmark_params_struct {
59
59
int32_t n_iterations = 10 ;
60
60
};
61
61
62
- void print_usage (int /* argc*/ , char ** argv, struct benchmark_params_struct params) {
62
+ static void print_usage (int /* argc*/ , char ** argv, struct benchmark_params_struct params) {
63
63
fprintf (stderr, " usage: %s [options]\n " , argv[0 ]);
64
64
fprintf (stderr, " \n " );
65
65
fprintf (stderr, " options:\n " );
@@ -253,7 +253,7 @@ int main(int argc, char ** argv) {
253
253
// Check that the matrix multiplication result is in the right ballpark
254
254
// We cannot use the exact value from the F32 multiplication because the quantizuation will be slightly different
255
255
float sum_of_Q4_result = tensor_sum_elements (gf31.nodes [0 ]);
256
- float delta = abs (sum_of_Q4_result - sum_of_F32_reference);
256
+ float delta = std:: abs (sum_of_Q4_result - sum_of_F32_reference);
257
257
float allowed_delta = (sum_of_F32_reference) / 1000 / 1000 ; // Let's accept an epsilon of 10^-6
258
258
259
259
if (delta > allowed_delta) {
0 commit comments