@@ -208,21 +208,28 @@ class HostKernel : public HostKernelBase {
208208
209209 sycl::range<Dims> Range (InitializedVal<Dims, range>::template get<0 >());
210210 sycl::id<Dims> Offset;
211+ sycl::range<Dims> Stride (
212+ InitializedVal<Dims, range>::template get<1 >()); // initialized to 1
213+ sycl::range<Dims> UpperBound (
214+ InitializedVal<Dims, range>::template get<0 >());
211215 for (int I = 0 ; I < Dims; ++I) {
212216 Range[I] = NDRDesc.GlobalSize [I];
213217 Offset[I] = NDRDesc.GlobalOffset [I];
218+ UpperBound[I] = Range[I] + Offset[I];
214219 }
215220
216- detail::NDLoop<Dims>::iterate(Range, [&](const sycl::id<Dims> &ID) {
217- sycl::item<Dims, /* Offset=*/ true > Item =
218- IDBuilder::createItem<Dims, true >(Range, ID, Offset);
219-
220- if (StoreLocation) {
221- store_id (&ID);
222- store_item (&Item);
223- }
224- MKernel (ID);
225- });
221+ detail::NDLoop<Dims>::iterate(/* LowerBound=*/ Offset, Stride, UpperBound,
222+ [&](const sycl::id<Dims> &ID) {
223+ sycl::item<Dims, /* Offset=*/ true > Item =
224+ IDBuilder::createItem<Dims, true >(
225+ Range, ID, Offset);
226+
227+ if (StoreLocation) {
228+ store_id (&ID);
229+ store_item (&Item);
230+ }
231+ MKernel (ID);
232+ });
226233 }
227234
228235 template <class ArgT = KernelArgType>
@@ -259,22 +266,28 @@ class HostKernel : public HostKernelBase {
259266
260267 sycl::range<Dims> Range (InitializedVal<Dims, range>::template get<0 >());
261268 sycl::id<Dims> Offset;
269+ sycl::range<Dims> Stride (
270+ InitializedVal<Dims, range>::template get<1 >()); // initialized to 1
271+ sycl::range<Dims> UpperBound (
272+ InitializedVal<Dims, range>::template get<0 >());
262273 for (int I = 0 ; I < Dims; ++I) {
263274 Range[I] = NDRDesc.GlobalSize [I];
264275 Offset[I] = NDRDesc.GlobalOffset [I];
276+ UpperBound[I] = Range[I] + Offset[I];
265277 }
266278
267- detail::NDLoop<Dims>::iterate(Range, [&](const sycl::id<Dims> &ID) {
268- sycl::id<Dims> OffsetID = ID + Offset;
269- sycl::item<Dims, /* Offset=*/ true > Item =
270- IDBuilder::createItem<Dims, true >(Range, OffsetID, Offset);
271-
272- if (StoreLocation) {
273- store_id (&OffsetID);
274- store_item (&Item);
275- }
276- MKernel (Item);
277- });
279+ detail::NDLoop<Dims>::iterate(/* LowerBound=*/ Offset, Stride, UpperBound,
280+ [&](const sycl::id<Dims> &ID) {
281+ sycl::item<Dims, /* Offset=*/ true > Item =
282+ IDBuilder::createItem<Dims, true >(
283+ Range, ID, Offset);
284+
285+ if (StoreLocation) {
286+ store_id (&ID);
287+ store_item (&Item);
288+ }
289+ MKernel (Item);
290+ });
278291 }
279292
280293 template <class ArgT = KernelArgType>
0 commit comments