Skip to content

Commit ba47b5c

Browse files
PawelJureksys_zuul
authored andcommitted
Add check for internal option that enables zebin. It will be enabled by L0 runtime.
Change-Id: I60580f396ef8961f9b82c48fc82a8723cfe459a7
1 parent 157a1ea commit ba47b5c

File tree

8 files changed

+24
-7
lines changed

8 files changed

+24
-7
lines changed

IGC/AdaptorOCL/UnifyIROCL.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ static void CommonOCLBasedPasses(
263263
CompilerOpts.EnableTakeGlobalAddress =
264264
pContext->m_Options.EnableTakeGlobalAddress;
265265

266+
CompilerOpts.EnableZEBinary =
267+
pContext->m_InternalOptions.EnableZEBinary;
268+
266269
// right now we don't support any standard function in the code gen
267270
// maybe we want to support some at some point to take advantage of LLVM optimizations
268271
TargetLibraryInfoImpl TLI;

IGC/AdaptorOCL/dllInterfaceCompute.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,9 @@ bool TranslateBuild(
11921192
// into it
11931193
int binarySize = 0;
11941194
char* binaryOutput = nullptr;
1195-
if (!IGC_IS_FLAG_ENABLED(EnableZEBinary)) {
1195+
1196+
if (!IGC_IS_FLAG_ENABLED(EnableZEBinary) &&
1197+
!oclContext.getModuleMetaData()->compOpt.EnableZEBinary) {
11961198
Util::BinaryStream programBinary;
11971199
// Patch token based binary format
11981200
oclContext.m_programOutput.CreateKernelBinaries();

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4889,7 +4889,8 @@ namespace IGC
48894889
void*& buffer, unsigned& bufferSize, unsigned& tableEntries,
48904890
SProgramOutput::RelocListTy& relocations)
48914891
{
4892-
if (IGC_IS_FLAG_ENABLED(EnableZEBinary)) {
4892+
if (IGC_IS_FLAG_ENABLED(EnableZEBinary) ||
4893+
m_program->GetContext()->getCompilerOption().EnableZEBinary) {
48934894
// for ZEBinary format
48944895
V(vMainKernel->GetRelocations(relocations));
48954896
IGC_ASSERT(sizeof(vISA::GenRelocEntry) * tableEntries == bufferSize);
@@ -5276,7 +5277,8 @@ namespace IGC
52765277
pOutput->m_funcSymbolTableEntries,
52775278
pOutput->m_symbols);
52785279
}
5279-
if(IGC_IS_FLAG_ENABLED(EnableZEBinary))
5280+
if (IGC_IS_FLAG_ENABLED(EnableZEBinary) ||
5281+
m_program->GetContext()->getCompilerOption().EnableZEBinary)
52805282
{
52815283
// cretae symbols for kernel. Symbols have name the same as the kernels, and offset to the
52825284
// start of that kernel

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,8 @@ namespace IGC
16771677
// Create annotations for the kernel argument
16781678
// If an arg is unused, don't generate patch token for it.
16791679
CreateAnnotations(&arg, offset - constantBufferStart);
1680-
if (IGC_IS_FLAG_ENABLED(EnableZEBinary)) {
1680+
if (IGC_IS_FLAG_ENABLED(EnableZEBinary) ||
1681+
m_Context->getCompilerOption().EnableZEBinary) {
16811682
// FIXME: once we transit to zebin completely, we don't need to do
16821683
// CreateAnnotations. Only CreateZEPayloadArguments is required
16831684
CreateZEPayloadArguments(&arg, offset - constantBufferStart);
@@ -2103,7 +2104,8 @@ namespace IGC
21032104
if (ctx->m_retryManager.IsFirstTry())
21042105
{
21052106
CollectProgramInfo(ctx);
2106-
if (IGC_IS_FLAG_DISABLED(EnableZEBinary))
2107+
if (IGC_IS_FLAG_DISABLED(EnableZEBinary) &&
2108+
!ctx->getCompilerOption().EnableZEBinary)
21072109
{
21082110
ctx->m_programOutput.CreateProgramScopePatchStream(ctx->m_programInfo);
21092111
}

IGC/Compiler/CodeGenPublic.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,10 @@ namespace IGC
12481248
}
12491249
}
12501250
}
1251+
if (strstr(options, "-allow-zebin"))
1252+
{
1253+
EnableZEBinary = true;
1254+
}
12511255
}
12521256

12531257

@@ -1269,6 +1273,7 @@ namespace IGC
12691273
bool UseBindlessPrintf = false;
12701274
bool IntelForceGlobalMemoryAllocation = false;
12711275
bool hasNoLocalToGeneric = false;
1276+
bool EnableZEBinary = false;
12721277

12731278
// -1 : initial value that means it is not set from cmdline
12741279
// 0-5: valid values set from the cmdline

IGC/Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantAnalysis.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ bool ProgramScopeConstantAnalysis::runOnModule(Module& M)
196196
}
197197

198198
// Always rely on relocation for ZEBinary
199-
if (IGC_IS_FLAG_DISABLED(EnableZEBinary))
199+
if (IGC_IS_FLAG_DISABLED(EnableZEBinary) &&
200+
!modMd->compOpt.EnableZEBinary)
200201
{
201202
if (hasInlineConstantBuffer)
202203
{

IGC/Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantResolution.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ bool ProgramScopeConstantResolution::runOnModule(Module& M)
8585
// There are no constants, or no constants are used, so we have nothing to do.
8686
return false;
8787
}
88-
if (IGC_IS_FLAG_ENABLED(EnableZEBinary))
88+
if (IGC_IS_FLAG_ENABLED(EnableZEBinary) ||
89+
modMD->compOpt.EnableZEBinary)
8990
{
9091
// ZEBinary always relies on relocation, so we can ignore this pass
9192
return false;

IGC/common/MDFrameWork.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ namespace IGC
224224
bool FastVISACompile = false;
225225
bool MatchSinCosPi = false;
226226
bool CaptureCompilerStats = false;
227+
bool EnableZEBinary = false;
227228
};
228229

229230
struct ComputeShaderInfo

0 commit comments

Comments
 (0)