Skip to content

Commit 55e71fb

Browse files
VyacheslavLevytskyyjsji
authored andcommitted
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. Original commit: KhronosGroup/SPIRV-LLVM-Translator@16e23af93b86810
1 parent 61c7354 commit 55e71fb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

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

7040+
// TODO:
7041+
// - consider exposing user facing options that are to set explicitly a Triple
7042+
// value and an optimization level for the LLVM SPIR-V Backend
7043+
// - switch to the new API call: see
7044+
// https://github.com/llvm/llvm-project/pull/124745
70407045
bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
70417046
const SPIRV::TranslatorOpts &TranslatorOpts) {
70427047
// A list of known extensions supported by SPIR-V Backend: it's to be updated
@@ -7045,13 +7050,18 @@ bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
70457050
SPIRV::ExtensionID::SPV_EXT_shader_atomic_float_add,
70467051
SPIRV::ExtensionID::SPV_EXT_shader_atomic_float16_add,
70477052
SPIRV::ExtensionID::SPV_EXT_shader_atomic_float_min_max,
7053+
SPIRV::ExtensionID::SPV_EXT_arithmetic_fence,
70487054
SPIRV::ExtensionID::SPV_INTEL_arbitrary_precision_integers,
70497055
SPIRV::ExtensionID::SPV_INTEL_cache_controls,
7056+
SPIRV::ExtensionID::SPV_INTEL_float_controls2,
70507057
SPIRV::ExtensionID::SPV_INTEL_global_variable_fpga_decorations,
70517058
SPIRV::ExtensionID::SPV_INTEL_global_variable_host_access,
70527059
SPIRV::ExtensionID::SPV_INTEL_optnone,
70537060
SPIRV::ExtensionID::SPV_INTEL_usm_storage_classes,
7061+
SPIRV::ExtensionID::SPV_INTEL_split_barrier,
70547062
SPIRV::ExtensionID::SPV_INTEL_subgroups,
7063+
SPIRV::ExtensionID::SPV_INTEL_media_block_io,
7064+
SPIRV::ExtensionID::SPV_INTEL_joint_matrix,
70557065
SPIRV::ExtensionID::SPV_KHR_uniform_group_instructions,
70567066
SPIRV::ExtensionID::SPV_KHR_no_integer_wrap_decoration,
70577067
SPIRV::ExtensionID::SPV_KHR_float_controls,
@@ -7068,13 +7078,6 @@ bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
70687078
SPIRV::ExtensionID::SPV_KHR_non_semantic_info};
70697079
// The fallback for the Triple value.
70707080
static const std::string DefaultTriple = "spirv64-unknown-unknown";
7071-
// SPIR-V backend uses the following command line options to conform with
7072-
// Translator's way to generate SPIR-V or with requirements of the Compute
7073-
// flavor of SPIR-V. This list is subject to changes and may become empty
7074-
// eventually.
7075-
static const std::vector<std::string> Opts{"--avoid-spirv-capabilities",
7076-
"Shader",
7077-
"--translator-compatibility-mode"};
70787081

70797082
std::function<bool(SPIRV::ExtensionID)> Filter =
70807083
[](SPIRV::ExtensionID Ext) -> bool {
@@ -7103,7 +7106,7 @@ bool runSpirvBackend(Module *M, std::string &Result, std::string &ErrMsg,
71037106
}
71047107

71057108
// Translate the Module into SPIR-V
7106-
return llvm::SPIRVTranslateModule(M, Result, ErrMsg, AllowExtNames, Opts);
7109+
return llvm::SPIRVTranslateModule(M, Result, ErrMsg, AllowExtNames, {});
71077110
}
71087111

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

0 commit comments

Comments
 (0)