Skip to content

Commit 2a909a8

Browse files
committed
fix shared memory checking logic
1 parent 1d0b2c8 commit 2a909a8

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

include/rxmesh/rxmesh_static.h

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,20 +1969,41 @@ class RXMeshStatic : public RXMesh
19691969
local_mem_per_thread);
19701970

19711971
RXMESH_TRACE(
1972-
"RXMeshStatic::check_shared_memory() available total shared "
1973-
"memory per block = {} (bytes) = {} (Kb)",
1974-
devProp.sharedMemPerBlock,
1975-
float(devProp.sharedMemPerBlock) / 1024.0f);
1972+
"RXMeshStatic::check_shared_memory() max dynamic shared "
1973+
"memory per block for this function = {} (bytes) = {} "
1974+
"(Kb)",
1975+
func_attr.maxDynamicSharedSizeBytes,
1976+
float(func_attr.maxDynamicSharedSizeBytes) / 1024.0f);
1977+
1978+
RXMESH_TRACE(
1979+
"RXMeshStatic::check_shared_memory() max total shared "
1980+
"memory per block for the current device = {} (bytes) = {} "
1981+
"(Kb)",
1982+
devProp.sharedMemPerBlockOptin,
1983+
float(devProp.sharedMemPerBlockOptin) / 1024.0f);
19761984
}
19771985

1978-
if (smem_bytes_static + smem_bytes_dyn > devProp.sharedMemPerBlock) {
1986+
if (smem_bytes_dyn > func_attr.maxDynamicSharedSizeBytes) {
19791987
RXMESH_ERROR(
1980-
" RXMeshStatic::check_shared_memory() shared memory needed for"
1981-
" input function ({} bytes) exceeds the max shared memory "
1982-
"per block on the current device ({} bytes)",
1988+
" RXMeshStatic::check_shared_memory() dynamic shared memory "
1989+
"needed for input function ({} bytes) exceeds the max dynamic "
1990+
"shared memory per block for this function ({} bytes)",
1991+
smem_bytes_dyn,
1992+
func_attr.maxDynamicSharedSizeBytes);
1993+
// exit(EXIT_FAILURE);
1994+
}
1995+
1996+
1997+
if (smem_bytes_static + smem_bytes_dyn >
1998+
devProp.sharedMemPerBlockOptin) {
1999+
RXMESH_ERROR(
2000+
" RXMeshStatic::check_shared_memory() total shared memory "
2001+
"needed for input function ({} bytes) exceeds the max total "
2002+
"shared memory per block (opt-in) on the current device ({} "
2003+
"bytes)",
19832004
smem_bytes_static + smem_bytes_dyn,
1984-
devProp.sharedMemPerBlock);
1985-
exit(EXIT_FAILURE);
2005+
devProp.sharedMemPerBlockOptin);
2006+
// exit(EXIT_FAILURE);
19862007
}
19872008

19882009
if (num_blocks_per_sm == 0) {
@@ -1994,7 +2015,7 @@ class RXMeshStatic : public RXMesh
19942015
"and/or break the kernel into such that the number of "
19952016
"registers is less. You may also try reducing the amount of "
19962017
"additional shared memory you requested");
1997-
exit(EXIT_FAILURE);
2018+
// exit(EXIT_FAILURE);
19982019
}
19992020
}
20002021

0 commit comments

Comments
 (0)