Skip to content

Commit eb3962a

Browse files
committed
[SYCL][NFC] Optimize dependencies of atomic_ref
1 parent 517761d commit eb3962a

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

sycl/include/sycl/detail/spirv.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
#ifdef __SYCL_DEVICE_ONLY__
1212

13-
#include <sycl/ext/oneapi/experimental/non_uniform_groups.hpp> // for IdToMaskPosition
13+
#include <sycl/__spirv/spirv_types.hpp>
14+
#include <sycl/access/access.hpp>
15+
#include <sycl/id.hpp>
16+
#include <sycl/multi_ptr.hpp>
17+
#include <sycl/detail/generic_type_traits.hpp>
1418

1519
#if defined(__NVPTX__)
1620
#include <sycl/ext/oneapi/experimental/cuda/masked_shuffles.hpp>

sycl/include/sycl/ext/oneapi/sub_group_mask.hpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
#include <sycl/detail/helpers.hpp> // for Builder
1111
#include <sycl/detail/memcpy.hpp> // detail::memcpy
12-
#include <sycl/exception.hpp> // for errc, exception
13-
#include <sycl/feature_test.hpp> // for SYCL_EXT_ONEAPI_SUB_GROUP_MASK
14-
#include <sycl/id.hpp> // for id
15-
#include <sycl/marray.hpp> // for marray
16-
#include <sycl/vector.hpp> // for vec
12+
#include <sycl/detail/spirv.hpp>
13+
#include <sycl/feature_test.hpp> // for SYCL_EXT_ONEAPI_SUB_GROUP_MASK
14+
#include <sycl/id.hpp> // for id
15+
#include <sycl/marray.hpp> // for marray
16+
#include <sycl/vector.hpp> // for vec
1717

1818
#include <assert.h> // for assert
1919
#include <climits> // for CHAR_BIT
@@ -342,8 +342,7 @@ template <typename Group>
342342
std::enable_if_t<std::is_same_v<std::decay_t<Group>, sub_group> ||
343343
std::is_same_v<std::decay_t<Group>, sycl::sub_group>,
344344
sub_group_mask>
345-
group_ballot(Group g, bool predicate) {
346-
(void)g;
345+
group_ballot([[maybe_unused]] Group g, [[maybe_unused]] bool predicate) {
347346
#ifdef __SYCL_DEVICE_ONLY__
348347
auto res = __spirv_GroupNonUniformBallot(
349348
sycl::detail::spirv::group_scope<Group>::value, predicate);
@@ -353,20 +352,11 @@ group_ballot(Group g, bool predicate) {
353352
return sycl::detail::Builder::createSubGroupMask<sub_group_mask>(
354353
val, g.get_max_local_range()[0]);
355354
#else
356-
(void)predicate;
357-
throw exception{errc::feature_not_supported,
358-
"Sub-group mask is not supported on host device"};
355+
// Groups are not user-constructible, this call should not be reachable from
356+
// host and therefore we do nothing here.
359357
#endif
360358
}
361359

362360
} // namespace ext::oneapi
363361
} // namespace _V1
364362
} // namespace sycl
365-
366-
// We have a cyclic dependency with
367-
// sub_group_mask.hpp
368-
// detail/spirv.hpp
369-
// non_uniform_groups.hpp
370-
// "Break" it by including this at the end (instead of beginning). Ideally, we
371-
// should refactor this somehow...
372-
#include <sycl/detail/spirv.hpp>

0 commit comments

Comments
 (0)