HIPIFY icon indicating copy to clipboard operation
HIPIFY copied to clipboard

[HIPIFY] Errors when processing the NVIDIA sample "simpleMultiCopy"

Open wuren2020 opened this issue 5 years ago • 3 comments

(Related to #134) Ran hipify-clang /path/to/NVIDIA_CUDA-10.2_Samples/0_Simple/simpleMultiCopy/simpleMultiCopy.cu --skip-excluded-preprocessor-conditional-blocks -- -I/path/to/NVIDIA_CUDA-10.2_Samples/common/inc and got

/tmp/simpleMultiCopy.cu-2fb81b.hip:128:7: error: no matching function for call to 'max'
      max((32.0f / (_ConvertSMVer2Cores(deviceProp.major, deviceProp.minor) *
...
...
/usr/local/cuda-10.2/include/crt/math_functions.hpp:1079:31: note: candidate function not viable: call to __device__ function from __host__ function
__MATH_FUNCTIONS_DECL__ float max(float a, float b)

even though __MATH_FUNCTIONS_DECL__ is defined as `__host__ __device__' in math_functions.hpp.

wuren2020 avatar Jun 19 '20 02:06 wuren2020

Still reproducible due to possibly incorrect declaration of max function in __clang_cuda_math.h. Mark the bug as clang bug.

emankov avatar Feb 16 '21 11:02 emankov

patch The simpleMultiCopy.cu file should be modified so that it includes the <algorithm> header and uses the std namespace because the std::max function is defined in that header, as explained here.

rakicaleksandar1999 avatar Feb 21 '24 18:02 rakicaleksandar1999

Hello @rakicaleksandar1999. Unfortunately, we can't change CUDA samples, but thanks for proposing a workaround.

emankov avatar Feb 21 '24 19:02 emankov