From eb3962aa65c61c761091e9f44c7bf12c264f6082 Mon Sep 17 00:00:00 2001 From: Alexey Sachkov Date: Fri, 13 Jun 2025 15:10:38 +0200 Subject: [PATCH] [SYCL][NFC] Optimize dependencies of atomic_ref --- sycl/include/sycl/detail/spirv.hpp | 6 ++++- .../sycl/ext/oneapi/sub_group_mask.hpp | 26 ++++++------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/sycl/include/sycl/detail/spirv.hpp b/sycl/include/sycl/detail/spirv.hpp index 541668ed374d9..535bd3bd09f07 100644 --- a/sycl/include/sycl/detail/spirv.hpp +++ b/sycl/include/sycl/detail/spirv.hpp @@ -10,7 +10,11 @@ #ifdef __SYCL_DEVICE_ONLY__ -#include // for IdToMaskPosition +#include +#include +#include +#include +#include #if defined(__NVPTX__) #include diff --git a/sycl/include/sycl/ext/oneapi/sub_group_mask.hpp b/sycl/include/sycl/ext/oneapi/sub_group_mask.hpp index 63e56327168e8..e0915e2979cd8 100644 --- a/sycl/include/sycl/ext/oneapi/sub_group_mask.hpp +++ b/sycl/include/sycl/ext/oneapi/sub_group_mask.hpp @@ -9,11 +9,11 @@ #include // for Builder #include // detail::memcpy -#include // for errc, exception -#include // for SYCL_EXT_ONEAPI_SUB_GROUP_MASK -#include // for id -#include // for marray -#include // for vec +#include +#include // for SYCL_EXT_ONEAPI_SUB_GROUP_MASK +#include // for id +#include // for marray +#include // for vec #include // for assert #include // for CHAR_BIT @@ -342,8 +342,7 @@ template std::enable_if_t, sub_group> || std::is_same_v, sycl::sub_group>, sub_group_mask> -group_ballot(Group g, bool predicate) { - (void)g; +group_ballot([[maybe_unused]] Group g, [[maybe_unused]] bool predicate) { #ifdef __SYCL_DEVICE_ONLY__ auto res = __spirv_GroupNonUniformBallot( sycl::detail::spirv::group_scope::value, predicate); @@ -353,20 +352,11 @@ group_ballot(Group g, bool predicate) { return sycl::detail::Builder::createSubGroupMask( val, g.get_max_local_range()[0]); #else - (void)predicate; - throw exception{errc::feature_not_supported, - "Sub-group mask is not supported on host device"}; + // Groups are not user-constructible, this call should not be reachable from + // host and therefore we do nothing here. #endif } } // namespace ext::oneapi } // namespace _V1 } // namespace sycl - -// We have a cyclic dependency with -// sub_group_mask.hpp -// detail/spirv.hpp -// non_uniform_groups.hpp -// "Break" it by including this at the end (instead of beginning). Ideally, we -// should refactor this somehow... -#include