From 55b254724beb4c097808c9829bed43a48a075379 Mon Sep 17 00:00:00 2001 From: "Jurek, Pawel" Date: Wed, 11 Oct 2023 13:38:18 +0000 Subject: [PATCH] Minor refactoring Minor refactoring in options parsing code. --- IGC/Compiler/CISACodeGen/CISABuilder.cpp | 3 ++- IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp | 5 +++-- IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp | 16 ++++++++-------- IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/IGC/Compiler/CISACodeGen/CISABuilder.cpp b/IGC/Compiler/CISACodeGen/CISABuilder.cpp index 183e2b202119..fcfa5638b0d6 100644 --- a/IGC/Compiler/CISACodeGen/CISABuilder.cpp +++ b/IGC/Compiler/CISACodeGen/CISABuilder.cpp @@ -4596,7 +4596,8 @@ namespace IGC ) && !ClContext->m_InternalOptions.Intel128GRFPerThread && !ClContext->m_Options.Intel128GRFPerThread && !ClContext->m_InternalOptions.Intel256GRFPerThread && - !ClContext->m_Options.Intel256GRFPerThread) + !ClContext->m_Options.Intel256GRFPerThread + ) { // When user hasn't specified number of threads, we can rely on compiler heuristics SaveOption(vISA_AutoGRFSelection, true); diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp index 89ee30874169..383062c7c5d3 100644 --- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp +++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp @@ -225,7 +225,8 @@ namespace IGC return threshold; } - void OpenCLProgramContext::InternalOptions::parseOptions(const char* internalOpts) + void OpenCLProgramContext::InternalOptions::parseOptions( + const char *internalOpts, OpenCLProgramContext &context) { using namespace options::internal; if (internalOpts == nullptr) @@ -578,7 +579,7 @@ namespace IGC } } - void OpenCLProgramContext::Options::parseOptions(const char* opts) + void OpenCLProgramContext::Options::parseOptions(const char* opts, OpenCLProgramContext& context) { using namespace options::api; if (opts == nullptr) diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp index abe9245bb10e..8b565abe7ff4 100644 --- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp +++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp @@ -24,14 +24,14 @@ namespace IGC class InternalOptions { public: - InternalOptions(const TC::STB_TranslateInputArgs* pInputArgs) + InternalOptions(const TC::STB_TranslateInputArgs* pInputArgs, OpenCLProgramContext& context) { if (pInputArgs == nullptr) return; if (pInputArgs->pInternalOptions != nullptr) { - parseOptions(pInputArgs->pInternalOptions); + parseOptions(pInputArgs->pInternalOptions, context); } } @@ -118,20 +118,20 @@ namespace IGC bool EmitVisaOnly = false; private: - void parseOptions(const char* internalOpts); + void parseOptions(const char* internalOpts, OpenCLProgramContext& context); }; class Options { public: - Options(const TC::STB_TranslateInputArgs* pInputArgs) + Options(const TC::STB_TranslateInputArgs* pInputArgs, OpenCLProgramContext& context) { if (pInputArgs == nullptr) return; if (pInputArgs->pOptions != nullptr) { - parseOptions(pInputArgs->pOptions); + parseOptions(pInputArgs->pOptions, context); } } @@ -178,7 +178,7 @@ namespace IGC bool EnableFP64GenEmu = false; private: - void parseOptions(const char* opts); + void parseOptions(const char* opts, OpenCLProgramContext& context); }; // output: shader information @@ -220,8 +220,8 @@ namespace IGC const bool createResourceDimTypes = true) : CodeGenContext(ShaderType::OPENCL_SHADER, btiLayout, platform, driverInfo, createResourceDimTypes, llvmContext), m_programOutput(platform.getPlatformInfo(), *this), - m_InternalOptions(pInputArgs), - m_Options(pInputArgs), + m_InternalOptions(pInputArgs, *this), + m_Options(pInputArgs, *this), isSpirV(false), m_ShouldUseNonCoherentStatelessBTI(shouldUseNonCoherentStatelessBTI) { diff --git a/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp b/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp index c71409a6b24a..8d476bcbc0de 100644 --- a/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp +++ b/IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp @@ -1330,6 +1330,7 @@ namespace TC (strcmp(pParam, "-igc_opts") == 0) || //temporary options (strcmp(pParam, "-cl-intel-gtpin-rera") == 0) || //temporary options (strcmp(pParam, "-cl-intel-256-GRF-per-thread") == 0) || //temporary options + (strcmp(pParam, "-ze-opt-256-GRF-per-thread") == 0) || //temporary options (strcmp(pParam, "-ze-opt-large-register-file") == 0) || //temporary options (strcmp(pParam, "-ze-opt-disable-recompilation") == 0) || //temporary options (strcmp(pParam, "-cl-intel-num-thread-per-eu") == 0) || //temporary options