[PATCH] D15736: AMDGPU/SI: Select non-uniform constant addrspace loads to flat instructions for HSA

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 14:11:42 PST 2015

tstellarAMD added inline comments.

Comment at: lib/Target/AMDGPU/AMDGPUInstructions.td:391
@@ -390,3 +388,1 @@
 def flat_store : PatFrag<(ops node:$val, node:$ptr),
cfang wrote:
> I think this def should be untouched because it is used to FLAT for real flat address.
I didn't remove this, I just moved it into SIInstrInfo.td.  It's a GCN specific definition, so I think that is a better place for it.

Comment at: lib/Target/AMDGPU/CIInstructions.td:259-262
@@ -258,5 +258,6 @@
 def : FlatLoadPat <FLAT_LOAD_UBYTE, az_extloadi8_global, i32>;
 def : FlatLoadPat <FLAT_LOAD_SBYTE, sextloadi8_global, i32>;
 def : FlatLoadPat <FLAT_LOAD_USHORT, az_extloadi16_global, i32>;
 def : FlatLoadPat <FLAT_LOAD_SSHORT, sextloadi16_global, i32>;
+def : FlatLoadPat <FLAT_LOAD_DWORD, flat_load, i32>;
arsenm wrote:
> Do constant extloads need to be handled also?

Comment at: lib/Target/AMDGPU/CIInstructions.td:265
@@ -266,1 +264,3 @@
+def : FlatLoadPat <FLAT_LOAD_DWORDX2, flat_load, v2i32>;
+def : FlatLoadPat <FLAT_LOAD_DWORDX4, flat_load, v4i32>;
cfang wrote:
> Do you think we should use "mubuf_load" here? With FlatForGlobal ON, we actually disabled SelectMUBUF. As a result, we should select FLAT for mubuf here.
flat_load matches an additional address space "FlatAddress".

Comment at: lib/Target/AMDGPU/SIInstrInfo.td:149
@@ +148,3 @@
+         isFlatLoad(dyn_cast<LoadSDNode>(N));
cfang wrote:
> This def here is a little confusion because it may have side effect for the general case where FlatForGlobal is OFF.
I'm not sure what you mean here.


More information about the llvm-commits mailing list