Skip to content

Commit 6cec290

Browse files
fda0igcbot
authored andcommitted
Use ZEBinary by default, deprecate flags
This change forces ZEBin by default. It deprecates and starts ingoring ZEBin user enable and disable flags as well as internal allow flag. Flags that are now ignored: `cl-disable-zebin`, `-ze-disable-zebin`, `-cl-enable-zebin`, `-ze-enable-zebin`, `-ze-allow-zebin`, `-cl-allow-zebin`. It's still possible to disable ZEBin via internal `-cl-disable-zebin`, `-ze-disable-zebin` flags.
1 parent 62b534b commit 6cec290

File tree

17 files changed

+34
-93
lines changed

17 files changed

+34
-93
lines changed

IGC/AdaptorOCL/dllInterfaceCompute.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,7 @@ 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. You can "
845-
"experiment with EnableZEBinary environmental "
846-
"flag to turn it on.",
844+
"currently disabled for your platform.",
847845
OutputArgs);
848846
return false;
849847
}

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp

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

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))
95+
if (m_InternalOptions.DisableZEBinary) {
96+
// Allow to disable ZEBin via internal options
10797
m_enableZEBinary = false;
108-
109-
// Set the default value from the flag table.
110-
else
111-
m_enableZEBinary = IGC_IS_FLAG_ENABLED(EnableZEBinary);
98+
} else {
99+
// Enable ZEBin for all supported platforms
100+
m_enableZEBinary = supportsZEBin(platform);
101+
}
112102
}
113103

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

IGC/Compiler/CISACodeGen/OpenCLOptions.cpp

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

207-
if (internalOptions.hasArg(OPT_allow_zebin_common))
208-
{
209-
EnableZEBinary = true;
210-
}
211-
212207
if (internalOptions.hasArg(OPT_disable_zebin_common))
213208
{
214-
EnableZEBinary = false;
209+
DisableZEBinary = true;
215210
}
216211

217212
if (internalOptions.hasArg(OPT_exclude_ir_from_zebin_common))
@@ -603,14 +598,10 @@ void Options::parseOptions(const char* opts)
603598
EnableFP64GenConvEmu = true;
604599
}
605600

606-
if (apiOptions.hasArg(OPT_enable_zebin_common))
607-
{
608-
EnableZEBinary = true;
609-
}
610-
611-
if (apiOptions.hasArg(OPT_disable_zebin_common))
601+
if (const llvm::opt::Arg* arg = apiOptions.getLastArg(OPT_Xfinalizer))
612602
{
613-
EnableZEBinary = false;
603+
Xfinalizer = true;
604+
XfinalizerOption = arg->getValue();
614605
}
615606

616607
if (const llvm::opt::Arg* arg = apiOptions.getLastArg(OPT_Xfinalizer))

IGC/Compiler/CISACodeGen/OpenCLOptions.hpp

Lines changed: 1 addition & 3 deletions
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-
std::optional<bool> EnableZEBinary;
117+
bool DisableZEBinary = false;
118118
bool EnableBufferBoundsChecking = false;
119119

120120
// Compile only up to vISA stage.
@@ -192,8 +192,6 @@ class Options
192192
// This applies to platforms that cannot HW support for double operations
193193
bool EnableFP64GenConvEmu = false;
194194

195-
std::optional<bool> EnableZEBinary;
196-
197195
private:
198196
void parseOptions(const char* opts);
199197
};

IGC/Compiler/tests/DebugInfo/SPIRMetaDataTranslation.ll

Lines changed: 1 addition & 2 deletions
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, !58}
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}
143143
!19 = !{!"DenormsAreZero", i1 false}
144144
!20 = !{!"CorrectlyRoundedDivSqrt", i1 false}
145145
!21 = !{!"OptDisable", i1 false}
@@ -179,7 +179,6 @@ attributes #3 = { nounwind readnone }
179179
!55 = !{!"FastVISACompile", i1 false}
180180
!56 = !{!"MatchSinCosPi", i1 false}
181181
!57 = !{!"CaptureCompilerStats", i1 false}
182-
!58 = !{!"EnableZEBinary", i1 false}
183182
!59 = !{!"FuncMD", !60, !61}
184183
!60 = !{!"FuncMDMap[0]", void (i64 addrspace(1)*)* @test_spir}
185184
!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 -regkey EnableZEBinary=0 -igc-opencl-printf-resolution -S < %s | FileCheck %s
10+
; RUN: igc_opt --platformglk -igc-opencl-printf-resolution -S < %s | FileCheck %s
1111
; ------------------------------------------------
1212
; OpenCLPrintfResolution
1313
; ------------------------------------------------

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

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

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

