Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2cc912b

Browse files
authoredApr 8, 2025··
[SYCL][Graphs] Fix issue with compile time local memory test (#17892)
With the current way that the local_memory extension is implemented, accessing the local memory requires the use of parenthesis to avoid using the [] operator from the multi-ptr.
1 parent 2db918d commit 2cc912b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed
 

‎sycl/test-e2e/Graph/Inputs/compile_time_local_memory.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ int main() {
2323
auto NodeA = add_node(Graph, Queue, [&](handler &CGH) {
2424
CGH.parallel_for(nd_range({Size}, {LocalSize}), [=](nd_item<1> Item) {
2525
multi_ptr<size_t[LocalSize], access::address_space::local_space>
26-
LocalMem = sycl::ext::oneapi::group_local_memory<size_t[LocalSize]>(
27-
Item.get_group());
28-
*LocalMem[Item.get_local_linear_id()] = Item.get_global_linear_id() * 2;
26+
LocalMemPtr =
27+
sycl::ext::oneapi::group_local_memory<size_t[LocalSize]>(
28+
Item.get_group());
29+
(*LocalMemPtr)[Item.get_local_linear_id()] =
30+
Item.get_global_linear_id() * 2;
2931
PtrA[Item.get_global_linear_id()] +=
30-
*LocalMem[Item.get_local_linear_id()];
32+
(*LocalMemPtr)[Item.get_local_linear_id()];
3133
});
3234
});
3335

@@ -37,12 +39,12 @@ int main() {
3739
depends_on_helper(CGH, NodeA);
3840
CGH.parallel_for(nd_range({Size}, {LocalSize}), [=](nd_item<1> Item) {
3941
multi_ptr<size_t[LocalSize], access::address_space::local_space>
40-
LocalMem = sycl::ext::oneapi::group_local_memory_for_overwrite<
42+
LocalMemPtr = sycl::ext::oneapi::group_local_memory_for_overwrite<
4143
size_t[LocalSize]>(Item.get_group());
42-
*LocalMem[Item.get_local_linear_id()] =
44+
(*LocalMemPtr)[Item.get_local_linear_id()] =
4345
Item.get_global_linear_id() + 4;
4446
PtrA[Item.get_global_linear_id()] *=
45-
*LocalMem[Item.get_local_linear_id()];
47+
(*LocalMemPtr)[Item.get_local_linear_id()];
4648
});
4749
},
4850
NodeA);

0 commit comments

Comments
 (0)
Please sign in to comment.