Skip to content

Commit a01d3ef

Browse files
fda0igcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: 6b931c1
Remove ability to disable ZEBinary This change removes the possiblity to disable ZEBin. It can be now only force enabled for platforms that do not support it.
1 parent 56d739e commit a01d3ef

File tree

17 files changed

+97
-25
lines changed

17 files changed

+97
-25
lines changed

IGC/AdaptorOCL/dllInterfaceCompute.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,9 @@ bool ProcessElfInput(
841841
SetErrorMessage(
842842
"vISA linking can be used only with ZeBinary "
843843
"compiler output format. It seems that it is "
844-
"currently disabled for your platform.",
844+
"currently disabled for your platform. You can "
845+
"experiment with EnableZEBinary environmental "
846+
"flag to turn it on.",
845847
OutputArgs);
846848
return false;
847849
}

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,23 @@ namespace IGC
9292
}
9393
};
9494

95-
if (m_InternalOptions.DisableZEBinary) {
96-
// Allow to disable ZEBin via internal options
95+
// If env flag is set, use it's value no matter what (works as "Force").
96+
if (IGC_IS_FLAG_SET(EnableZEBinary))
97+
m_enableZEBinary = IGC_IS_FLAG_ENABLED(EnableZEBinary);
98+
99+
// Runtime option precede supported platforms (can force zebin on unsupported).
100+
else if (m_InternalOptions.EnableZEBinary)
101+
m_enableZEBinary = *m_InternalOptions.EnableZEBinary;
102+
else if (m_Options.EnableZEBinary)
103+
m_enableZEBinary = *m_Options.EnableZEBinary;
104+
105+
// If platform is unsupported, disable regardless of the default.
106+
else if (!supportsZEBin(platform))
97107
m_enableZEBinary = false;
98-
} else {
99-
// Enable ZEBin for all supported platforms
100-
m_enableZEBinary = supportsZEBin(platform);
101-
}
108+
109+
// Set the default value from the flag table.
110+
else
111+
m_enableZEBinary = IGC_IS_FLAG_ENABLED(EnableZEBinary);
102112
}
103113

104114
bool enableZEBinary() const override { return m_enableZEBinary; }

IGC/Compiler/CISACodeGen/OpenCLOptions.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,14 @@ void InternalOptions::parseOptions(const char* internalOpts)
204204
}
205205
}
206206

207+
if (internalOptions.hasArg(OPT_allow_zebin_common))
208+
{
209+
EnableZEBinary = true;
210+
}
211+
207212
if (internalOptions.hasArg(OPT_disable_zebin_common))
208213
{
209-
DisableZEBinary = true;
214+
EnableZEBinary = false;
210215
}
211216

212217
if (internalOptions.hasArg(OPT_exclude_ir_from_zebin_common))
@@ -578,5 +583,15 @@ void Options::parseOptions(const char* opts)
578583
// cannot HW support for double operations
579584
EnableFP64GenEmu = true;
580585
}
586+
587+
if (apiOptions.hasArg(OPT_enable_zebin_common))
588+
{
589+
EnableZEBinary = true;
590+
}
591+
592+
if (apiOptions.hasArg(OPT_disable_zebin_common))
593+
{
594+
EnableZEBinary = false;
595+
}
581596
}
582597
} // namespace IGC

IGC/Compiler/CISACodeGen/OpenCLOptions.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class InternalOptions
114114
uint32_t IntelScratchSpacePrivateMemoryMinimalSizePerThread = 0;
115115

116116
bool EnableDivergentBarrierHandling = false;
117-
bool DisableZEBinary = false;
117+
std::optional<bool> EnableZEBinary;
118118
bool EnableBufferBoundsChecking = false;
119119

120120
// Compile only up to vISA stage.
@@ -183,6 +183,8 @@ class Options
183183
// cannot HW support for double operations
184184
bool EnableFP64GenEmu = false;
185185

186+
std::optional<bool> EnableZEBinary;
187+
186188
private:
187189
void parseOptions(const char* opts);
188190
};

