-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Solve name resolution problems due to Windows integer types #523
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
Conversation
There are 3 Windows CTS tests, math_builtin_relational_base, math_builtin_float_double, math_builtin_integer that fail at compile time in all 3 environments. Here's a small reproducer showing the symptom: The error is like this, math_builtin_float_double.cpp:8:12: error: no matching function for call to 'nan' auto x = cl::sycl::nan(y); ^~~~~~~~~~~~~ ...include\CL/sycl/builtins.hpp:398:1: note: candidate template ignored: requirement 'detail::integral_constant<bool, false>::value' was not satisfied [with T = int] nan(T nancode) __NOEXC { ^ 1 error generated. Here’s a smaller version of the invoker, int foo(void) { //unsigned long int y = 1; FAIL like above //long int y = 1; FAIL like above //int y = 1; FAIL like above unsigned y = 1; // This one is OK auto x = cl::sycl::nan(y); } Erich suggested, https://godbolt.org/z/XkWVHg Even on MSVC, “unsigned int” and “unsigned long” are different types, despite sizeof being the same for both. The header itself uses __int32 and __int64, which are just aliases on MSVC for “unsigned int” and “unsigned long long”. THUS, the list in the headers (which I copied below) doesn’t contain ANY version of “unsigned long” on Windows. Ulonglong (the other being checked) is ALSO “unsigned long long” On linux, the list is: cl_uint == unsigned int cl_ulong == unsigned long ulonglong == unsigned long long. Thus, the whole list is covered. I suspect that one of the checks (is_ugenlong probably ) simply needs to have “unsigned long” added to it as an option in addition to cl_ulong. Alternatively, cl_ulong could be corrected. Either way, a header issue. Signed-off-by: Melanie Blower <[email protected]>
I made a git error trying to upload another revision of #516, so i uploaded a clearn version here. |
I applied #623 to my windows otcshare / workspace and i tried the test But the error diagnostics are similar to what was seen before. Let me know if there's a different test case that you want me to try. ======== math_builtin_relational_base log file ============================================= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase.
std::integral_constant<bool, is_contained<T, type_list<cl_ulong>>::value || | ||
is_ulongn<T>::value>; | ||
std::integral_constant<bool, | ||
is_contained<T, type_list<unsigned long, cl_ulong>>::value || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will something broken if we will delete cl_ulong from here?
I prefer see one type here, like in a comment(SYCL spec, ugenlong set) above.
The same applies to other changes.
@mibintc, please, close this PR, if you agree with @alexeyvoronov. |
There are 3 Windows CTS tests, math_builtin_relational_base,
math_builtin_float_double, math_builtin_integer that fail at compile
time in all 3 environments.
Here's a small reproducer showing the symptom:
The error is like this,
math_builtin_float_double.cpp:8:12: error: no matching function for call to 'nan'
auto x = cl::sycl::nan(y);
^~~~~~~~~~~~~
...include\CL/sycl/builtins.hpp:398:1: note: candidate template
ignored: requirement 'detail::integral_constant<bool, false>::value' was not satisfied [with T = int]
nan(T nancode) __NOEXC {
^
1 error generated.
Here’s a smaller version of the invoker,
int foo(void)
{
//unsigned long int y = 1; FAIL like above
//long int y = 1; FAIL like above
//int y = 1; FAIL like above
unsigned y = 1; // This one is OK
auto x = cl::sycl::nan(y);
}
Erich suggested,
https://godbolt.org/z/XkWVHg
Even on MSVC, “unsigned int” and “unsigned long” are different types, despite sizeof being the same for both.
The header itself uses __int32 and __int64, which are just aliases on MSVC for “unsigned int” and “unsigned long long”.
THUS, the list in the headers (which I copied below) doesn’t contain ANY version of “unsigned long” on Windows. Ulonglong (the other being checked) is ALSO “unsigned long long”
On linux, the list is:
cl_uint == unsigned int
cl_ulong == unsigned long
ulonglong == unsigned long long.
Thus, the whole list is covered.
I suspect that one of the checks (is_ugenlong probably ) simply needs to have “unsigned long” added to it as an option in addition to cl_ulong. Alternatively, cl_ulong could be corrected.
Either way, a header issue.
Signed-off-by: Melanie Blower [email protected]