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

amd_hip_fp16.h: candidate function not viable: call to __device__ function from __host__ function #3690

Open
jinz2014 opened this issue Nov 28, 2024 · 3 comments

Comments

@jinz2014
Copy link

I am not sure if the issues were reported before.

/opt/rocm-6.2.0/lib/llvm/bin/../../../include/hip/amd_detail/amd_hip_fp16.h:280:24: note: candidate function not viable: call to device function from host function
280 | __half operator*(const __half& x, const __half& y)

/opt/rocm-6.2.0/lib/llvm/bin/../../../include/hip/amd_detail/amd_hip_fp16.h:287:24: note: candidate function not viable: call to device function from host function
287 | __half operator/(const __half& x, const __half& y)
| ^

@cjatin
Copy link
Contributor

cjatin commented Nov 28, 2024

can you share sample as well.

@jinz2014
Copy link
Author

@cjatin
Copy link
Contributor

cjatin commented Nov 30, 2024

I think the issue is the attempt to use * operator for __half on host. Which on HIP is not supported. There is just __device__ variants available: https://github.com/ROCm/clr/blob/c47f9dda5886b8062cad1b9c9736671241ab6f9a/hipamd/include/hip/amd_detail/amd_hip_fp16.h#L198

One thing you might need to do (for now) here is pass on _Float16 for hosts and __half for device. Something like this: https://gist.github.com/cjatin/b92a5b51adc2e0e4a60d4ad7c4d2fdc2 (although there might be better design possible than what I wrote here)

I think we should add the host operators, will create a task for it internally to track and add these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants