mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-01-22 05:33:55 +08:00
clc: require LLVM-15
Allows us to drop code dealing with `opencl-c.h`. 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:
parent
bd085c253c
commit
338636a4ab
@ -32,8 +32,8 @@ The minimum versions to build Rusticl are:
|
||||
- Rust: 1.66
|
||||
- Meson: 1.3.1
|
||||
- Bindgen: 0.62.0
|
||||
- LLVM: 14.0.0 (recommended: 15.0.0)
|
||||
- Clang: 14.0.0 (recommended: 15.0.0)
|
||||
- LLVM: 15.0.0
|
||||
- Clang: 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)
|
||||
|
@ -1731,10 +1731,8 @@ if draw_with_llvm
|
||||
llvm_optional_modules += ['lto']
|
||||
endif
|
||||
|
||||
if with_amd_vk or with_gallium_radeonsi
|
||||
if with_amd_vk or with_gallium_radeonsi or with_clc
|
||||
_llvm_version = '>= 15.0.0'
|
||||
elif with_clc
|
||||
_llvm_version = '>= 14.0.0'
|
||||
elif with_gallium_opencl
|
||||
_llvm_version = '>= 11.0.0'
|
||||
else
|
||||
@ -1829,7 +1827,7 @@ if with_opencl_spirv
|
||||
# 8.0.1.3.
|
||||
_llvmspirvlib_min_version = '>= 8.0.1.3'
|
||||
if with_clc
|
||||
_llvmspirvlib_min_version = '>= 14.0.0.0'
|
||||
_llvmspirvlib_min_version = '>= 15.0.0.0'
|
||||
endif
|
||||
|
||||
_llvmspirvlib_version = [
|
||||
|
@ -61,9 +61,6 @@
|
||||
#include "spirv.h"
|
||||
|
||||
#ifdef USE_STATIC_OPENCL_C_H
|
||||
#if LLVM_VERSION_MAJOR < 15
|
||||
#include "opencl-c.h.h"
|
||||
#endif
|
||||
#include "opencl-c-base.h.h"
|
||||
#endif
|
||||
|
||||
@ -791,12 +788,8 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
|
||||
"-triple", triple,
|
||||
// By default, clang prefers to use modules to pull in the default headers,
|
||||
// which doesn't work with our technique of embedding the headers in our binary
|
||||
#if LLVM_VERSION_MAJOR >= 15
|
||||
"-fdeclare-opencl-builtins",
|
||||
#else
|
||||
"-finclude-default-header",
|
||||
#endif
|
||||
#if LLVM_VERSION_MAJOR >= 15 && LLVM_VERSION_MAJOR < 17
|
||||
#if LLVM_VERSION_MAJOR < 17
|
||||
"-no-opaque-pointers",
|
||||
#endif
|
||||
// Add a default CL compiler version. Clang will pick the last one specified
|
||||
@ -854,20 +847,11 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
|
||||
clang::frontend::Angled,
|
||||
false, false);
|
||||
|
||||
#if LLVM_VERSION_MAJOR < 15
|
||||
::llvm::sys::path::append(system_header_path, "opencl-c.h");
|
||||
c->getPreprocessorOpts().addRemappedFile(system_header_path.str(),
|
||||
::llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(opencl_c_source, ARRAY_SIZE(opencl_c_source) - 1)).release());
|
||||
::llvm::sys::path::remove_filename(system_header_path);
|
||||
#endif
|
||||
|
||||
::llvm::sys::path::append(system_header_path, "opencl-c-base.h");
|
||||
c->getPreprocessorOpts().addRemappedFile(system_header_path.str(),
|
||||
::llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(opencl_c_base_source, ARRAY_SIZE(opencl_c_base_source) - 1)).release());
|
||||
|
||||
#if LLVM_VERSION_MAJOR >= 15
|
||||
c->getPreprocessorOpts().Includes.push_back("opencl-c-base.h");
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
// GetResourcePath is a way to retrive the actual libclang resource dir based on a given binary
|
||||
@ -886,11 +870,7 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
|
||||
clang::frontend::Angled,
|
||||
false, false);
|
||||
// Add opencl include
|
||||
#if LLVM_VERSION_MAJOR >= 15
|
||||
c->getPreprocessorOpts().Includes.push_back("opencl-c-base.h");
|
||||
#else
|
||||
c->getPreprocessorOpts().Includes.push_back("opencl-c.h");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Enable/Disable optional OpenCL C features. Some can be toggled via `OpenCLExtensionsAsWritten`
|
||||
|
@ -43,15 +43,6 @@ if get_option('opencl-external-clang-headers') \
|
||||
endif
|
||||
clang_resource_dir = join_paths(llvm_libdir, 'clang', clang_version_dir, 'include')
|
||||
|
||||
if dep_llvm.version().version_compare('< 15.0')
|
||||
opencl_c_h = custom_target(
|
||||
'opencl-c.h',
|
||||
input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c.h')],
|
||||
output : 'opencl-c.h.h',
|
||||
command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'opencl_c_source'],
|
||||
)
|
||||
endif
|
||||
|
||||
opencl_c_base_h = custom_target(
|
||||
'opencl-c-base.h',
|
||||
input : [files_xxd, join_paths(clang_resource_dir, 'opencl-c-base.h')],
|
||||
@ -60,10 +51,6 @@ if get_option('opencl-external-clang-headers') \
|
||||
)
|
||||
|
||||
_libmesaclc_sources += [opencl_c_base_h]
|
||||
if dep_llvm.version().version_compare('< 15.0')
|
||||
_libmesaclc_sources += [opencl_c_h]
|
||||
endif
|
||||
|
||||
_libmesaclc_cpp_args += ['-DUSE_STATIC_OPENCL_C_H=1']
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user