38
38
#include < thread>
39
39
#include < vector>
40
40
41
+ // External declarations for build info
42
+ extern int LLAMA_BUILD_NUMBER;
43
+ extern const char *LLAMA_COMMIT;
44
+
41
45
static void init_tensor_uniform (ggml_tensor * tensor, float min = -1 .0f , float max = 1 .0f ) {
42
46
size_t nels = ggml_nelements (tensor);
43
47
std::vector<float > data (nels);
@@ -347,6 +351,8 @@ static bool output_format_from_str(const std::string & s, output_formats & forma
347
351
// Test result structure for SQL output
348
352
struct test_result {
349
353
std::string test_time;
354
+ std::string build_commit;
355
+ int build_number;
350
356
std::string backend_name;
351
357
std::string op_name;
352
358
std::string op_params;
@@ -375,6 +381,10 @@ struct test_result {
375
381
char buf[32 ];
376
382
std::strftime (buf, sizeof (buf), " %FT%TZ" , gmtime (&t));
377
383
test_time = buf;
384
+
385
+ // Set build info
386
+ build_commit = LLAMA_COMMIT;
387
+ build_number = LLAMA_BUILD_NUMBER;
378
388
}
379
389
380
390
test_result (const std::string& backend_name, const std::string& op_name, const std::string& op_params,
@@ -389,11 +399,15 @@ struct test_result {
389
399
char buf[32 ];
390
400
std::strftime (buf, sizeof (buf), " %FT%TZ" , gmtime (&t));
391
401
test_time = buf;
402
+
403
+ // Set build info
404
+ build_commit = LLAMA_COMMIT;
405
+ build_number = LLAMA_BUILD_NUMBER;
392
406
}
393
407
394
408
static const std::vector<std::string> & get_fields () {
395
409
static const std::vector<std::string> fields = {
396
- " test_time" , " backend_name" , " op_name" , " op_params" , " test_mode" ,
410
+ " test_time" , " build_commit " , " build_number " , " backend_name" , " op_name" , " op_params" , " test_mode" ,
397
411
" supported" , " passed" , " error_message" , " time_us" , " flops" ,
398
412
" bandwidth_gb_s" , " memory_kb" , " n_runs"
399
413
};
@@ -406,7 +420,7 @@ struct test_result {
406
420
if (field == " supported" || field == " passed" ) {
407
421
return BOOL;
408
422
}
409
- if (field == " memory_kb" || field == " n_runs" ) {
423
+ if (field == " memory_kb" || field == " n_runs" || field == " build_number " ) {
410
424
return INT;
411
425
}
412
426
if (field == " time_us" || field == " flops" || field == " bandwidth_gb_s" ) {
@@ -418,6 +432,8 @@ struct test_result {
418
432
std::vector<std::string> get_values () const {
419
433
return {
420
434
test_time,
435
+ build_commit,
436
+ std::to_string (build_number),
421
437
backend_name,
422
438
op_name,
423
439
op_params,
0 commit comments