clover: Add opencl-native build flag
This flag controls whether to include native codegen functionality for the AMD backend Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
This commit is contained in:
parent
60454a4e99
commit
425cfcafb2
|
@ -1611,7 +1611,10 @@ else
|
|||
dep_llvmspirvlib = null_dep
|
||||
endif
|
||||
|
||||
if (with_amd_vk or with_gallium_radeonsi or with_gallium_opencl or
|
||||
with_opencl_native = _opencl != 'disabled' and get_option('opencl-native')
|
||||
|
||||
if (with_amd_vk or with_gallium_radeonsi or
|
||||
(with_gallium_opencl and with_opencl_native) or
|
||||
(with_gallium_r600 and with_llvm))
|
||||
dep_elf = dependency('libelf', required : false)
|
||||
if not dep_elf.found()
|
||||
|
|
|
@ -155,6 +155,12 @@ option(
|
|||
value : false,
|
||||
description : 'build gallium "clover" OpenCL frontend with SPIR-V binary support.',
|
||||
)
|
||||
option(
|
||||
'opencl-native',
|
||||
type : 'boolean',
|
||||
value : true,
|
||||
description : 'build gallium "clover" OpenCL frontend with native LLVM codegen support.',
|
||||
)
|
||||
option(
|
||||
'static-libclc',
|
||||
type : 'array',
|
||||
|
|
|
@ -36,13 +36,15 @@
|
|||
#include <llvm/Support/TargetRegistry.h>
|
||||
#include <llvm/Transforms/Utils/Cloning.h>
|
||||
|
||||
#include <libelf.h>
|
||||
#include <gelf.h>
|
||||
|
||||
using namespace clover;
|
||||
using namespace clover::llvm;
|
||||
using ::llvm::TargetMachine;
|
||||
|
||||
#ifdef HAVE_CLOVER_NATIVE
|
||||
|
||||
#include <libelf.h>
|
||||
#include <gelf.h>
|
||||
|
||||
namespace {
|
||||
namespace elf {
|
||||
std::unique_ptr<Elf, int (*)(Elf *)>
|
||||
|
@ -161,3 +163,20 @@ clover::llvm::print_module_native(const ::llvm::Module &mod,
|
|||
return "Couldn't output native disassembly: " + log;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
module
|
||||
clover::llvm::build_module_native(::llvm::Module &mod, const target &target,
|
||||
const clang::CompilerInstance &c,
|
||||
std::string &r_log) {
|
||||
unreachable("Native codegen support disabled at build time");
|
||||
}
|
||||
|
||||
std::string
|
||||
clover::llvm::print_module_native(const ::llvm::Module &mod,
|
||||
const target &target) {
|
||||
unreachable("Native codegen support disabled at build time");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,6 +44,10 @@ if with_opencl_icd
|
|||
clover_cpp_args += '-DHAVE_CLOVER_ICD'
|
||||
endif
|
||||
|
||||
if with_opencl_native
|
||||
clover_spirv_cpp_args += '-DHAVE_CLOVER_NATIVE'
|
||||
endif
|
||||
|
||||
if with_opencl_spirv
|
||||
clover_spirv_cpp_args += '-DHAVE_CLOVER_SPIRV'
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue