Until now, strict behavior in the number of threads and blocks has been applied only when the kernel is in bare mode. When this mode is enabled, the values passed in UserNumBlocks and UserThreadLimit are not adjusted and are the definitive values used to launch the kernel. This commit detaches the strictness from the kernel mode. This is going to be used by the kernel replay tool. Additionally, it starts clearing the path for the upcoming OpenMP dims modifier, used to configure multidimensional teams and leagues, which will include strictness choices for teams and threads. All the bare kernels must indicate strict behavior. Asserts are added to check this condition.
14 lines
428 B
C++
14 lines
428 B
C++
#include <gpuintrin.h>
|
|
#include <stdint.h>
|
|
|
|
extern "C" __gpu_kernel void gridsize(uint32_t *nblocks, uint32_t *nthreads) {
|
|
if (__gpu_block_id(0) == 0 && __gpu_block_id(1) == 0 &&
|
|
__gpu_block_id(2) == 0 && __gpu_thread_id(0) == 0 &&
|
|
__gpu_thread_id(1) == 0 && __gpu_thread_id(2) == 0) {
|
|
for (int i = 0; i < 3; ++i) {
|
|
nblocks[i] = __gpu_num_blocks(i);
|
|
nthreads[i] = __gpu_num_threads(i);
|
|
}
|
|
}
|
|
}
|