IGC/Compiler/tests/DebugInfo/SPIRMetaDataTranslation.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ attributes #3 = { nounwind readnone }
139139
!15 = !{!"intel_reqd_sub_group_size", i32 16}
140140
!16 = !{!"ModuleMD", !17, !18, !59}
141141
!17 = !{!"isPrecise", i1 false}
142-
!18 = !{!"compOpt", !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30, !31, !32, !33, !34, !35, !36, !37, !38, !39, !40, !41, !42, !43, !44, !45, !46, !47, !48, !49, !50, !51, !52, !53, !54, !55, !56, !57}
142+
!18 = !{!"compOpt", !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30, !31, !32, !33, !34, !35, !36, !37, !38, !39, !40, !41, !42, !43, !44, !45, !46, !47, !48, !49, !50, !51, !52, !53, !54, !55, !56, !57, !58}
143143
!19 = !{!"DenormsAreZero", i1 false}
144144
!20 = !{!"CorrectlyRoundedDivSqrt", i1 false}
145145
!21 = !{!"OptDisable", i1 false}
@@ -179,6 +179,7 @@ attributes #3 = { nounwind readnone }
179179
!55 = !{!"FastVISACompile", i1 false}
180180
!56 = !{!"MatchSinCosPi", i1 false}
181181
!57 = !{!"CaptureCompilerStats", i1 false}
182+
!58 = !{!"EnableZEBinary", i1 false}
182183
!59 = !{!"FuncMD", !60, !61}
183184
!60 = !{!"FuncMDMap[0]", void (i64 addrspace(1)*)* @test_spir}
184185
!61 = !{!"FuncMDValue[0]", !62, !63}

IGC/Compiler/tests/OpenCLPrintfResolution/basic.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
;============================ end_copyright_notice =============================
88
; REQUIRES: regkeys
99
;
10-
; RUN: igc_opt --platformglk -igc-opencl-printf-resolution -S < %s | FileCheck %s
10+
; RUN: igc_opt -regkey EnableZEBinary=0 -igc-opencl-printf-resolution -S < %s | FileCheck %s
1111
; ------------------------------------------------
1212
; OpenCLPrintfResolution
1313
; ------------------------------------------------

IGC/Compiler/tests/ProgramScopeConstantAnalysis/printf-string-constant.ll

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
;============================ end_copyright_notice =============================
88
; REQUIRES: regkeys
99
; RUN: igc_opt -igc-programscope-constant-analysis -igc-serialize-metadata \
10-
; RUN: -S < %s | FileCheck %s
10+
; RUN: -S -regkey EnableZEBinary=1 < %s | FileCheck %s
1111
; ------------------------------------------------
1212
; ProgramScopeConstantAnalysis
1313
; ------------------------------------------------
1414

15-
; Test checks that metadata is updated with correct string constants
16-
; (this tested the case with EnableZEBinary=1 which is the default now)
15+
; Test checks that metadata is updated with correct string constants when EnableZEBinary=1
1716

