[Openmp-commits] [openmp] [openmp][amdgpu] Add DynamicLdsSize to AMDGPUImplicitArgsTy (PR #65325)

via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 4 05:39:22 PST 2024


https://github.com/skc7 updated https://github.com/llvm/llvm-project/pull/65325

>From 479ea685d01b343c76d3efe50f74a5bed7330afc Mon Sep 17 00:00:00 2001
From: skc7 <Krishna.Sankisa at amd.com>
Date: Tue, 5 Sep 2023 14:46:05 +0530
Subject: [PATCH] [openmp][amdgpu] Add DynamicLdsSize to
 AMDGPUImplicitArgsTy(#65325)

Add DynamicLdsSize to AMDGPUImplicitArgsTy struct at offset 120 and fill
the dynamic LDS size before kernel launch.
---
 openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp        | 1 +
 .../libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index 0411c670133422..18076f8082d0f6 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -3203,6 +3203,7 @@ Error AMDGPUKernelTy::launchImpl(GenericDeviceTy &GenericDevice,
     ImplArgs->GroupSizeY = 1;
     ImplArgs->GroupSizeZ = 1;
     ImplArgs->GridDims = 1;
+    ImplArgs->DynamicLdsSize = KernelArgs.DynCGroupMem;
   }
 
   // Push the kernel launch into the stream.
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
index 2471590c27b376..58a3b5df00fac6 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
@@ -45,7 +45,9 @@ struct AMDGPUImplicitArgsTy {
   uint16_t GroupSizeZ;
   uint8_t Unused0[46]; // 46 byte offset.
   uint16_t GridDims;
-  uint8_t Unused1[190]; // 190 byte offset.
+  uint8_t Unused1[54]; // 54 byte offset.
+  uint32_t DynamicLdsSize;
+  uint8_t Unused2[132]; // 132 byte offset.
 };
 
 // Dummy struct for COV4 implicitargs.



More information about the Openmp-commits mailing list