Skip to content

fix work_group_scrach_memory #16325

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
Dec 11, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ static bool dynamicWGLocalMemory(Module &M) {
GlobalVariable::NotThreadLocal, // ThreadLocalMode
LocalAS // AddressSpace
);
LocalMemArrayGV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Local);
constexpr int DefaultMaxAlignment = 128;
if (!TT.isSPIROrSPIRV())
LocalMemArrayGV->setAlignment(Align{DefaultMaxAlignment});
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/SYCLLowerIR/work_group_static.ll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
target triple = "spir64-unknown-unknown"

; CHECK: @__sycl_dynamicLocalMemoryPlaceholder_GV = linkonce_odr addrspace(3) global ptr addrspace(3) undef
; CHECK: @__sycl_dynamicLocalMemoryPlaceholder_GV = linkonce_odr local_unnamed_addr addrspace(3) global ptr addrspace(3) undef

; Function Attrs: convergent norecurse
; CHECK: @_ZTS7KernelA(ptr addrspace(1) %0, ptr addrspace(3) noalias "sycl-implicit-local-arg" %[[IMPLICT_ARG:[a-zA-Z0-9]+]]{{.*}} !kernel_arg_addr_space ![[ADDR_SPACE_MD:[0-9]+]]
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/SYCLLowerIR/work_group_static_nv.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

target triple = "nvptx64-nvidia-cuda"

; CHECK: @__sycl_dynamicLocalMemoryPlaceholder_GV = external addrspace(3) global [0 x i8], align 128
; CHECK: @__sycl_dynamicLocalMemoryPlaceholder_GV = external local_unnamed_addr addrspace(3) global [0 x i8], align 128

; Function Attrs: convergent norecurse
; CHECK: @_ZTS7KernelA(ptr addrspace(1) %0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %{run} %t.out
//

// UNSUPPORTED: gpu-intel-gen12, cpu
// UNSUPPORTED: gpu-intel-gen12
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/16072

// Test work_group_dynamic extension with allocation size specified at runtime
Expand Down Expand Up @@ -35,8 +35,8 @@ int main() {
sycl_ext::properties properties{static_size};
auto LocalAccessor =
sycl::local_accessor<int>(WgSize * RepeatWG * sizeof(int), Cgh);
Cgh.parallel_for(nd_range<1>(range<1>(Size), range<1>(WgSize)), properties,
[=](nd_item<1> Item) {
Cgh.parallel_for(nd_range<1>(range<1>(WgSize * WgCount), range<1>(WgSize)),
properties, [=](nd_item<1> Item) {
int *Ptr = reinterpret_cast<int *>(
sycl_ext::get_work_group_scratch_memory());
size_t GroupOffset =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %{run} %t.out
//

// UNSUPPORTED: gpu-intel-gen12, cpu
// UNSUPPORTED: gpu-intel-gen12
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/16072

// Test work_group_dynamic extension with allocation size specified at runtime
Expand Down Expand Up @@ -33,8 +33,8 @@ int main() {
sycl_ext::work_group_scratch_size static_size(WgSize * RepeatWG *
sizeof(int));
sycl_ext::properties properties{static_size};
Cgh.parallel_for(nd_range<1>(range<1>(Size), range<1>(WgSize)), properties,
[=](nd_item<1> Item) {
Cgh.parallel_for(nd_range<1>(range<1>(WgSize * WgCount), range<1>(WgSize)),
properties, [=](nd_item<1> Item) {
int *Ptr = reinterpret_cast<int *>(
sycl_ext::get_work_group_scratch_memory());
size_t GroupOffset =
Expand Down
6 changes: 3 additions & 3 deletions sycl/test-e2e/WorkGroupScratchMemory/dynamic_allocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %{run} %t.out
//

// UNSUPPORTED: gpu-intel-gen12, cpu
// UNSUPPORTED: gpu-intel-gen12
// UNSUPPORTED-TRACKER: https://github.com/intel/llvm/issues/16072

// Test work_group_dynamic extension with allocation size specified at runtime.
Expand Down Expand Up @@ -32,8 +32,8 @@ int main() {
sycl_ext::work_group_scratch_size static_size(WgSize * RepeatWG *
sizeof(int));
sycl_ext::properties properties{static_size};
Cgh.parallel_for(nd_range<1>(range<1>(Size), range<1>(WgSize)), properties,
[=](nd_item<1> Item) {
Cgh.parallel_for(nd_range<1>(range<1>(WgSize * WgCount), range<1>(WgSize)),
properties, [=](nd_item<1> Item) {
int *Ptr = reinterpret_cast<int *>(
sycl_ext::get_work_group_scratch_memory());
size_t GroupOffset =
Expand Down
Loading