Skip to content

Commit

Permalink
Disable the optimization for redundant trimming
Browse files Browse the repository at this point in the history
Disable the optimization for redundant trimming
  • Loading branch information
tmpark authored and igcbot committed Sep 26, 2023
1 parent 53edf48 commit 47233c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions IGC/Compiler/CISACodeGen/EstimateFunctionSize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1547,10 +1547,13 @@ void EstimateFunctionSize::performTrimming(Function *head, llvm::SmallVector<voi
if (IGC_IS_FLAG_ENABLED(StaticProfileGuidedTrimming))
{
uint64_t size_contribution = functionToTrim->getSizeContribution();
if (functionToTrim->SizeAfterInlining == size_contribution) //We don't need to trim function that will be called just one time
if (IGC_IS_FLAG_ENABLED(SkipTrimmingOneCopyFunction))
{
PrintTrimUnit(0x8, "Don't trim (Same size contribution) " << functionToTrim->F->getName().str() << " Initial Size: " << functionToTrim->InitialSize << " Size after inlining: " << functionToTrim->SizeAfterInlining << " Size contribution: " << size_contribution);
continue;
if (functionToTrim->SizeAfterInlining == size_contribution) //We don't need to trim function that will be called just one time
{
PrintTrimUnit(0x8, "Don't trim (Same size contribution) " << functionToTrim->F->getName().str() << " Initial Size: " << functionToTrim->InitialSize << " Size after inlining: " << functionToTrim->SizeAfterInlining << " Size contribution: " << size_contribution);
continue;
}
}
//Trim the function
PrintTrimUnit(0x8, "Trim the function " << functionToTrim->F->getName().str() << " Initial Size: " << functionToTrim->InitialSize << " Size after inlining: " << functionToTrim->SizeAfterInlining << " Size contribution: " << size_contribution);
Expand Down
7 changes: 4 additions & 3 deletions IGC/common/igc_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,13 @@ DECLARE_IGC_REGKEY(DWORD, PrintFunctionSizeAnalysis, 0, "Print analysis data
DECLARE_IGC_REGKEY(DWORD, SubroutineThreshold, 110000, "Minimal kernel size to enable subroutines", false)
DECLARE_IGC_REGKEY(DWORD, SubroutineInlinerThreshold, 3000, "Subroutine inliner threshold", false)
DECLARE_IGC_REGKEY(bool, ControlKernelTotalSize, true, "Control kernel total size", true)
DECLARE_IGC_REGKEY(bool, StaticProfileGuidedTrimming, 0, "Enable static analysis in the kernel trimming", true)
DECLARE_IGC_REGKEY(bool, StaticProfileGuidedTrimming, false, "Enable static analysis in the kernel trimming", true)
DECLARE_IGC_REGKEY(debugString, SelectiveTrimming, 0, "Choose a specific function to trim", true)
DECLARE_IGC_REGKEY(bool, EnableGreedyTrimming, false, "Find the optimal set of functions to trim", true)
DECLARE_IGC_REGKEY(bool, EnableGreedyTrimming, false, "Find the optimal set of functions to trim", true)
DECLARE_IGC_REGKEY(bool, SkipTrimmingOneCopyFunction, false, "Don't trim a function whose size contribution is no more than its size", true)
DECLARE_IGC_REGKEY(bool, ControlInlineImplicitArgs, true, "Avoid trimming functions with implicit args", true)
DECLARE_IGC_REGKEY(DWORD, ControlInlineTinySize, 200, "Tiny function size for controlling kernel total size", true)
DECLARE_IGC_REGKEY(DWORD, ControlInlineTinySizeForSizeContribution, 100, "Tiny function size for controlling kernel total size", true)
DECLARE_IGC_REGKEY(DWORD, ControlInlineTinySizeForSizeContribution, 500, "Tiny function size for controlling kernel total size", true)
DECLARE_IGC_REGKEY(DWORD, ControlInlineSizeContribution, 400, "The size contribution of a function for controlling kernel total size", true)
DECLARE_IGC_REGKEY(DWORD, PrintControlKernelTotalSize, 0, "Print Control kernel total size", true)
DECLARE_IGC_REGKEY(bool, AddNoInlineToTrimmedFunctions, false, "Tell late passes not to inline trimmed functions", false)
Expand Down

0 comments on commit 47233c0

Please sign in to comment.