Skip to content

Commit 0696474

Browse files
jgu222igcbot
authored andcommitted
Parsing Options for internal options
As NEO passes internal options via Options as well as internalOptions, this change will parse Options for internal options as well. As result, some of options that are defined under Options class are moved to InternalOptions class as they are internal options.
1 parent 7f04dc9 commit 0696474

File tree

3 files changed

+56
-51
lines changed

3 files changed

+56
-51
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3741,23 +3741,18 @@ namespace IGC
37413741
ForceNonCoherentStatelessBti = ClContext->m_ShouldUseNonCoherentStatelessBTI;
37423742
AllowSpill = !ClContext->m_InternalOptions.NoSpill;
37433743

3744-
if (ClContext->m_InternalOptions.DoReRA &&
3745-
!ClContext->gtpin_init)
3746-
{
3747-
SaveOption(vISA_ReRAPostSchedule, true);
3748-
}
3749-
if (ClContext->m_Options.GTPinReRA)
3744+
if (ClContext->m_InternalOptions.GTPinReRA)
37503745
{
37513746
SaveOption(vISA_GTPinReRA, true);
37523747
SaveOption(vISA_ReRAPostSchedule, true);
37533748
}
3754-
if (ClContext->m_Options.GTPinGRFInfo)
3749+
if (ClContext->m_InternalOptions.GTPinGRFInfo)
37553750
{
37563751
SaveOption(vISA_GetFreeGRFInfo, true);
37573752
}
3758-
if (ClContext->m_Options.GTPinScratchAreaSize)
3753+
if (ClContext->m_InternalOptions.GTPinScratchAreaSize)
37593754
{
3760-
SaveOption(vISA_GTPinScratchAreaSize, ClContext->m_Options.GTPinScratchAreaSizeValue);
3755+
SaveOption(vISA_GTPinScratchAreaSize, ClContext->m_InternalOptions.GTPinScratchAreaSizeValue);
37613756
}
37623757
}
37633758

IGC/Compiler/CodeGenContext.cpp

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ namespace IGC
554554

555555
bool OpenCLProgramContext::forceGlobalMemoryAllocation() const
556556
{
557-
return m_Options.ForceGlobalMemoryAllocation;
557+
return m_InternalOptions.ForceGlobalMemoryAllocation;
558558
}
559559

560560
bool OpenCLProgramContext::allocatePrivateAsGlobalBuffer() const
@@ -564,7 +564,7 @@ namespace IGC
564564

565565
bool OpenCLProgramContext::hasNoLocalToGenericCast() const
566566
{
567-
return m_Options.HasNoLocalToGeneric || getModuleMetaData()->hasNoLocalToGenericCast;
567+
return m_InternalOptions.HasNoLocalToGeneric || getModuleMetaData()->hasNoLocalToGenericCast;
568568
}
569569

570570
bool OpenCLProgramContext::hasNoPrivateToGenericCast() const
@@ -695,16 +695,45 @@ namespace IGC
695695
IntelForceEnableA64WA = true;
696696
}
697697

698+
// GTPin flags used by L0 driver runtime
698699
// -cl-intel-gtpin-rera
699700
else if (suffix.equals("-gtpin-rera"))
700701
{
701-
DoReRA = true;
702+
GTPinReRA = true;
702703
}
704+
else if (suffix.equals("-gtpin-grf-info"))
705+
{
706+
GTPinGRFInfo = true;
707+
}
708+
else if (suffix.equals("-gtpin-scratch-area-size"))
709+
{
710+
GTPinScratchAreaSize = true;
711+
size_t valStart = opts.find_first_not_of(' ', ePos + 1);
712+
size_t valEnd = opts.find_first_of(' ', valStart);
713+
llvm::StringRef valStr = opts.substr(valStart, valEnd - valStart);
714+
if (valStr.getAsInteger(10, GTPinScratchAreaSizeValue))
715+
{
716+
IGC_ASSERT(false);
717+
}
718+
Pos = valEnd;
719+
continue;
720+
}
721+
703722
// -cl-intel-no-prera-scheduling
704723
else if (suffix.equals("-no-prera-scheduling"))
705724
{
706725
IntelEnablePreRAScheduling = false;
707726
}
727+
// -cl-intel-no-local-to-generic
728+
else if (suffix.equals("-no-local-to-generic"))
729+
{
730+
HasNoLocalToGeneric = true;
731+
}
732+
// -cl-intel-force-global-mem-allocation
733+
else if (suffix.equals("-force-global-mem-allocation"))
734+
{
735+
ForceGlobalMemoryAllocation = true;
736+
}
708737

709738
//
710739
// Options to set the number of GRF and threads

