-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
[HIP] calling math function with user defined type causes ambiguity #101239
Labels
clang:headers
Headers provided by Clang, e.g. for intrinsics
Comments
yxsamliu
added a commit
to yxsamliu/llvm-project
that referenced
this issue
Jul 31, 2024
If there is a type T which can be converted to both float and double etc but itself is not specialized for __numeric_type, and it is called for math functions eg. fma, it will cause ambiguity with test function of __numeric_type. Since test is not template, this error is not bypassed by SFINAE. This is a design flaw of __numeric_type. This patch fixes clang wrapper header to use SFINAE to avoid such ambiguity. Fixes: SWDEV-461604 Fixes: llvm#101239
yxsamliu
added a commit
that referenced
this issue
Aug 2, 2024
If there is a type T which can be converted to both float and double etc but itself is not specialized for __numeric_type, and it is called for math functions eg. fma, it will cause ambiguity with test function of __numeric_type. Since test is not template, this error is not bypassed by SFINAE. This is a design flaw of __numeric_type. This patch fixes clang wrapper header to use SFINAE to avoid such ambiguity. Fixes: SWDEV-461604 Fixes: #101239
EugeneZelenko
added
clang:headers
Headers provided by Clang, e.g. for intrinsics
and removed
new issue
labels
Aug 2, 2024
banach-space
pushed a commit
to banach-space/llvm-project
that referenced
this issue
Aug 7, 2024
If there is a type T which can be converted to both float and double etc but itself is not specialized for __numeric_type, and it is called for math functions eg. fma, it will cause ambiguity with test function of __numeric_type. Since test is not template, this error is not bypassed by SFINAE. This is a design flaw of __numeric_type. This patch fixes clang wrapper header to use SFINAE to avoid such ambiguity. Fixes: SWDEV-461604 Fixes: llvm#101239
kstoimenov
pushed a commit
to kstoimenov/llvm-project
that referenced
this issue
Aug 15, 2024
If there is a type T which can be converted to both float and double etc but itself is not specialized for __numeric_type, and it is called for math functions eg. fma, it will cause ambiguity with test function of __numeric_type. Since test is not template, this error is not bypassed by SFINAE. This is a design flaw of __numeric_type. This patch fixes clang wrapper header to use SFINAE to avoid such ambiguity. Fixes: SWDEV-461604 Fixes: llvm#101239
searlmc1
pushed a commit
to ROCm/llvm-project
that referenced
this issue
Sep 24, 2024
If there is a type T which can be converted to both float and double etc but itself is not specialized for __numeric_type, and it is called for math functions eg. fma, it will cause ambiguity with test function of __numeric_type. Since test is not template, this error is not bypassed by SFINAE. This is a design flaw of __numeric_type. This patch fixes clang wrapper header to use SFINAE to avoid such ambiguity. Fixes: SWDEV-461604 Fixes: llvm#101239 Change-Id: I6cd22046aaf3c18871d95244a07ecddad23449a7
searlmc1
pushed a commit
to ROCm/llvm-project
that referenced
this issue
Nov 22, 2024
If there is a type T which can be converted to both float and double etc but itself is not specialized for __numeric_type, and it is called for math functions eg. fma, it will cause ambiguity with test function of __numeric_type. Since test is not template, this error is not bypassed by SFINAE. This is a design flaw of __numeric_type. This patch fixes clang wrapper header to use SFINAE to avoid such ambiguity. Fixes: SWDEV-461604 Fixes: llvm#101239 Change-Id: I285adbeb7bf8fe57d084625b98fa6fd49092d641
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code causes ambiguity for HIP but not for CUDA.
https://godbolt.org/z/TdjvxP7q9
The error message is
The reason is that
__test
is not a template member function of__hip::__numeric_type
. When ambiguity happens during overloading resolution offma
, the ambiguity error won't be bypassed through SFINAE so that clang can abandon the unsuccessful overloading resolution of thefma
template defined in clang wrapper header and take the user definedfma
.This is a design flaw of
__hip::__numeric_type
and can be fixed by introducing a template__test_impl
member function to enable SFINAE.The text was updated successfully, but these errors were encountered: