Skip to content

Commit eda6ff7

Browse files
scottp101igcbot
authored andcommitted
move compute shader state processing
move compute shader state processing
1 parent f547b4a commit eda6ff7

File tree

14 files changed

+168
-163
lines changed

14 files changed

+168
-163
lines changed

IGC/AdaptorOCL/OCL/sp/spp_g8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ void dumpOCLCos(const IGC::COpenCLKernel *Kernel, const std::string &stateDebugM
374374
dumpName = dumpName.PostFix(kernelName);
375375

376376
dumpName = dumpName.DispatchMode(Kernel->m_ShaderDispatchMode);
377-
dumpName = dumpName.SIMDSize(Kernel->m_dispatchSize).Retry(context->m_retryManager.GetRetryId()).Extension("cos");
377+
dumpName = dumpName.SIMDSize(Kernel->m_State.m_dispatchSize).Retry(context->m_retryManager.GetRetryId()).Extension("cos");
378378

379379
auto dump = IGC::Debug::Dump(dumpName, IGC::Debug::DumpType::COS_TEXT);
380380

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 56 additions & 56 deletions
Large diffs are not rendered by default.

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ CShader::CShader(Function *pFunc, CShaderProgram *pProgram, GenericShaderState &
3535
, entry(pFunc)
3636
, m_parent(pProgram)
3737
, encoder()
38-
, m_BarrierNumber(0)
3938
{
4039
m_ctx = m_parent->GetContext();
4140
m_WI = nullptr;
@@ -53,7 +52,6 @@ CShader::CShader(Function *pFunc, CShaderProgram *pProgram, GenericShaderState &
5352
// set this to ture if there is any stateless access.
5453
m_HasGlobalStatelessMemoryAccess = false;
5554
m_HasConstantStatelessMemoryAccess = false;
56-
m_HasDPAS = false;
5755

5856
m_SavedSRetPtr = nullptr;
5957
m_FP = nullptr;
@@ -110,7 +108,7 @@ void CShader::InitEncoder(SIMDMode simdSize, bool canAbortOnSpill, ShaderDispatc
110108
m_SIMDSize = simdSize;
111109
m_numberInstance = 1;
112110
}
113-
m_dispatchSize = simdSize;
111+
m_State.m_dispatchSize = simdSize;
114112
globalSymbolMapping.clear();
115113
symbolMapping.clear();
116114
ccTupleMapping.clear();
@@ -138,7 +136,7 @@ void CShader::PreAnalysisPass()
138136
const uint32_t GRFSize = getGRFSize();
139137
IGC_ASSERT(0 < GRFSize);
140138

141-
m_ScratchSpaceSize = funcMDItr->second.privateMemoryPerWI * numLanes(m_dispatchSize);
139+
m_ScratchSpaceSize = funcMDItr->second.privateMemoryPerWI * numLanes(m_State.m_dispatchSize);
142140
m_ScratchSpaceSize = std::max(m_ScratchSpaceSize, m_ctx->getIntelScratchSpacePrivateMemoryMinimalSizePerThread());
143141

144142
// Round up to GRF-byte aligned.
@@ -1141,7 +1139,7 @@ CVariable* CShader::ImmToVariable(uint64_t immediate, VISA_Type type, bool isCod
11411139
// src-variable is no longer a boolean, V-ISA cannot take boolean-src immed.
11421140

11431141
CVariable* dst = GetNewVariable(
1144-
numLanes(m_dispatchSize), ISA_TYPE_BOOL, EALIGN_BYTE, CName::NONE);
1142+
numLanes(m_State.m_dispatchSize), ISA_TYPE_BOOL, EALIGN_BYTE, CName::NONE);
11451143
// FIXME: We need to pop/push the encoder context
11461144
//encoder.save();
11471145
if (isCodePatchCandidate)
@@ -1550,7 +1548,7 @@ void CShader::GetSimdOffsetBase(CVariable*& pVar, bool dup)
15501548
encoder.Cast(pVar, ImmToVariable(0x76543210, ISA_TYPE_V));
15511549
encoder.Push();
15521550

1553-
if (m_dispatchSize >= SIMDMode::SIMD16)
1551+
if (m_State.m_dispatchSize >= SIMDMode::SIMD16)
15541552
{
15551553
encoder.SetSimdSize(SIMDMode::SIMD8);
15561554
encoder.SetDstSubReg(8);
@@ -3043,7 +3041,7 @@ unsigned int CShader::EvaluateSIMDConstExpr(Value* C)
30433041
{
30443042
if (genInst->getIntrinsicID() == GenISAIntrinsic::GenISA_simdSize)
30453043
{
3046-
return numLanes(m_dispatchSize);
3044+
return numLanes(m_State.m_dispatchSize);
30473045

30483046
}
30493047
}

IGC/Compiler/CISACodeGen/ComputeShaderBase.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ using namespace llvm;
2323

2424
namespace IGC
2525
{
26-
CComputeShaderBase::CComputeShaderBase(llvm::Function *pFunc,
27-
CShaderProgram *pProgram)
28-
: m_State(*pFunc, *pProgram->GetContext()),
29-
CShader(pFunc, pProgram, m_State) {}
26+
CComputeShaderBase::CComputeShaderBase(Function* pFunc,
27+
CShaderProgram* pProgram,
28+
GenericShaderState& GState)
29+
: CShader(pFunc, pProgram, GState) {}
3030

3131
CComputeShaderBase::~CComputeShaderBase() {}
3232

IGC/Compiler/CISACodeGen/ComputeShaderBase.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ namespace IGC
1919
class CComputeShaderBase : public CShader
2020
{
2121
public:
22-
CComputeShaderBase(llvm::Function* pFunc, CShaderProgram* pProgram);
22+
CComputeShaderBase(
23+
llvm::Function* pFunc, CShaderProgram* pProgram, GenericShaderState& GState);
2324
virtual ~CComputeShaderBase();
24-
25-
GenericShaderState m_State;
2625
protected:
2726
// Determines if HW can handle auto generating local IDs with this
2827
// order

IGC/Compiler/CISACodeGen/DebugInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ void DebugInfoData::markVariableAsOutput(CShader *pShader, CVariable *pVariable)
388388

389389
// Mark variable with "Output", to extend it's living time will be extended to the end of the function.
390390
pShader->GetEncoder().GetVISAKernel()->AddAttributeToVar(pVariable->visaGenVariable[0], "Output", 0, nullptr);
391-
if (pShader->m_dispatchSize == SIMDMode::SIMD32 && pVariable->visaGenVariable[1])
391+
if (pShader->m_State.m_dispatchSize == SIMDMode::SIMD32 && pVariable->visaGenVariable[1])
392392
{
393393
pShader->GetEncoder().GetVISAKernel()->AddAttributeToVar(pVariable->visaGenVariable[1], "Output", 0, nullptr);
394394
}
@@ -459,7 +459,7 @@ void DebugInfoData::transferMappings(const llvm::Function& F)
459459
{
460460
unsigned int lower16Channels = (unsigned int)m_pShader->GetEncoder().GetVISAKernel()->getDeclarationID(CVar->visaGenVariable[0]);
461461
unsigned int higher16Channels = 0;
462-
if (numLanes(m_pShader->m_dispatchSize) == 32 && !CVar->IsUniform() && CVar->visaGenVariable[1])
462+
if (numLanes(m_pShader->m_State.m_dispatchSize) == 32 && !CVar->IsUniform() && CVar->visaGenVariable[1])
463463
higher16Channels = m_pShader->GetEncoder().GetVISAKernel()->getDeclarationID(CVar->visaGenVariable[1]);
464464
CVarToVISADclId[CVar] = std::make_pair(lower16Channels, higher16Channels);
465465
}

0 commit comments

Comments
 (0)