Skip to content

Commit 9907e77

Browse files
vmustyaigcbot
authored andcommitted
Use stackcall ABI v2 in VC when emitting zebin
Scalar BE uses stackcall ABI v2 for ze binaries. VC should follow this convension to allow interop.
1 parent 003fc88 commit 9907e77

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ enum class FileType { SPIRV, LLVM_TEXT, LLVM_BINARY };
4747

4848
enum class OptimizerLevel { None, Full };
4949

50-
enum class BinaryKind { CM, OpenCL, ZE };
51-
5250
enum class GlobalsLocalizationMode { All, No, Vector, Partial };
5351

5452
enum class DisableLRCoalescingControl { Default, Disable, Enable };

IGC/VectorCompiler/include/vc/Support/BackendConfig.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ SPDX-License-Identifier: MIT
4242

4343
enum class FunctionControl { Default, StackCall };
4444

45+
namespace vc {
46+
enum class BinaryKind { CM, OpenCL, ZE };
47+
} // namespace vc
48+
4549
namespace llvm {
4650

4751
void initializeGenXBackendConfigPass(PassRegistry &PR);
@@ -117,6 +121,9 @@ struct GenXBackendOptions {
117121
// Use bindless mode for buffers.
118122
bool UseBindlessBuffers = false;
119123

124+
// Output binary format
125+
vc::BinaryKind Binary = vc::BinaryKind::OpenCL;
126+
120127
// Add vISA asm as sections in ZeBin
121128
bool EmitZebinVisaSections = false;
122129

@@ -342,6 +349,8 @@ class GenXBackendConfig : public ImmutablePass {
342349
unsigned getInteropSubgroupSize() const {
343350
return Options.InteropSubgroupSize;
344351
}
352+
353+
vc::BinaryKind getBinaryFormat() const { return Options.Binary; }
345354
};
346355
} // namespace llvm
347356

IGC/VectorCompiler/lib/Driver/Driver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ static GenXBackendOptions createBackendOptions(const vc::CompileOptions &Opts) {
249249
if (Opts.InteropSubgroupSize)
250250
BackendOpts.InteropSubgroupSize = Opts.InteropSubgroupSize;
251251

252+
BackendOpts.Binary = Opts.Binary;
253+
252254
BackendOpts.DisableLiveRangesCoalescing =
253255
getDefaultOverridableFlag(Opts.DisableLRCoalescingMode, false);
254256
BackendOpts.DisableExtraCoalescing =

IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6688,11 +6688,15 @@ collectFinalizerArgs(StringSaver &Saver, const GenXSubtarget &ST,
66886688
addArgument("1");
66896689
}
66906690
if (ST.isOCLRuntime()) {
6691-
addArgument("-oclRuntime");
6691+
addArgument("-oclRuntime");
66926692
}
66936693
if (!BC.getVISALTOStrings().empty()) {
66946694
addArgument("-noStitchExternFunc");
66956695
}
6696+
if (BC.getBinaryFormat() == vc::BinaryKind::ZE) {
6697+
addArgument("-abiver");
6698+
addArgument("2");
6699+
}
66966700
return Argv;
66976701
}
66986702

0 commit comments

Comments
 (0)