Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
Minor refactoring in options parsing code.
  • Loading branch information
PawelJurek authored and igcbot committed Oct 12, 2023
1 parent 7380cda commit 55b2547
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion IGC/Compiler/CISACodeGen/CISABuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 55b2547

Please sign in to comment.