Skip to content

Commit 29edb5e

Browse files
Revert "Revert "[NFC][SYCL] Replace #pragma unroll with dim_loop in accessor.hpp (#6939)""
This reverts commit 98f50ae.
1 parent 218bd17 commit 29edb5e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

sycl/include/sycl/accessor.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,7 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
10841084
void __init(ConcreteASPtrType Ptr, range<AdjustedDim> AccessRange,
10851085
range<AdjustedDim> MemRange, id<AdjustedDim> Offset) {
10861086
MData = Ptr;
1087-
#pragma unroll
1088-
for (int I = 0; I < AdjustedDim; ++I) {
1087+
detail::dim_loop<AdjustedDim>([&, this](size_t I) {
10891088
#if __cplusplus >= 201703L
10901089
if constexpr (!(PropertyListT::template has_property<
10911090
sycl::ext::oneapi::property::no_offset>())) {
@@ -1096,7 +1095,7 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
10961095
#endif
10971096
getAccessRange()[I] = AccessRange[I];
10981097
getMemoryRange()[I] = MemRange[I];
1099-
}
1098+
});
11001099

11011100
// Adjust for offsets as that part is invariant for all invocations of
11021101
// operator[]. Will have to re-adjust in get_pointer.
@@ -2415,9 +2414,8 @@ class __SYCL_SPECIAL_CLASS local_accessor_base :
24152414
void __init(ConcreteASPtrType Ptr, range<AdjustedDim> AccessRange,
24162415
range<AdjustedDim>, id<AdjustedDim>) {
24172416
MData = Ptr;
2418-
#pragma unroll
2419-
for (int I = 0; I < AdjustedDim; ++I)
2420-
getSize()[I] = AccessRange[I];
2417+
detail::dim_loop<AdjustedDim>(
2418+
[&, this](size_t I) { getSize()[I] = AccessRange[I]; });
24212419
}
24222420

24232421
public:

0 commit comments

Comments
 (0)