| 266 | |
| 267 | |
| 268 | void postprocess_cpu_params(cpu_params& cpuparams, const cpu_params* role_model) { |
| 269 | int32_t n_set = 0; |
| 270 | |
| 271 | if (cpuparams.n_threads < 0) { |
| 272 | // Assuming everything about cpuparams is invalid |
| 273 | if (role_model != nullptr) { |
| 274 | cpuparams = *role_model; |
| 275 | } else { |
| 276 | cpuparams.n_threads = cpu_get_num_math(); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | for (int32_t i = 0; i < GGML_MAX_N_THREADS; i++) { |
| 281 | if (cpuparams.cpumask[i]) { |
| 282 | n_set++; |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | if (n_set && n_set < cpuparams.n_threads) { |
| 287 | // Not enough set bits, may experience performance issues. |
| 288 | LOG_WRN("Not enough set bits in CPU mask (%d) to satisfy requested thread count: %d\n", n_set, cpuparams.n_threads); |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | bool parse_cpu_range(const std::string & range, bool (&boolmask)[GGML_MAX_N_THREADS]) { |
| 293 | size_t dash_loc = range.find('-'); |
no test coverage detected