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

Compatibility: Only use sycl::half if SYCL_CTS_ENABLE_HALF_TESTS is set #872

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fknorr
Copy link
Contributor

@fknorr fknorr commented Feb 17, 2024

This PR improves compatibility with implementations that do not expose the sycl::half type (notably, SimSYCL built with GCC).

There might be additional usages I missed, in tests that SimSYCL is currently unable to compile for other reasons.

Question to the reviewers: Is it necessary to exclude some translation units in CMake when the file names are *fp16.cpp or are these handled automatically?

} else if (std::is_same_v<std::remove_cv_t<CTS_TYPE>, double>) {
}
#endif
if (std::is_same_v<std::remove_cv_t<CTS_TYPE>, double>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (std::is_same_v<std::remove_cv_t<CTS_TYPE>, double>) {
if constexpr (std::is_same_v<std::remove_cv_t<CTS_TYPE>, double>) {

sycl::half bitselect(sycl::half a, sycl::half b, sycl::half c);
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should re-group these declarations to

// float type overloads for all math functions.
...

#if SYCL_CTS_ENABLE_DOUBLE_TESTS
// double type overloads for all math functions.
...
#endif

#if SYCL_CTS_ENABLE_HALF_TESTS
// half type overloads for all math functions.
...
#endif

@@ -51,8 +51,12 @@ using has_atomic_support = contains<T, int, unsigned int, long, unsigned long,
*/
template <typename T>
using is_sycl_floating_point =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using is_sycl_floating_point =
using is_sycl_scalar_floating_point =

@AlexeySachkov
Copy link
Contributor

Question to the reviewers: Is it necessary to exclude some translation units in CMake when the file names are *fp16.cpp or are these handled automatically?

From what I see, they are filtered out automatically:

if(NOT SYCL_CTS_ENABLE_HALF_TESTS)
list(FILTER test_cases_list EXCLUDE REGEX .*_fp16\\.cpp$)
endif()

@keryell
Copy link
Member

keryell commented Feb 22, 2024

g++-13 implements already https://en.cppreference.com/w/cpp/types/floating-point from C++23. @fknorr Go for it! :-)

@keryell
Copy link
Member

keryell commented Jun 13, 2024

@fknorr Some merge from upstream?

@fknorr
Copy link
Contributor Author

fknorr commented Jun 13, 2024

I was not aware of the _Float16 support in newer GCC - this PR might not be required anymore for SimSYCL, I can check after merging #870 .

@keryell
Copy link
Member

keryell commented Sep 25, 2024

@fknorr #870 has been merged and Ubuntu 24.04 comes with g++-14.
The more we wait, the more the features. 😸

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

Successfully merging this pull request may close these issues.

4 participants