[PATCH] D141852: [amdgpu] Change LDS lowering default to hybrid
Jon Chesterfield via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 09:01:37 PST 2023
JonChesterfield updated this revision to Diff 499532.
JonChesterfield added a comment.
- Change to hybrid. Reintroduces code block deleted by git misfire
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141852/new/
https://reviews.llvm.org/D141852
Files:
llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
Index: llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
@@ -162,7 +162,7 @@
cl::opt<LoweringKind> LoweringKindLoc(
"amdgpu-lower-module-lds-strategy",
cl::desc("Specify lowering strategy for function LDS access:"), cl::Hidden,
- cl::init(LoweringKind::module),
+ cl::init(LoweringKind::hybrid),
cl::values(
clEnumValN(LoweringKind::table, "table", "Lower via table lookup"),
clEnumValN(LoweringKind::module, "module", "Lower via module struct"),
Index: llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
@@ -1305,6 +1305,18 @@
GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Op);
const GlobalValue *GV = G->getGlobal();
+ if (G->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS) {
+ if (!MFI->isModuleEntryFunction()) {
+ if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV)) {
+ if (AMDGPUMachineFunction::isKnownAddressLDSGlobal(*GVar)) {
+ unsigned Offset =
+ AMDGPUMachineFunction::calculateKnownAddressOfLDSGlobal(*GVar);
+ return DAG.getConstant(Offset, SDLoc(Op), Op.getValueType());
+ }
+ }
+ }
+ }
+
if (G->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS ||
G->getAddressSpace() == AMDGPUAS::REGION_ADDRESS) {
if (!MFI->isModuleEntryFunction() &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141852.499532.patch
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230222/f88372ba/attachment.bin>
More information about the llvm-commits
mailing list