sgemm_wg: Fix possible divide-by-0
This commit is contained in:
@@ -132,7 +132,7 @@ void kernel_body(int task_id, kernel_arg_t* __UNIFORM__ arg) {
|
|||||||
const uint32_t threads_per_threadblock = (BM * BN) / (TM * TN);
|
const uint32_t threads_per_threadblock = (BM * BN) / (TM * TN);
|
||||||
#ifdef RADIANCE
|
#ifdef RADIANCE
|
||||||
const uint32_t threadblocks_per_core =
|
const uint32_t threadblocks_per_core =
|
||||||
vx_num_threads() * vx_num_warps() / (threads_per_threadblock / CORES_PER_CLUSTER);
|
vx_num_threads() * vx_num_warps() / threads_per_threadblock * CORES_PER_CLUSTER;
|
||||||
#else
|
#else
|
||||||
const uint32_t threadblocks_per_core =
|
const uint32_t threadblocks_per_core =
|
||||||
vx_num_threads() * vx_num_warps() / threads_per_threadblock;
|
vx_num_threads() * vx_num_warps() / threads_per_threadblock;
|
||||||
@@ -149,13 +149,13 @@ void kernel_body(int task_id, kernel_arg_t* __UNIFORM__ arg) {
|
|||||||
const int threadblock_id_x = threadblock_id % dim_n_in_blocks;
|
const int threadblock_id_x = threadblock_id % dim_n_in_blocks;
|
||||||
const int threadblock_id_y = threadblock_id / dim_n_in_blocks;
|
const int threadblock_id_y = threadblock_id / dim_n_in_blocks;
|
||||||
|
|
||||||
|
// "static" shared memory allocation. This would determine threadblock
|
||||||
|
// occupancy of a single cluster
|
||||||
float *sharedmem_per_threadblock =
|
float *sharedmem_per_threadblock =
|
||||||
(float *)DEV_SMEM_START_ADDR +
|
(float *)DEV_SMEM_START_ADDR + (2 * BM * BK) * threadblock_id_in_core;
|
||||||
(2 * BM * BK) * threadblock_id_in_core;
|
thread_block_gemm(arg, tid_in_threadblock, threadblock_dim_x,
|
||||||
thread_block_gemm(arg, tid_in_threadblock,
|
threadblock_dim_y, threadblock_id_x, threadblock_id_y,
|
||||||
threadblock_dim_x, threadblock_dim_y, threadblock_id_x,
|
threadblock_id_in_core, sharedmem_per_threadblock);
|
||||||
threadblock_id_y, threadblock_id_in_core,
|
|
||||||
sharedmem_per_threadblock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user