diff --git a/IGC/Compiler/CISACodeGen/EstimateFunctionSize.cpp b/IGC/Compiler/CISACodeGen/EstimateFunctionSize.cpp index d31f5e54fc55..4ca50a1c50f5 100644 --- a/IGC/Compiler/CISACodeGen/EstimateFunctionSize.cpp +++ b/IGC/Compiler/CISACodeGen/EstimateFunctionSize.cpp @@ -1547,10 +1547,13 @@ void EstimateFunctionSize::performTrimming(Function *head, llvm::SmallVectorgetSizeContribution(); - 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); diff --git a/IGC/common/igc_flags.h b/IGC/common/igc_flags.h index 31466e8dc783..abaa622b1736 100644 --- a/IGC/common/igc_flags.h +++ b/IGC/common/igc_flags.h @@ -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)