[llvm] [AMDGPU] Enable amdgpu-sw-lower-lds pass to lower LDS accesses to use device global memory (PR #87265)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 08:28:14 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 28b196e7fc4919a062ed20177d113cd0ae9b1f75 507c20a7fda09785bdc84fecf2062cccdb13308a -- llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp llvm/lib/Target/AMDGPU/AMDGPU.h llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.cpp llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
index 6de02b178a..d7c092a603 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
@@ -275,22 +275,22 @@ void AMDGPUSwLowerLDS::populateMallocMetadataGlobal(Function *Func) {
StructType *LDSItemTy =
StructType::create(Ctx, {Int32Ty, Int32Ty}, MDItemOS.str());
- auto buildInitializerForMallocMDGlobal = [&](SetVector<GlobalVariable *>
- &LDSGlobals) {
- for (auto &GV : LDSGlobals) {
- Type *Ty = GV->getValueType();
- const uint64_t SizeInBytes = DL.getTypeAllocSize(Ty);
- Items.push_back(LDSItemTy);
- Constant *ItemStartOffset =
- ConstantInt::get(Int32Ty, LDSParams.MallocSize);
- Constant *SizeInBytesConst = ConstantInt::get(Int32Ty, SizeInBytes);
- uint64_t AlignedSize = alignTo(SizeInBytes, MaxAlignment);
- LDSParams.MallocSize += AlignedSize;
- Constant *InitItem =
- ConstantStruct::get(LDSItemTy, {ItemStartOffset, SizeInBytesConst});
- Initializers.push_back(InitItem);
- }
- };
+ auto buildInitializerForMallocMDGlobal =
+ [&](SetVector<GlobalVariable *> &LDSGlobals) {
+ for (auto &GV : LDSGlobals) {
+ Type *Ty = GV->getValueType();
+ const uint64_t SizeInBytes = DL.getTypeAllocSize(Ty);
+ Items.push_back(LDSItemTy);
+ Constant *ItemStartOffset =
+ ConstantInt::get(Int32Ty, LDSParams.MallocSize);
+ Constant *SizeInBytesConst = ConstantInt::get(Int32Ty, SizeInBytes);
+ uint64_t AlignedSize = alignTo(SizeInBytes, MaxAlignment);
+ LDSParams.MallocSize += AlignedSize;
+ Constant *InitItem = ConstantStruct::get(
+ LDSItemTy, {ItemStartOffset, SizeInBytesConst});
+ Initializers.push_back(InitItem);
+ }
+ };
buildInitializerForMallocMDGlobal(LDSParams.DirectAccess.StaticLDSGlobals);
buildInitializerForMallocMDGlobal(LDSParams.IndirectAccess.StaticLDSGlobals);
``````````
</details>
https://github.com/llvm/llvm-project/pull/87265
More information about the llvm-commits
mailing list