Skip to content

[NFC][SYCL] Replace #pragma unroll with dim_loop in accessor.hpp #6939

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

Merged
merged 2 commits into from
Oct 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions sycl/include/sycl/accessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,7 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
void __init(ConcreteASPtrType Ptr, range<AdjustedDim> AccessRange,
range<AdjustedDim> MemRange, id<AdjustedDim> Offset) {
MData = Ptr;
#pragma unroll
for (int I = 0; I < AdjustedDim; ++I) {
detail::dim_loop<AdjustedDim>([&, this](size_t I) {
#if __cplusplus >= 201703L
if constexpr (!(PropertyListT::template has_property<
sycl::ext::oneapi::property::no_offset>())) {
Expand All @@ -1094,7 +1093,7 @@ class __SYCL_SPECIAL_CLASS __SYCL_TYPE(accessor) accessor :
#endif
getAccessRange()[I] = AccessRange[I];
getMemoryRange()[I] = MemRange[I];
}
});

// Adjust for offsets as that part is invariant for all invocations of
// operator[]. Will have to re-adjust in get_pointer.
Expand Down Expand Up @@ -2362,9 +2361,8 @@ class __SYCL_SPECIAL_CLASS local_accessor_base :
void __init(ConcreteASPtrType Ptr, range<AdjustedDim> AccessRange,
range<AdjustedDim>, id<AdjustedDim>) {
MData = Ptr;
#pragma unroll
for (int I = 0; I < AdjustedDim; ++I)
getSize()[I] = AccessRange[I];
detail::dim_loop<AdjustedDim>(
[&, this](size_t I) { getSize()[I] = AccessRange[I]; });
}

public:
Expand Down