Turn on CUDA warnings for unknown stack sizes

These were previously suppressed because they are unavoidable when
calling virtual methods. But we no longer support virtual methods on
devices (it is deprecated).

These warnings can still happen if you have unbounded recursion. But we
would like to avoid unbounded recursion, so we would like to see these
warnings.

Also turned on other nvlink warnings, which include when a recursive
function call means that the compiler cannot figure out the full
stack depth.
This commit is contained in:
Kenneth Moreland 2021-07-20 14:23:00 -06:00
parent 9007c97c4c
commit fc58f4edc6
3 changed files with 27 additions and 29 deletions

@ -171,13 +171,6 @@ elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG)
endif()
function(setup_cuda_flags)
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
#nvcc 9 introduced specific controls to disable the stack size warning
#otherwise we let the warning occur. We have to set this in CMAKE_CUDA_FLAGS
#as it is passed to the device link step, unlike compile_options
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xnvlink=--suppress-stack-size-warning" PARENT_SCOPE)
endif()
set(display_error_nums -Xcudafe=--display_error_number)
target_compile_options(vtkm_developer_flags INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:${display_error_nums}>)
endfunction()

@ -36,26 +36,14 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
# disable static/dynamic weak symbol warnings
".*ld: warning: direct access in function.*"
# disable PTX warning about recursive functions. These look like they can't be silenced
# without disabling all PTX warnings, show hide them on the dashboard.
# We explicitly only suppress specific worklets so we can see when new recursive
# worklets are added
"ptxas warning : Stack size for entry function.*NearestNeighborSearch3DWorklet.*"
"ptxas warning : Stack size for entry function.*CoordinatesPortal.*"
"ptxas warning : Stack size for entry function.*CellRangesExtracter.*"
# disable nvlink warnings about virtual functions. The Stack size warnings can only
# be silenced in CUDA >=9, without disabling all nvlink warnings.
"nvlink warning : Stack size for entry function.*NearestNeighborSearch.*"
"nvlink warning : Stack size for entry function.*BoundingIntervalHierarchyTester.*"
"nvlink warning : Stack size for entry function.*ArrayPortalRef.*"
"nvlink warning : Stack size for entry function.*ArrayPortalWrapper.*"
"nvlink warning : .*ArrayPortalWrapper.* has address taken but no possible call to it"
"nvlink warning : .*ArrayPortalVirtual.* has address taken but no possible call to it"
"nvlink warning : .*CellLocatorBoundingIntervalHierarchyExec.* has address taken but no possible call to it"
"nvlink warning : .*CellLocatorRectilinearGrid.* has address taken but no possible call to it"
"nvlink warning : .*CellLocatorTwoLevel.* has address taken but no possible call to it"
"nvlink warning : .*CellLocatorUniformGrid.* has address taken but no possible call to it"
# disable nvlink warnings about arch not found
# These indicate that a flag like -arch is missing from the link command.
# I am seeing these for the Kokkos builds, and I don't want to fight the
# compiler flags there, so I'm just going to suppress those.
".*nvlink warning.*SM Arch.*not found in.*"
)
list(APPEND CTEST_CUSTOM_WARNING_MATCH
# Let CUDA compiler warn us about recursive functions we should avoid.
".*nvlink warning.*"
)

@ -0,0 +1,17 @@
# Remove unbounded recursion
GPU device compilers like to determine the stack size needed for a called
kernel. This is only possible if there is no recursive function calls on
the device or at least recursive calls where the termination cannot be
found at compile time.
Device compilers do not particularly like that. We have been getting around
this with CUDA by turning of warnings about stack sizes and setting a large
stack size during a call (which works but is dangerous). More restrictive
devices might not allow recursive calls at all.
To fix this, we will avoid recursive calls in execution environment
(device) code. All such warnings are turned on.
Because of this, we also should not have to worry about lengthening the
stack size, so that code is also removed.