clc: require LLVM-14

This allows some code reorganization :)

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27141>
This commit is contained in:
Karol Herbst 2024-01-18 14:15:14 +01:00 committed by Marge Bot
parent 05b628b5af
commit faea27e4ac
4 changed files with 6 additions and 19 deletions

View file

@ -32,8 +32,8 @@ The minimum versions to build Rusticl are:
- Rust: 1.66
- Meson: 1.3.1
- Bindgen: 0.62.0
- LLVM: 11.0.0 (recommended: 15.0.0)
- Clang: 11.0.0 (recommended: 15.0.0)
- LLVM: 14.0.0 (recommended: 15.0.0)
- Clang: 14.0.0 (recommended: 15.0.0)
Updating clang requires a rebuilt of mesa and rusticl if and only if the value of
``CLANG_RESOURCE_DIR`` changes. It is defined through ``clang/Config/config.h``.
- SPIRV-Tools: any version (recommended: v2022.3)

View file

@ -1733,12 +1733,10 @@ endif
if with_amd_vk or with_gallium_radeonsi
_llvm_version = '>= 15.0.0'
elif with_intel_clc
_llvm_version = '>= 13.0.0'
elif with_clc
_llvm_version = '>= 14.0.0'
elif with_gallium_opencl
_llvm_version = '>= 11.0.0'
elif with_clc
_llvm_version = '>= 10.0.0'
else
_llvm_version = '>= 5.0.0'
endif
@ -1830,8 +1828,8 @@ if with_opencl_spirv
# does not have the required API and those are only available starting from
# 8.0.1.3.
_llvmspirvlib_min_version = '>= 8.0.1.3'
if with_intel_clc
_llvmspirvlib_min_version = '>= 13.0.0.0'
if with_clc
_llvmspirvlib_min_version = '>= 14.0.0.0'
endif
_llvmspirvlib_version = [

View file

@ -903,7 +903,6 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
if (!args->features.images)
c->getPreprocessorOpts().addMacroUndef("__IMAGE_SUPPORT__");
#if LLVM_VERSION_MAJOR >= 14
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("-all");
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_byte_addressable_store");
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_global_int32_base_atomics");
@ -941,7 +940,6 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
assert(args->features.subgroups);
c->getTargetOpts().OpenCLExtensionsAsWritten.push_back("+cl_khr_subgroups");
}
#endif
// llvm handles these extensions differently so we have to pass those flags instead to expose the clc functions
c->getPreprocessorOpts().addMacroDef("cl_khr_expect_assume=1");
@ -1005,9 +1003,7 @@ spirv_version_to_llvm_spirv_translator_version(enum clc_spirv_version version)
case CLC_SPIRV_VERSION_1_1: return SPIRV::VersionNumber::SPIRV_1_1;
case CLC_SPIRV_VERSION_1_2: return SPIRV::VersionNumber::SPIRV_1_2;
case CLC_SPIRV_VERSION_1_3: return SPIRV::VersionNumber::SPIRV_1_3;
#ifdef HAS_SPIRV_1_4
case CLC_SPIRV_VERSION_1_4: return SPIRV::VersionNumber::SPIRV_1_4;
#endif
default: return invalid_spirv_trans_version;
}
}
@ -1052,10 +1048,8 @@ llvm_mod_to_spirv(std::unique_ptr<::llvm::Module> mod,
}
SPIRV::TranslatorOpts spirv_opts = SPIRV::TranslatorOpts(version, ext_map);
#if LLVM_VERSION_MAJOR >= 13
/* This was the default in 12.0 and older, but currently we'll fail to parse without this */
spirv_opts.setPreserveOCLKernelArgTypeMetadataThroughString(true);
#endif
#if LLVM_VERSION_MAJOR >= 17
if (args->use_llvm_spirv_target) {

View file

@ -67,11 +67,6 @@ if get_option('opencl-external-clang-headers') \
_libmesaclc_cpp_args += ['-DUSE_STATIC_OPENCL_C_H=1']
endif
# Supported added for SPIRV 1.4 in a version that required LLVM 14.
if dep_llvm.version().version_compare('>= 14.0')
_libmesaclc_cpp_args += ['-DHAS_SPIRV_1_4=1']
endif
_basedir = dep_clc.get_variable(pkgconfig : 'libexecdir')
_static_libclc = get_option('static-libclc')