Skip to content

Commit d7b078f

Browse files
iwwuigcbot
authored andcommitted
Extend morton walk order to loads
IGC marks a shader as "HasSample" to use Morton walk order for the increased sampler cache hit rates. Currently, only sampler messages and gather4 are supported. This PR expands to include loads with ldmcsptr, ldmsptr, ldmsptr16bit. For now, OCL support will stay as it is.
1 parent 55ae2fa commit d7b078f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8820,6 +8820,7 @@ void EmitPass::emitLdmsInstruction(llvm::Instruction* inst)
88208820
{
88218821
uint numOperands = inst->getNumOperands();
88228822
EOPCODE opCode = GetOpCode(inst);
8823+
m_currShader->m_State.SetHasLoadInst();
88238824
//Subtract the offsets, and texture resource, lod to get
88248825
//the number of texture coordinates and index to texture source
88258826
uint numSources = numOperands - 5;

IGC/Compiler/CISACodeGen/GenericShaderState.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ namespace IGC
5050
void SetBarrierNumber(int BarrierNumber) { m_BarrierNumber = BarrierNumber; }
5151
int GetBarrierNumber() const { return m_BarrierNumber; }
5252

53-
bool GetHasSample() const { return m_HasSample; }
54-
void SetHasSampleInst() { m_HasSampleInst = true; m_HasSample = true; }
55-
void SetHasGather4Inst() { m_HasGather4Inst = true; m_HasSample = true; }
53+
bool GetHasSampleGather4Load() const { return (m_HasSampleInst || m_HasGather4Inst || m_HasLoadInst); }
54+
bool GetHasSampleGather4() const { return (m_HasSampleInst || m_HasGather4Inst); }
55+
void SetHasSampleInst() { m_HasSampleInst = true; }
56+
void SetHasGather4Inst() { m_HasGather4Inst = true; }
57+
void SetHasLoadInst() { m_HasLoadInst = true; }
5658

5759
bool GetHasDPAS() const { return m_HasDPAS; }
5860
void SetHasDPAS() { m_HasDPAS = true; }
@@ -115,9 +117,9 @@ namespace IGC
115117
(NumInst < IGC_GET_FLAG_VALUE(MidThreadPreemptionDisableThreshold)));
116118
}
117119
private:
118-
bool m_HasSample = false;
119120
bool m_HasSampleInst = false;
120121
bool m_HasGather4Inst = false;
122+
bool m_HasLoadInst = false;
121123
int m_BarrierNumber = 0;
122124
bool m_HasDPAS = false;
123125
// Shader has LSC store messages with non-default L1 cache control

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2873,7 +2873,7 @@ namespace IGC
28732873

28742874
// TODO: need to change misleading HasBarriers to NumberofBarriers
28752875
m_kernelInfo.m_executionEnvironment.HasBarriers = m_State.GetBarrierNumber();
2876-
m_kernelInfo.m_executionEnvironment.HasSample = m_State.GetHasSample();
2876+
m_kernelInfo.m_executionEnvironment.HasSample = m_State.GetHasSampleGather4();
28772877
m_kernelInfo.m_executionEnvironment.DisableMidThreadPreemption = GetDisableMidThreadPreemption();
28782878
m_kernelInfo.m_executionEnvironment.SubgroupIndependentForwardProgressRequired =
28792879
m_Context->getModuleMetaData()->compOpt.SubgroupIndependentForwardProgressRequired;

0 commit comments

Comments
 (0)