Skip to content

Commit 16e23af

Browse files
Update the list of supported by the SPIR-V Backend extensions and remove unneeded options in the call to the SPIR-V Backend API call (#2978)
This PR is to fix usage of the SPIR-V Backend API by updating the list of supported by the SPIR-V Backend extensions and removing no longer needed options in the call to the SPIR-V Backend API call. More details about the context of the change are available in llvm/llvm-project#124745 where The SPIR-V Backend API was refactored wrt. a way it's working with user facing options.
1 parent 7c0db92 commit 16e23af

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7042,6 +7042,11 @@ static inline Triple::SubArchType spirvVersionToSubArch(VersionNumber VN) {
70427042
return Triple::NoSubArch;
70437043
}
70447044

7045+
// TODO:
7046+
// - consider exposing user facing options that are to set explicitly a Triple
7047+
// value and an optimization level for the LLVM SPIR-V Backend
7048+
// - switch to the new API call: see
7049+
// https://github.com/llvm/llvm-project/pull/124745
70457050
bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
70467051
const SPIRV::TranslatorOpts &TranslatorOpts) {
70477052
// A list of known extensions supported by SPIR-V Backend: it's to be updated
@@ -7050,14 +7055,19 @@ bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
70507055
SPIRV::ExtensionID::SPV_EXT_shader_atomic_float_add,
70517056
SPIRV::ExtensionID::SPV_EXT_shader_atomic_float16_add,
70527057
SPIRV::ExtensionID::SPV_EXT_shader_atomic_float_min_max,
7058+
SPIRV::ExtensionID::SPV_EXT_arithmetic_fence,
70537059
SPIRV::ExtensionID::SPV_INTEL_arbitrary_precision_integers,
70547060
SPIRV::ExtensionID::SPV_INTEL_cache_controls,
7061+
SPIRV::ExtensionID::SPV_INTEL_float_controls2,
70557062
SPIRV::ExtensionID::SPV_INTEL_global_variable_fpga_decorations,
70567063
SPIRV::ExtensionID::SPV_INTEL_global_variable_host_access,
70577064
SPIRV::ExtensionID::SPV_EXT_optnone,
70587065
SPIRV::ExtensionID::SPV_INTEL_optnone,
70597066
SPIRV::ExtensionID::SPV_INTEL_usm_storage_classes,
7067+
SPIRV::ExtensionID::SPV_INTEL_split_barrier,
70607068
SPIRV::ExtensionID::SPV_INTEL_subgroups,
7069+
SPIRV::ExtensionID::SPV_INTEL_media_block_io,
7070+
SPIRV::ExtensionID::SPV_INTEL_joint_matrix,
70617071
SPIRV::ExtensionID::SPV_KHR_uniform_group_instructions,
70627072
SPIRV::ExtensionID::SPV_KHR_no_integer_wrap_decoration,
70637073
SPIRV::ExtensionID::SPV_KHR_float_controls,
@@ -7074,13 +7084,6 @@ bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
70747084
SPIRV::ExtensionID::SPV_KHR_non_semantic_info};
70757085
// The fallback for the Triple value.
70767086
static const std::string DefaultTriple = "spirv64-unknown-unknown";
7077-
// SPIR-V backend uses the following command line options to conform with
7078-
// Translator's way to generate SPIR-V or with requirements of the Compute
7079-
// flavor of SPIR-V. This list is subject to changes and may become empty
7080-
// eventually.
7081-
static const std::vector<std::string> Opts{"--avoid-spirv-capabilities",
7082-
"Shader",
7083-
"--translator-compatibility-mode"};
70847087

70857088
std::function<bool(SPIRV::ExtensionID)> Filter =
70867089
[](SPIRV::ExtensionID Ext) -> bool {
@@ -7109,7 +7112,7 @@ bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
71097112
}
71107113

71117114
// Translate the Module into SPIR-V
7112-
return llvm::SPIRVTranslateModule(M, Result, ErrMsg, AllowExtNames, Opts);
7115+
return llvm::SPIRVTranslateModule(M, Result, ErrMsg, AllowExtNames, {});
71137116
}
71147117

71157118
bool runSpirvBackend(Module *M, std::ostream *OS, std::string &ErrMsg,

0 commit comments

Comments
 (0)