File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -2523,8 +2523,8 @@ class __SYCL_SPECIAL_CLASS local_accessor_base :
2523
2523
// Method which calculates linear offset for the ID using Range and Offset.
2524
2524
template <int Dims = AdjustedDim> size_t getLinearIndex (id<Dims> Id) const {
2525
2525
size_t Result = 0 ;
2526
- for ( int I = 0 ; I < Dims; ++I)
2527
- Result = Result * getSize ()[I] + Id[I];
2526
+ detail::dim_loop< Dims>(
2527
+ [&, this ]( size_t I) { Result = Result * getSize ()[I] + Id[I]; }) ;
2528
2528
return Result;
2529
2529
}
2530
2530
Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx -fsycl-device-only -fno-sycl-early-optimizations -S -emit-llvm -D__SYCL_DISABLE_PARALLEL_FOR_RANGE_ROUNDING__ -o - %s | FileCheck %s
2
+ #include < sycl/sycl.hpp>
3
+
4
+ // Check that accessor index calculation is unrolled in headers.
5
+ // CHECK-NOT: llvm.loop
6
+ // CHECK-NOT: br i1
7
+ using namespace sycl ;
8
+ int main () {
9
+ queue Q;
10
+ range<3 > Range{8 , 8 , 8 };
11
+ buffer<int , 3 > Buf (Range);
12
+ Q.submit ([&](handler &Cgh) {
13
+ auto Acc = Buf.get_access <access::mode::write>(Cgh);
14
+ local_accessor<int , 3 > LocAcc (Range, Cgh);
15
+ Cgh.parallel_for (Range, [=](item<3 > It) { LocAcc[It] = Acc[It]; });
16
+ });
17
+ }
You can’t perform that action at this time.
0 commit comments