Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wuren2020 opened this issue Jun 19, 2020 · 3 comments
Open
Assignees
Labels
bug Something isn't working clang clang compiler related issue or change Under Investigation

Comments

@wuren2020
Copy link

(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 wuren2020 changed the title Errors when processing the NVIDIA sample "simpleMultiCopy" [HIPIFY] Errors when processing the NVIDIA sample "simpleMultiCopy" Jun 19, 2020
@emankov emankov self-assigned this Jun 23, 2020
@emankov emankov added the bug Something isn't working label Jun 23, 2020
@emankov
Copy link
Collaborator

emankov commented Feb 16, 2021

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

@emankov emankov added the clang clang compiler related issue or change label Feb 16, 2021
@rakicaleksandar1999
Copy link

rakicaleksandar1999 commented Feb 21, 2024

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.

@emankov
Copy link
Collaborator

emankov commented Feb 21, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working clang clang compiler related issue or change Under Investigation
Projects
None yet
Development

No branches or pull requests

4 participants