Calculate the GPU launch config we should use for a kernel launch. This is assuming the kernel is quite simple and will largely be memory-limited. REQUIRES: work_element_count > 0.
| 125 | // memory-limited. |
| 126 | // REQUIRES: work_element_count > 0. |
| 127 | inline GpuLaunchConfig GetGpuLaunchConfig(int work_element_count, |
| 128 | const Eigen::GpuDevice& d) { |
| 129 | CHECK_GT(work_element_count, 0); |
| 130 | GpuLaunchConfig config; |
| 131 | const int virtual_thread_count = work_element_count; |
| 132 | const int physical_thread_count = std::min( |
| 133 | d.getNumGpuMultiProcessors() * d.maxGpuThreadsPerMultiProcessor(), |
| 134 | virtual_thread_count); |
| 135 | const int thread_per_block = std::min(1024, d.maxGpuThreadsPerBlock()); |
| 136 | const int block_count = |
| 137 | std::min(DivUp(physical_thread_count, thread_per_block), |
| 138 | d.getNumGpuMultiProcessors()); |
| 139 | |
| 140 | config.virtual_thread_count = virtual_thread_count; |
| 141 | config.thread_per_block = thread_per_block; |
| 142 | config.block_count = block_count; |
| 143 | return config; |
| 144 | } |
| 145 | #ifndef TENSORFLOW_USE_ROCM |
| 146 | inline CudaLaunchConfig GetCudaLaunchConfig(int work_element_count, |
| 147 | const Eigen::GpuDevice& d) { |
no test coverage detected