Disable VTKM_ASSERT when using HIP

This commit is contained in:
Robert Maynard 2020-09-16 10:04:12 -04:00
parent 68b5edfcba
commit 9bd6f3e6da
5 changed files with 25 additions and 0 deletions

@ -108,6 +108,12 @@ vtkm_option(VTKm_NO_ASSERT "Disable assertions in debugging builds." OFF)
# for CUDA devices.
vtkm_option(VTKm_NO_ASSERT_CUDA "Disable assertions for CUDA devices." ON)
# The HIP compiler (as of ROCm 3.7) takes a surprising long time to compile
# kernels with assert in them they generate `printf` calls which are very
# slow ( cause massive register spillage). By default we turn off asserts when
# compiling for HIP devices.
vtkm_option(VTKm_NO_ASSERT_HIP "Disable assertions for HIP devices." ON)
# When VTK-m is embedded into larger projects that wish to make end user
# applications they want to only install libraries and don't want CMake/headers
# installed.

@ -0,0 +1,12 @@
# Disable asserts for HIP architecture builds
`assert` is supported on recent HIP cards, but compiling it is very slow,
as it triggers the usage of `printf` which. Currently (ROCm 3.7) `printf`
has a severe performance penalty and should be avoided when possible.
By default, the `VTKM_ASSERT` macro has been disabled whenever compiling
for a HIP device via kokkos.
Asserts for HIP devices can be turned back on by turning the
`VTKm_NO_ASSERT_HIP` CMake variable off. Turning this CMake variable off
will enable assertions in HIP kernels unless there is another reason
turning off all asserts (such as a release build).

@ -21,6 +21,8 @@
#define VTKM_NO_ASSERT
#elif defined(VTKM_CUDA_DEVICE_PASS) && defined(VTKM_NO_ASSERT_CUDA)
#define VTKM_NO_ASSERT
#elif defined(VTKM_HIP) && defined(VTKM_NO_ASSERT_HIP)
#define VTKM_NO_ASSERT
#endif
#endif // VTKM_NO_ASSERT

@ -15,6 +15,7 @@
set(VTKM_NO_ASSERT ${VTKm_NO_ASSERT})
set(VTKM_NO_ASSERT_CUDA ${VTKm_NO_ASSERT_CUDA})
set(VTKM_NO_ASSERT_HIP ${VTKm_NO_ASSERT_HIP})
set(VTKM_USE_DOUBLE_PRECISION ${VTKm_USE_DOUBLE_PRECISION})
set(VTKM_USE_64BIT_IDS ${VTKm_USE_64BIT_IDS})

@ -71,6 +71,10 @@
#cmakedefine VTKM_NO_ASSERT_CUDA
#endif
#if !defined(VTKM_NO_ASSERT_HIP)
#cmakedefine VTKM_NO_ASSERT_HIP
#endif
#if !defined(VTKM_USE_DOUBLE_PRECISION) && !defined(VTKM_NO_DOUBLE_PRECISION)
#cmakedefine VTKM_USE_DOUBLE_PRECISION
#endif