Skip to content

Commit f3540e6

Browse files
committed
invert switch logic for hyperthreading/efficiency cores
1 parent 8bbb08b commit f3540e6

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

common/arg.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,17 +1387,17 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
13871387
}
13881388
));
13891389
add_opt(common_arg(
1390-
{"--no-hyperthreading"},
1390+
{"--cpu-no-hyperthreading"},
13911391
"disable hyperthreading/SMT for math operations (use only physical cores)",
13921392
[](common_params & params) {
13931393
params.cpuparams.use_hyperthreading = false;
13941394
}
13951395
));
13961396
add_opt(common_arg(
1397-
{"--use-efficiency-cores"},
1398-
"use efficiency cores (E-cores) for math operations (may degrade performance)",
1397+
{"--cpu-no-efficiency-cores"},
1398+
"disable efficiency cores (E-cores) for math operations (use only performance cores)",
13991399
[](common_params & params) {
1400-
params.cpuparams.use_efficiency_cores = true;
1400+
params.cpuparams.use_efficiency_cores = false;
14011401
}
14021402
));
14031403
add_opt(common_arg(

common/common.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ int32_t cpu_get_num_math() {
281281
if (is_hybrid_cpu()) {
282282
cpu_set_t affinity;
283283
if (!pthread_getaffinity_np(pthread_self(), sizeof(affinity), &affinity)) {
284-
// Default behavior: use hyperthreading but not efficiency cores for math
284+
// Default behavior: use hyperthreading and efficiency cores for math
285285
// This can be overridden by environment variables or command-line options
286-
bool use_hyperthreading = std::getenv("LLAMA_NO_HYPERTHREADING") == nullptr;
287-
bool use_efficiency_cores = std::getenv("LLAMA_USE_EFFICIENCY_CORES") != nullptr;
286+
bool use_hyperthreading = std::getenv("LLAMA_CPU_NO_HYPERTHREADING") == nullptr;
287+
bool use_efficiency_cores = std::getenv("LLAMA_CPU_NO_EFFICIENCY_CORES") == nullptr;
288288

289289
int result = cpu_count_math_cpus(n_cpu, use_hyperthreading, use_efficiency_cores);
290290
pthread_setaffinity_np(pthread_self(), sizeof(affinity), &affinity);

common/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct cpu_params {
5656
bool strict_cpu = false; // Use strict CPU placement
5757
uint32_t poll = 50; // Polling (busywait) level (0 - no polling, 100 - mostly polling)
5858
bool use_hyperthreading = true; // Use hyperthreading/SMT for math operations (enabled by default)
59-
bool use_efficiency_cores = false; // Use efficiency cores (E-cores) for math operations
59+
bool use_efficiency_cores = true; // Use efficiency cores (E-cores) for math operations (enabled by default)
6060
};
6161

6262
int32_t cpu_get_num_physical_cores();

0 commit comments

Comments
 (0)