Skip to content

Commit 04fb13d

Browse files
committed
llama-bench : fix unexpected global variable initialize sequence issue
1 parent fef0cbe commit 04fb13d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/llama-bench/llama-bench.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,8 @@ static std::vector<cmd_params_instance> get_cmd_params_instances(const cmd_param
876876
struct test {
877877
static const std::string build_commit;
878878
static const int build_number;
879-
static const std::string cpu_info;
880-
static const std::string gpu_info;
879+
const std::string cpu_info;
880+
const std::string gpu_info;
881881
std::string model_filename;
882882
std::string model_type;
883883
uint64_t model_size;
@@ -903,7 +903,9 @@ struct test {
903903
std::string test_time;
904904
std::vector<uint64_t> samples_ns;
905905

906-
test(const cmd_params_instance & inst, const llama_model * lmodel, const llama_context * ctx) {
906+
test(const cmd_params_instance & inst, const llama_model * lmodel, const llama_context * ctx)
907+
:cpu_info(get_cpu_info()),
908+
gpu_info(get_gpu_info()) {
907909
model_filename = inst.model;
908910
char buf[128];
909911
llama_model_desc(lmodel, buf, sizeof(buf));
@@ -1058,8 +1060,6 @@ struct test {
10581060

10591061
const std::string test::build_commit = LLAMA_COMMIT;
10601062
const int test::build_number = LLAMA_BUILD_NUMBER;
1061-
const std::string test::cpu_info = get_cpu_info();
1062-
const std::string test::gpu_info = get_gpu_info();
10631063

10641064
struct printer {
10651065
virtual ~printer() {}

0 commit comments

Comments
 (0)