Fix occupancy calculation functions in ROCclr path
The hipOccupancyMaxPotentialBlockSize API is meant to return the number of threads for the highest-occupancy workgroup, and the number of those workgroups. It was previously calculating the number of maximum-sized workgroups that would fit on a single CU. This is a mixture of the API we wanted (to calculate max potential block size) and the MaxBlocksPerMultiprocessor function. This patch fixes it up so that the internal occupancy calculation function works for two uses: the traditional function that calculates the maximum blocks per multiprocessor when a user passes in a fixed block size (used for hipMaxBlocksPerMultiprocessor style functions) and a function that calculates the size of a block that would lead to maximum occupancy, and how many blocks of that size would be needed to fill the whole GPU (for hipOccupancyMaxPotentialBlockSize style functions). This also updates the occupancy calculation function to prepare for gfx10, which does not have SGPR-based occupancy limits. Change-Id: Ie007b3f9d5ebc4e166b50a3a051498af35650f35
이 커밋은 다음에 포함됨:
+4
-3
@@ -392,11 +392,12 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
|
||||
return hipErrorLaunchFailure;
|
||||
}
|
||||
int num_blocks = 0;
|
||||
int num_grids = 0;
|
||||
int max_blocks_per_grid = 0;
|
||||
int best_block_size = 0;
|
||||
int block_size = blockDimX * blockDimY * blockDimZ;
|
||||
hip_impl::ihipOccupancyMaxActiveBlocksPerMultiprocessor(
|
||||
&num_blocks, &num_grids, device, f, block_size, sharedMemBytes, true);
|
||||
if (((gridDimX * gridDimY * gridDimZ) / block_size) > unsigned(num_grids)) {
|
||||
&num_blocks, &max_blocks_per_grid, &best_block_size, device, f, block_size, sharedMemBytes, true);
|
||||
if (((gridDimX * gridDimY * gridDimZ) / block_size) > unsigned(max_blocks_per_grid)) {
|
||||
return hipErrorCooperativeLaunchTooLarge;
|
||||
}
|
||||
}
|
||||
|
||||
새 이슈에서 참조
사용자 차단