1817
; CHECK: !{!"stringConstants",
1918
; CHECK-DAG: !{!"stringConstantsSet{{[[][0-9][]]}}", [3 x i8] addrspace(2)* @opencl_printf_str}

IGC/Compiler/tests/ProgramScopeConstantAnalysis/relaxed-printf-address-space.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
;============================ end_copyright_notice =============================
88
; REQUIRES: regkeys
99
; RUN: igc_opt -igc-programscope-constant-analysis -igc-serialize-metadata \
10-
; RUN: -S < %s | FileCheck %s
10+
; RUN: -S -regkey EnableZEBinary=1 < %s | FileCheck %s
1111
; ------------------------------------------------
1212
; ProgramScopeConstantAnalysis
1313
; ------------------------------------------------
1414

1515
; Test checks that metadata can be updated correctly with non-constant address
16-
; space string constants after the address space requirement is relaxed
17-
; (this tested the case with EnableZEBinary=1 which is the default now)
16+
; space string constants after the address space requirement is relaxed when
17+
; EnableZEBinary=1
1818

1919
; CHECK: !{!"stringConstants",
2020
; CHECK-DAG: !{!"stringConstantsSet{{[[][0-9][]]}}", [3 x i8] addrspace(2)* @fmt_str}

IGC/Compiler/tests/ProgramScopeConstantResolution/basic.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
;============================ end_copyright_notice =============================
88
; REQUIRES: regkeys
99
;
10-
; RUN: igc_opt -enable-debugify --igc-programscope-constant-resolve -S < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,%LLVM_DEPENDENT_CHECK_PREFIX%
10+
; RUN: igc_opt -regkey EnableZEBinary=0 -enable-debugify --igc-programscope-constant-resolve -S < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,%LLVM_DEPENDENT_CHECK_PREFIX%
1111
; ------------------------------------------------
1212
; ProgramScopeConstantResolution
1313
; ------------------------------------------------

IGC/Compiler/tests/ProgramScopeConstantResolution/offset_minus_one.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
;============================ end_copyright_notice =============================
88
; REQUIRES: regkeys
99
;
10-
; RUN: igc_opt -enable-debugify --igc-programscope-constant-resolve -S < %s 2>&1 | FileCheck %s
10+
; RUN: igc_opt -regkey EnableZEBinary=0 -enable-debugify --igc-programscope-constant-resolve -S < %s 2>&1 | FileCheck %s
1111
; ------------------------------------------------
1212
; ProgramScopeConstantResolution
1313
; ------------------------------------------------

IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,10 @@ namespace TC
13521352
(strcmp(pParam, "-ze-force-global-mem-allocation") == 0) || // temp
13531353
(strcmp(pParam, "-cl-no-local-to-generic") == 0) || // temp
13541354
(strcmp(pParam, "-ze-no-local-to-generic") == 0) || // temp
1355+
(strcmp(pParam, "-cl-disable-zebin") == 0) ||
1356+
(strcmp(pParam, "-ze-disable-zebin") == 0) ||
1357+
(strcmp(pParam, "-cl-enable-zebin") == 0) ||
1358+
(strcmp(pParam, "-ze-enable-zebin") == 0) ||
13551359
(strcmp(pParam, "-cl-intel-debug-info") == 0) ||
13561360
(strncmp(pParam, "-dump-opt-llvm", 14) == 0) ||
13571361
(strcmp(pParam, "-cl-no-subgroup-ifp") == 0) ||

IGC/Options/include/igc/Options/CommonApiOptions.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ defm library_compilation : CommonFlag<"library-compilation">;
4747
defm library_compile_simd : CommonSeparate<"library-compile-simd">;
4848
defm : CommonJoined<"library-compile-simd=">, Alias<library_compile_simd_common>;
4949

50+
// -cl-enable-zebin, -ze-enable-zebin
51+
defm enable_zebin : CommonFlag<"enable-zebin">,
52+
HelpText<"Emit level zero binary (zebin)">;
53+
54+
// -cl-disable-zebin, -ze-disable-zebin
55+
defm disable_zebin : CommonFlag<"disable-zebin">,
56+
HelpText<"Emit binary in legacy format">;
57+
5058
defm exp_register_file_size : CommonSeparate<"exp-register-file-size">,
5159
HelpText<"Set amount of registers used by regalloc">;
5260
defm : CommonJoined<"exp-register-file-size=">, Alias<exp_register_file_size_common>,

IGC/Options/include/igc/Options/CommonInternalOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ defm emit_zebin_visa_sections : CommonFlag<"emit-zebin-visa-sections">,
2323
def emit_visa_only : PlainFlag<"emit-visa-only">,
2424
HelpText<"Compile until vISA">;
2525

26+
// -cl-allow-zebin, -ze-allow-zebin
27+
defm allow_zebin : CommonFlag<"allow-zebin">,
28+
HelpText<"Emit level zero binary">;
29+
2630
// -cl-disable-zebin, -ze-disable-zebin
2731
defm disable_zebin : CommonFlag<"disable-zebin">,
2832
HelpText<"Emit binary in legacy format">;

IGC/VectorCompiler/igcdeps/src/TranslationInterface.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,16 @@ static void adjustDebugStrippingPolicy(vc::CompileOptions &Opts) {
265265
// Overwrite binary format option for backward compatibility with
266266
// environment variable approach.
267267
static void adjustBinaryFormat(vc::BinaryKind &Binary) {
268-
if (Binary != vc::BinaryKind::Default)
268+
if (Binary == vc::BinaryKind::CM)
269269
return;
270270

271-
Binary = vc::BinaryKind::OpenCL;
271+
if (Binary != vc::BinaryKind::Default && !IGC_IS_FLAG_SET(EnableZEBinary))
272+
return;
273+
274+
if (IGC_IS_FLAG_ENABLED(EnableZEBinary))
275+
Binary = vc::BinaryKind::ZE;
276+
else
277+
Binary = vc::BinaryKind::OpenCL;
272278
}
273279

274280
template <typename T> T deriveDefaultableFlagValue(int Flag) {

IGC/VectorCompiler/include/vc/Driver/Driver.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ struct CompileOptions {
6161
std::string ApiOptions;
6262

6363
// Output binary format
64+
// API options:
65+
// -[cl,ze]-enable-zebin
66+
/// -[cl,ze]-disable-zebin
6467
// Internal options:
68+
// -[cl,ze]-allow-zebin
6569
// -[cl,ze]-disable-zebin
6670
// -binary-format=[ocl,ze,cm]
6771
// Debug keys:

IGC/VectorCompiler/lib/Driver/Driver.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,19 @@ static Error fillApiOptions(const opt::ArgList &ApiOptions,
740740
Opts.GRFSize = MaybeGRFSize;
741741
}
742742

743+
if (opt::Arg *A =
744+
ApiOptions.getLastArg(OPT_enable_zebin_common, OPT_disable_zebin_common))
745+
switch (A->getOption().getID()) {
746+
case OPT_enable_zebin_common:
747+
Opts.Binary = vc::BinaryKind::ZE;
748+
break;
749+
case OPT_disable_zebin_common:
750+
Opts.Binary = vc::BinaryKind::OpenCL;
751+
break;
752+
default:
753+
break;
754+
}
755+
743756
if (opt::Arg *A = ApiOptions.getLastArg(OPT_fp_contract)) {
744757
StringRef Val = A->getValue();
745758
auto MayBeAllowFPOPFusion =
@@ -830,11 +843,14 @@ static Error fillInternalOptions(const opt::ArgList &InternalOptions,
830843
Opts.InteropSubgroupSize = MaybeSize.getValue();
831844
}
832845

833-
if (opt::Arg* A = InternalOptions.getLastArg(
834-
OPT_binary_format, OPT_disable_zebin_common)) {
846+
if (opt::Arg *A = InternalOptions.getLastArg(
847+
OPT_binary_format, OPT_allow_zebin_common, OPT_disable_zebin_common)) {
835848
auto OptID = A->getOption().getID();
836-
if (OptID == OPT_disable_zebin_common)
837-
Opts.Binary = vc::BinaryKind::OpenCL;
849+
850+
if (OptID == OPT_allow_zebin_common)
851+
Opts.Binary = vc::BinaryKind::ZE;
852+
else if (OptID == OPT_disable_zebin_common)
853+
Opts.Binary = vc::BinaryKind::OpenCL;
838854
else {
839855
StringRef Val = A->getValue();
840856
auto MaybeBinary = StringSwitch<Optional<vc::BinaryKind>>(Val)

IGC/common/igc_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ DECLARE_IGC_REGKEY(bool, EnableLocalIdCalculationInShader, false,
808808
"used.", true)
809809
DECLARE_IGC_REGKEY(int, JointMatrixLoadStoreOpt, 3, "Selects subgroup (0), or block read/write (1), or optimized block read/write (2), 2d block read/write (3) implementation of Joint Matrix Load/Store built-ins", true)
810810
DECLARE_IGC_REGKEY(bool, EnableVector8LoadStore, false, "Enable Vectorizer to generate 8x32i and 4x64i loads and stores", true)
811+
DECLARE_IGC_REGKEY(bool, EnableZEBinary, true, "Force-enable output in ZE binary format. Leave unset for compiler to choose based on current platform's support for ZE binary", true)
811812
DECLARE_IGC_REGKEY(bool, ExcludeIRFromZEBinary, false, "Exclude IR sections from ZE binary", true)
812813
DECLARE_IGC_REGKEY(bool, AllocateZeroInitializedVarsInBss, true, "Allocate zero initialized global variables in .bss section in ZEBinary", true)
813814
DECLARE_IGC_REGKEY(DWORD, OverrideOCLMaxParamSize, 0, "Override the value imposed on the kernel by CL_DEVICE_MAX_PARAMETER_SIZE. Value in bytes, if value==0 no override happens.", true)

0 commit comments

Comments
 (0)