You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/usr/gapps/bdiv/blueos_3_ppc64le_ib_p9/clang-14-cuda-11.8-gcc831/axom/0.8.1-cuda/include/axom/spin/policy/LinearBVH.hpp(82): warning #20013-D: calling a constexpr __host__ function("max") from a __host__ __device__ function("operator()") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.
For HIP, it looks like no extra namespace is needed and the compiler does the right thing; i.e., std::numeric_limits::max() will work in host and device code. For example, the following works
For example, users see this warning:
/usr/gapps/bdiv/blueos_3_ppc64le_ib_p9/clang-14-cuda-11.8-gcc831/axom/0.8.1-cuda/include/axom/spin/policy/LinearBVH.hpp(82): warning #20013-D: calling a constexpr __host__ function("max") from a __host__ __device__ function("operator()") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.
The code generating the warning is: https://github.com/LLNL/axom/blob/develop/src/axom/spin/policy/LinearBVH.hpp#L82
We should replace use of 'std' utility methods in our host-device methods with methods we support in core that are appropriate for use in host-device code, for example something like this: https://github.com/LLNL/axom/blob/develop/src/axom/core/utilities/Utilities.hpp#L79
Here is a reference describing how std::numeric_limits is supported in CUDA: https://saturncloud.io/blog/is-there-a-cuda-equivalent-to-stdnumericlimits/
For HIP, it looks like no extra namespace is needed and the compiler does the right thing; i.e., std::numeric_limits::max() will work in host and device code. For example, the following works
`#include <hip/hip_runtime.h>
void global
kernel(int *a, size_t *b)
{
a[0] = std::numeric_limits::max();
b[0] = std::numeric_limits<size_t>::max();
}
int main(void)
{
int * a;
(void) hipMalloc(&a,sizeof(int));
(void) hipMemset(a,0,sizeof(int));
size_t * b;
(void) hipMalloc(&b,sizeof(size_t));
(void) hipMemset(b,0,sizeof(size_t));
kernel<<<1,1,0,0>>>(a,b);
int ha;
size_t hb;
(void) hipMemcpy(&ha,a,sizeof(int),hipMemcpyDeviceToHost);
(void) hipMemcpy(&hb,b,sizeof(size_t),hipMemcpyDeviceToHost);
printf("a = %i, b = %zu\n",ha,hb);
assert(ha == std::numeric_limits::max());
assert(hb == std::numeric_limits<size_t>::max());
}`
The text was updated successfully, but these errors were encountered: