Skip to content

Commit b55969a

Browse files
houjenkoigcbot
authored andcommitted
[IGC feature][CodePatch] Debug print for code patching
1 parent b18be81 commit b55969a

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ namespace IGC
376376

377377
uint32_t CEncoder::getGRFSize() const { return m_program->getGRFSize(); }
378378

379+
380+
std::string CEncoder::GetShaderName() {
381+
return IGC::Debug::GetDumpNameObj(m_program, "").str();
382+
}
383+
379384
void CEncoder::SetProgram(CShader* program)
380385
{
381386
m_program = program;

IGC/Compiler/CISACodeGen/CISABuilder.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ namespace IGC
149149
void DeclareInput(CVariable* var, uint offset, uint instance);
150150
void MarkAsOutput(CVariable* var);
151151
void Compile(bool hasSymbolTable = false);
152+
std::string GetShaderName();
152153
void ReportCompilerStatistics(VISAKernel* pMainKernel, SProgramOutput* pOutput);
153154
int GetThreadCount(SIMDMode simdMode);
154155

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,20 @@ bool EmitPass::runOnFunction(llvm::Function& F)
881881
m_currShader->AllocatePayload();
882882

883883
if (m_currShader->ProgramOutput()->m_scratchSpaceUsedBySpills)
884+
{
885+
if (IGC_GET_FLAG_VALUE(CodePatchExperiments))
886+
{
887+
errs() << "Skip Prologue : " << m_encoder->GetShaderName() << "\n";
888+
}
884889
return false;
890+
}
891+
if (m_encoder->IsCodePatchCandidate())
892+
{
893+
if (IGC_GET_FLAG_VALUE(CodePatchExperiments))
894+
{
895+
errs() << "Prologue/CodePatch : " << m_encoder->GetShaderName() << "\n";
896+
}
897+
}
885898
}
886899

887900
if (m_currShader->GetDebugInfoData())

IGC/common/igc_flags.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ DECLARE_IGC_REGKEY(bool, EnableTrackPtr, false, "Track Staging Co
394394
DECLARE_IGC_REGKEY(bool, ExtraRetrySIMD16, false, "Enable extra simd16 with retry for STAGE1_BEST_PREF", false)
395395
DECLARE_IGC_REGKEY(bool, SaveRestoreIR, true, "Save/Restore IR for staged compilation to avoid duplicated compilations", false)
396396
DECLARE_IGC_REGKEY(DWORD, CodePatch, 0, "Enable Pixel Shader code patching to directly emit code after stitching", false)
397+
DECLARE_IGC_REGKEY(DWORD, CodePatchExperiments, 0, "Experiment with code patching when != 0", false)
397398
DECLARE_IGC_REGKEY(DWORD, FirstStagedSIMD, 0, "Force Pixel shader to be 1: FastSIMD (SIMD8), 2: BestSIMD (SIMD16 or SIMD8), 3: FatestSIMD (SIMD8 opt off)", false)
398399
DECLARE_IGC_REGKEY(bool, ForceFastestSIMD, false, "Force pixel shader to return SIMD8 as fast as possible.", false)
399400
DECLARE_IGC_REGKEY(bool, ForceBestSIMD, false, "Force pixel shader to return the best SIMD, either SIMD16 or SIMD8.", false)

0 commit comments

Comments
 (0)