| 9 | #define DIVUP(m, n) ((m) / (n) + ((m) % (n) > 0)) |
| 10 | |
| 11 | inline int opt_n_threads(int work_size) { |
| 12 | const int pow_2 = std::log(static_cast<double>(work_size)) / std::log(2.0); |
| 13 | return std::max(std::min(1 << pow_2, TOTAL_THREADS), 1); |
| 14 | } |
| 15 | |
| 16 | inline dim3 opt_block_config(int x, int y) { |
| 17 | const int x_threads = opt_n_threads(x); |