[HIPIFY] Errors when processing the NVIDIA sample "simpleMultiCopy"
(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.
Still reproducible due to possibly incorrect declaration of max function in __clang_cuda_math.h. Mark the bug as clang bug.
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.
Hello @rakicaleksandar1999. Unfortunately, we can't change CUDA samples, but thanks for proposing a workaround.