1718
; CHECK: !{!"stringConstants",
1819
; 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 -regkey EnableZEBinary=1 < %s | FileCheck %s
10+
; RUN: -S < %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 when
17-
; EnableZEBinary=1
16+
; space string constants after the address space requirement is relaxed
17+
; (this tested the case with EnableZEBinary=1 which is the default now)
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 -regkey EnableZEBinary=0 -enable-debugify --igc-programscope-constant-resolve -S < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,%LLVM_DEPENDENT_CHECK_PREFIX%
10+
; RUN: igc_opt -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 -regkey EnableZEBinary=0 -enable-debugify --igc-programscope-constant-resolve -S < %s 2>&1 | FileCheck %s
10+
; RUN: igc_opt -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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,10 +1356,10 @@ namespace TC
13561356
(strcmp(pParam, "-ze-force-global-mem-allocation") == 0) || // temp
13571357
(strcmp(pParam, "-cl-no-local-to-generic") == 0) || // temp
13581358
(strcmp(pParam, "-ze-no-local-to-generic") == 0) || // temp
1359-
(strcmp(pParam, "-cl-disable-zebin") == 0) ||
1360-
(strcmp(pParam, "-ze-disable-zebin") == 0) ||
1361-
(strcmp(pParam, "-cl-enable-zebin") == 0) ||
1362-
(strcmp(pParam, "-ze-enable-zebin") == 0) ||
1359+
(strcmp(pParam, "-cl-disable-zebin") == 0) || // deprecated
1360+
(strcmp(pParam, "-ze-disable-zebin") == 0) || // deprecated
1361+
(strcmp(pParam, "-cl-enable-zebin") == 0) || // deprecated
1362+
(strcmp(pParam, "-ze-enable-zebin") == 0) || // deprecated
13631363
(strcmp(pParam, "-cl-intel-debug-info") == 0) ||
13641364
(strncmp(pParam, "-dump-opt-llvm", 14) == 0) ||
13651365
(strcmp(pParam, "-cl-no-subgroup-ifp") == 0) ||

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ defm : CommonJoined<"library-compile-simd=">, Alias<library_compile_simd_common>
4949

5050
// -cl-enable-zebin, -ze-enable-zebin
5151
defm enable_zebin : CommonFlag<"enable-zebin">,
52-
HelpText<"Emit level zero binary (zebin)">;
52+
HelpText<"Deprecated - Emit level zero binary (zebin)">;
5353

5454
// -cl-disable-zebin, -ze-disable-zebin
5555
defm disable_zebin : CommonFlag<"disable-zebin">,
56-
HelpText<"Emit binary in legacy format">;
56+
HelpText<"Deprecated - Emit binary in legacy format">;
5757

5858
defm exp_register_file_size : CommonSeparate<"exp-register-file-size">,
5959
HelpText<"Set amount of registers used by regalloc">;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def emit_visa_only : PlainFlag<"emit-visa-only">,
2525

2626
// -cl-allow-zebin, -ze-allow-zebin
2727
defm allow_zebin : CommonFlag<"allow-zebin">,
28-
HelpText<"Emit level zero binary">;
28+
HelpText<"Deprecated - Emit level zero binary">;
2929

3030
// -cl-disable-zebin, -ze-disable-zebin
3131
defm disable_zebin : CommonFlag<"disable-zebin">,

IGC/VectorCompiler/igcdeps/src/TranslationInterface.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -264,21 +264,6 @@ static void adjustDebugStrippingPolicy(vc::CompileOptions &Opts) {
264264
}
265265
}
266266

