From 48ad0dd72ffa52eb27e9ffc128483d94d046a8e3 Mon Sep 17 00:00:00 2001 From: Pratik J Ashar Date: Thu, 7 Sep 2023 09:25:46 +0000 Subject: [PATCH] Add compiler option -ze-skip-fde to skip emission of FDE for stack call functions Frame Descriptor Entry (FDE) is emitted by VISA in prolog of each stack call function. Leaf functions can skip FDE store. --- IGC/Compiler/CISACodeGen/CISABuilder.cpp | 5 +++++ IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp | 5 +++++ IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp | 3 ++- IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp | 3 ++- IGC/Options/include/igc/Options/CommonApiOptions.td | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/IGC/Compiler/CISACodeGen/CISABuilder.cpp b/IGC/Compiler/CISACodeGen/CISABuilder.cpp index 252a52f2a981..da5f83de5fd8 100644 --- a/IGC/Compiler/CISACodeGen/CISABuilder.cpp +++ b/IGC/Compiler/CISACodeGen/CISABuilder.cpp @@ -4028,6 +4028,11 @@ namespace IGC { SaveOption(vISA_GTPinGetIndirRef, true); } + + if (ClContext->m_Options.SkipFDE) + { + SaveOption(vISA_skipFDE, true); + } } bool EnableBarrierInstCounterBits = false; diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp index 872410a2bcb0..8655d8060b8e 100644 --- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp +++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp @@ -648,6 +648,11 @@ namespace IGC GTPinIndirRef = true; } + if (apiOptions.hasArg(OPT_skip_fde_common)) + { + SkipFDE = true; + } + if (const opt::Arg* arg = apiOptions.getLastArg(OPT_required_thread_count_common)) { if (arg->getNumValues() > 0) diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp index 663b4b3642f3..0a5c2ca9f166 100644 --- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp +++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp @@ -143,11 +143,12 @@ namespace IGC bool EmitErrorsForLibCompilation = false; uint32_t requiredEUThreadCount = 0; - bool GTPinReRA = false; bool GTPinGRFInfo = false; bool GTPinScratchAreaSize = false; bool GTPinIndirRef = false; + // Skip emission of Frame Descriptor Entry in VISA. + bool SkipFDE = false; uint32_t GTPinScratchAreaSizeValue = 0; std::vector LargeGRFKernels; diff --git a/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp b/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp index 5e326eac29f0..c71409a6b24a 100644 --- a/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp +++ b/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp @@ -1365,7 +1365,8 @@ namespace TC (strcmp(pParam, "-ze-gtpin-grf-info") == 0) || //used by GTPin (strcmp(pParam, "-ze-gtpin-scratch-area-size") == 0) || //used by GTPin (strcmp(pParam, "-ze-opt-enable-auto-large-GRF-mode") == 0) || - (strcmp(pParam, "-cl-intel-enable-auto-large-GRF-mode") == 0); + (strcmp(pParam, "-cl-intel-enable-auto-large-GRF-mode") == 0) || + (strcmp(pParam, "-ze-skip-fde") == 0); if (isCommonOption) { diff --git a/IGC/Options/include/igc/Options/CommonApiOptions.td b/IGC/Options/include/igc/Options/CommonApiOptions.td index f5cd604988bd..9fc74b515994 100644 --- a/IGC/Options/include/igc/Options/CommonApiOptions.td +++ b/IGC/Options/include/igc/Options/CommonApiOptions.td @@ -28,6 +28,8 @@ defm : CommonJoined<"gtpin-scratch-area-size=">, Alias; +defm skip_fde : CommonFlag<"skip-fde">; + def emit_debug : PlainFlag<"g">, HelpText<"Enable generation of debug information and enables kernel debug">; // These are coming from NEO when run under debugger.