IGC/Compiler/CodeGenPublic.h

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,6 @@ namespace IGC
12621262
IntelGreaterThan4GBBufferRequired(false),
12631263
Use32BitPtrArith(false),
12641264
IncludeSIPKernelDebugWithLocalMemory(false),
1265-
DoReRA(false),
12661265
IntelHasPositivePointerOffset(false),
12671266
IntelHasBufferOffsetArg(false),
12681267
IntelBufferOffsetArgOptional(true),
@@ -1271,10 +1270,16 @@ namespace IGC
12711270
if (pInputArgs == nullptr)
12721271
return;
12731272

1274-
if (pInputArgs->pInternalOptions == nullptr)
1275-
return;
1273+
if (pInputArgs->pInternalOptions != nullptr)
1274+
{
1275+
parseOptions(pInputArgs->pInternalOptions);
1276+
}
12761277

1277-
parseOptions(pInputArgs->pInternalOptions);
1278+
// Internal options are passed in via pOptions as well.
1279+
if (pInputArgs->pOptions != nullptr)
1280+
{
1281+
parseOptions(pInputArgs->pOptions);
1282+
}
12781283
}
12791284

12801285
bool KernelDebugEnable;
@@ -1285,7 +1290,11 @@ namespace IGC
12851290
bool IntelForceEnableA64WA = false;
12861291
bool Use32BitPtrArith = false;
12871292
bool IncludeSIPKernelDebugWithLocalMemory;
1288-
bool DoReRA;
1293+
1294+
bool GTPinReRA = false;
1295+
bool GTPinGRFInfo = false;
1296+
bool GTPinScratchAreaSize = false;
1297+
uint32_t GTPinScratchAreaSizeValue = 0;
12891298

12901299
// stateless to stateful optimization
12911300
bool IntelHasPositivePointerOffset; // default: false
@@ -1306,6 +1315,10 @@ namespace IGC
13061315
bool EnableZEBinary = false;
13071316
bool NoSpill = false;
13081317

1318+
// Generic address related
1319+
bool HasNoLocalToGeneric = false;
1320+
bool ForceGlobalMemoryAllocation = false;
1321+
13091322
// -1 : initial value that means it is not set from cmdline
13101323
// 0-5: valid values set from the cmdline
13111324
int16_t VectorCoalescingControl = -1;
@@ -1336,6 +1349,8 @@ namespace IGC
13361349
// Build options are of the form -cl-xxxx and -ze-xxxx
13371350
// So we skip these prefixes when reading the options to be agnostic of their source
13381351

1352+
// Runtime passes internal options via pOptions as well, and those
1353+
// internal options will be handled by InternalOptions class.
13391354
const char* options = pInputArgs->pOptions;
13401355
if (strstr(options, "-fp32-correctly-rounded-divide-sqrt"))
13411356
{
@@ -1362,34 +1377,6 @@ namespace IGC
13621377
{
13631378
IsLibraryCompilation = true;
13641379
}
1365-
if (strstr(options, "-no-local-to-generic"))
1366-
{
1367-
HasNoLocalToGeneric = true;
1368-
}
1369-
if (strstr(options, "-force-global-mem-allocation"))
1370-
{
1371-
ForceGlobalMemoryAllocation = true;
1372-
}
1373-
1374-
// GTPin flags used by L0 driver runtime
1375-
if (strstr(options, "-gtpin-rera"))
1376-
{
1377-
GTPinReRA = true;
1378-
}
1379-
if (strstr(options, "-gtpin-grf-info"))
1380-
{
1381-
GTPinGRFInfo = true;
1382-
}
1383-
if (const char* op = strstr(options, "-gtpin-scratch-area-size"))
1384-
{
1385-
GTPinScratchAreaSize = true;
1386-
const char* optionVal = op + strlen("-gtpin-scratch-area-size");
1387-
if ((*optionVal == '=' || *optionVal == ' ') && isdigit(*(optionVal + 1)))
1388-
{
1389-
++optionVal;
1390-
GTPinScratchAreaSizeValue = atoi(optionVal);
1391-
}
1392-
}
13931380
if (const char* op = strstr(options, IGC_MANGLE("-intel-reqd-eu-thread-count")))
13941381
{
13951382
IntelRequiredEUThreadCount = true;
@@ -1404,12 +1391,6 @@ namespace IGC
14041391
bool UniformWGS;
14051392
bool EnableTakeGlobalAddress = false;
14061393
bool IsLibraryCompilation = false;
1407-
bool HasNoLocalToGeneric = false;
1408-
bool ForceGlobalMemoryAllocation = false;
1409-
bool GTPinReRA = false;
1410-
bool GTPinGRFInfo = false;
1411-
bool GTPinScratchAreaSize = false;
1412-
uint32_t GTPinScratchAreaSizeValue = 0;
14131394
bool IntelRequiredEUThreadCount = false;
14141395
uint32_t requiredEUThreadCount = 0;
14151396
};

0 commit comments

Comments
 (0)