Skip to content

Commit

Permalink
Add upperBoundGRF
Browse files Browse the repository at this point in the history
Pass the value to vISA_MaxGRFNum
  • Loading branch information
iwwu authored and igcbot committed Feb 26, 2025
1 parent c7a0598 commit 2768d02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion IGC/Compiler/CISACodeGen/CISABuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5556,7 +5556,8 @@ namespace IGC
}
}

void CEncoder::InitEncoder(bool canAbortOnSpill, bool hasStackCall, bool hasInlineAsmCall, bool hasAdditionalVisaAsmToLink, int numThreadsPerEU, uint lowerBoundGRF, VISAKernel* prevKernel)
void CEncoder::InitEncoder(bool canAbortOnSpill, bool hasStackCall, bool hasInlineAsmCall, bool hasAdditionalVisaAsmToLink, int numThreadsPerEU,
uint lowerBoundGRF, uint upperBoundGRF, VISAKernel* prevKernel)
{
m_aliasesMap.clear();
m_encoderState.m_SubSpanDestination = false;
Expand Down Expand Up @@ -5626,6 +5627,11 @@ namespace IGC
SaveOption(vISA_MinGRFNum, lowerBoundGRF);
}

if (upperBoundGRF > 0)
{
SaveOption(vISA_MaxGRFNum, upperBoundGRF);
}

// Pass all build options to builder
SetBuilderOptions(vbuilder);

Expand Down
3 changes: 2 additions & 1 deletion IGC/Compiler/CISACodeGen/CISABuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ namespace IGC
class CEncoder
{
public:
void InitEncoder(bool canAbortOnSpill, bool hasStackCall, bool hasInlineAsmCall, bool hasAdditionalVisaAsmToLink, int numThreadsPerEU, uint lowerBoundGRF, VISAKernel* prevKernel);
void InitEncoder(bool canAbortOnSpill, bool hasStackCall, bool hasInlineAsmCall, bool hasAdditionalVisaAsmToLink, int numThreadsPerEU,
uint lowerBoundGRF, uint upperBoundGRF, VISAKernel* prevKernel);
void InitBuildParams(llvm::SmallVector<std::unique_ptr< char, std::function<void(char*)>>, 10> & params);
void InitVISABuilderOptions(TARGET_PLATFORM VISAPlatform, bool canAbortOnSpill, bool hasStackCall, bool enableVISA_IR);
SEncoderState CopyEncoderState();
Expand Down
3 changes: 2 additions & 1 deletion IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ bool EmitPass::runOnFunction(llvm::Function& F)
}

uint lowerBoundGRF = 0;
uint upperBoundGRF = 0;
int numThreadsPerEU = -1;
if (F.hasFnAttribute("num-thread-per-eu"))
{
Expand All @@ -921,7 +922,7 @@ bool EmitPass::runOnFunction(llvm::Function& F)
}
// call builder after pre-analysis pass where scratchspace offset to VISA is calculated
m_encoder->InitEncoder(m_canAbortOnSpill, m_currShader->HasStackCalls(), hasInlineAsmCall, hasAdditionalVisaAsmToLink,
numThreadsPerEU, lowerBoundGRF, prevKernel);
numThreadsPerEU, lowerBoundGRF, upperBoundGRF, prevKernel);

if (!m_encoder->IsCodePatchCandidate())
createVMaskPred(m_vMaskPredForSubplane);
Expand Down

0 comments on commit 2768d02

Please sign in to comment.