267-
// Overwrite binary format option for backward compatibility with
268-
// environment variable approach.
269-
static void adjustBinaryFormat(vc::BinaryKind &Binary) {
270-
if (Binary == vc::BinaryKind::CM)
271-
return;
272-
273-
if (Binary != vc::BinaryKind::Default && !IGC_IS_FLAG_SET(EnableZEBinary))
274-
return;
275-
276-
if (IGC_IS_FLAG_ENABLED(EnableZEBinary))
277-
Binary = vc::BinaryKind::ZE;
278-
else
279-
Binary = vc::BinaryKind::OpenCL;
280-
}
281-
282267
template <typename T> T deriveDefaultableFlagValue(int Flag) {
283268
switch (Flag) {
284269
default:
@@ -354,7 +339,6 @@ static void adjustOptions(const IGC::CPlatform &IGCPlatform,
354339
adjustPlatform(IGCPlatform, Opts);
355340
adjustFileType(DataFormat, Opts);
356341
adjustOptLevel(Opts);
357-
adjustBinaryFormat(Opts.Binary);
358342
adjustDumpOptions(Opts);
359343
adjustStackCalls(Opts, Diag);
360344
adjustDebugStrippingPolicy(Opts);

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

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

6363
// Output binary format
64-
// API options:
65-
// -[cl,ze]-enable-zebin
66-
/// -[cl,ze]-disable-zebin
6764
// Internal options:
68-
// -[cl,ze]-allow-zebin
6965
// -[cl,ze]-disable-zebin
7066
// -binary-format=[ocl,ze,cm]
7167
// Debug keys:

IGC/VectorCompiler/lib/Driver/Driver.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -744,19 +744,6 @@ static Error fillApiOptions(const opt::ArgList &ApiOptions,
744744
Opts.GRFSize = MaybeGRFSize;
745745
}
746746

747-
if (opt::Arg *A =
748-
ApiOptions.getLastArg(OPT_enable_zebin_common, OPT_disable_zebin_common))
749-
switch (A->getOption().getID()) {
750-
case OPT_enable_zebin_common:
751-
Opts.Binary = vc::BinaryKind::ZE;
752-
break;
753-
case OPT_disable_zebin_common:
754-
Opts.Binary = vc::BinaryKind::OpenCL;
755-
break;
756-
default:
757-
break;
758-
}
759-
760747
if (opt::Arg *A = ApiOptions.getLastArg(OPT_fp_contract)) {
761748
StringRef Val = A->getValue();
762749
auto MayBeAllowFPOPFusion =
@@ -847,14 +834,12 @@ static Error fillInternalOptions(const opt::ArgList &InternalOptions,
847834
Opts.InteropSubgroupSize = MaybeSize.getValue();
848835
}
849836

850-
if (opt::Arg *A = InternalOptions.getLastArg(
851-
OPT_binary_format, OPT_allow_zebin_common, OPT_disable_zebin_common)) {
837+
Opts.Binary = vc::BinaryKind::ZE;
838+
if (opt::Arg* A = InternalOptions.getLastArg(
839+
OPT_binary_format, OPT_disable_zebin_common)) {
852840
auto OptID = A->getOption().getID();
853-
854-
if (OptID == OPT_allow_zebin_common)
855-
Opts.Binary = vc::BinaryKind::ZE;
856-
else if (OptID == OPT_disable_zebin_common)
857-
Opts.Binary = vc::BinaryKind::OpenCL;
841+
if (OptID == OPT_disable_zebin_common)
842+
Opts.Binary = vc::BinaryKind::OpenCL;
858843
else {
859844
StringRef Val = A->getValue();
860845
auto MaybeBinary = StringSwitch<Optional<vc::BinaryKind>>(Val)

IGC/common/igc_flags.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,6 @@ DECLARE_IGC_REGKEY(bool, EnableLocalIdCalculationInShader, false,
815815
"used.", true)
816816
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)
817817
DECLARE_IGC_REGKEY(bool, EnableVector8LoadStore, false, "Enable Vectorizer to generate 8x32i and 4x64i loads and stores", true)
818-
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)
819818
DECLARE_IGC_REGKEY(bool, ExcludeIRFromZEBinary, false, "Exclude IR sections from ZE binary", true)
820819
DECLARE_IGC_REGKEY(bool, AllocateZeroInitializedVarsInBss, true, "Allocate zero initialized global variables in .bss section in ZEBinary", true)
821820
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)