| 245 | } |
| 246 | |
| 247 | int GetThreadCount(Context* context, int rows, int cols, int depth) { |
| 248 | // Empirically determined rule for reasonable number of |
| 249 | // threads to use. This is proportional to the number of arithmetic ops |
| 250 | // in this Mul (product of the 3 sizes). |
| 251 | int guess = (std::uint64_t(rows) * cols * depth) >> 13; |
| 252 | return clamp(guess, 1, context->max_num_threads); |
| 253 | } |
| 254 | |
| 255 | LoopStructure GetLoopStructure(int thread_count, int rows, int cols, int depth, |
| 256 | int cache_friendly_traversal_threshold) { |