KhronosGroup / KhronosGroup/SYCL-CTS
Several comments/suggestions/questions about scalars_sycl_types test
- Dominant language
- C++
- Stars
- 75
- Forks
- 96
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 4
Description
There are bunch of checks which look strange/unnecessary to me:
First of all, why do we check sizes of `char`, `short int`, `long int` and other standard C++ types? I understand that SYCL compiler might be bad and break C++ spec by changing size of standard C++ types on the host, but do we really need to check that SYCL compiler is conformant with C++ standard? If so, we also need to check for a lot more things than just sizes of standard C++ types.
Anyway, the following check is wrong:
https://github.com/KhronosGroup/SYCL-CTS/blob/a5c913eb28d97097f7bb9bea10b6b4dcc73c5645/tests/scalars/scalars_sycl_types.cpp#L39-L42
C++ standard guarantees that `sizeof(char) == 1`, while this check will accept the compiler where `sizeof(char) >= 1`.
SYCL spec defines bunch of aliases which has exact bit-width (Table 4.95), but these types are not properly tested as well:
https://github.com/KhronosGroup/SYCL-CTS/blob/3744dc3ef5a1c801c868cdbe3cbf929d7fc038a5/tests/scalars/scalars_interopability_types.cpp#L41-L42
> `cl_char` - Alias to a signed 8-bit integer, as defined by the C++11 ISO Standard.
But the code in CTS will accept implementation with `sizeof(cl_char) == 2`, for example, which is not conformant with the SYCL spec
https://github.com/KhronosGroup/SYCL-CTS/blob/a5c913eb28d97097f7bb9bea10b6b4dcc73c5645/tests/scalars/scalars_sycl_types.cpp#L102-L118
What is the purpose of these checks? According to Section 6.5 Built-in scalar data types:
> In a SYCL device compiler, the device definition of all standard C++ fundamental types from Table 6.1 must match the host definition of those types, in both size and alignment. A device compiler may have this preconfigured so that it can match them based on the definitions of those types on the platform, or there may be a necessity for a device compiler command-line option to ensure the types are the same.
Would it be better then to capture sizes of fundamental C++ types on host and compare that they are the same on device side?
Contributor guide
Assessment
This issue has not been assessed yet.