| 251 | |
| 252 | |
| 253 | void 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 | |
| 277 | bool parse_cpu_range(const std::string & range, bool (&boolmask)[GGML_MAX_N_THREADS]) { |
| 278 | size_t dash_loc = range.find('-'); |
no test coverage detected