MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / postprocess_cpu_params

Function postprocess_cpu_params

smallthinker/common/common.cpp:253–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251
252
253void postprocess_cpu_params(cpu_params& cpuparams, const cpu_params* role_model) {
254 int32_t n_set = 0;
255
256 if (cpuparams.n_threads < 0) {
257 // Assuming everything about cpuparams is invalid
258 if (role_model != nullptr) {
259 cpuparams = *role_model;
260 } else {
261 cpuparams.n_threads = cpu_get_num_math();
262 }
263 }
264
265 for (int32_t i = 0; i < GGML_MAX_N_THREADS; i++) {
266 if (cpuparams.cpumask[i]) {
267 n_set++;
268 }
269 }
270
271 if (n_set && n_set < cpuparams.n_threads) {
272 // Not enough set bits, may experience performance issues.
273 LOG_WRN("Not enough set bits in CPU mask (%d) to satisfy requested thread count: %d\n", n_set, cpuparams.n_threads);
274 }
275}
276
277bool parse_cpu_range(const std::string & range, bool (&boolmask)[GGML_MAX_N_THREADS]) {
278 size_t dash_loc = range.find('-');

Callers 1

common_params_parse_exFunction · 0.85

Calls 1

cpu_get_num_mathFunction · 0.85

Tested by

no test coverage detected