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
|
dep_llvmspirvlib = null_dep
|
||||||
endif
|
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))
|
(with_gallium_r600 and with_llvm))
|
||||||
dep_elf = dependency('libelf', required : false)
|
dep_elf = dependency('libelf', required : false)
|
||||||
if not dep_elf.found()
|
if not dep_elf.found()
|
||||||
|
|
|
@ -155,6 +155,12 @@ option(
|
||||||
value : false,
|
value : false,
|
||||||
description : 'build gallium "clover" OpenCL frontend with SPIR-V binary support.',
|
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(
|
option(
|
||||||
'static-libclc',
|
'static-libclc',
|
||||||
type : 'array',
|
type : 'array',
|
||||||
|
|
|
@ -36,13 +36,15 @@
|
||||||
#include <llvm/Support/TargetRegistry.h>
|
#include <llvm/Support/TargetRegistry.h>
|
||||||
#include <llvm/Transforms/Utils/Cloning.h>
|
#include <llvm/Transforms/Utils/Cloning.h>
|
||||||
|
|
||||||
#include <libelf.h>
|
|
||||||
#include <gelf.h>
|
|
||||||
|
|
||||||
using namespace clover;
|
using namespace clover;
|
||||||
using namespace clover::llvm;
|
using namespace clover::llvm;
|
||||||
using ::llvm::TargetMachine;
|
using ::llvm::TargetMachine;
|
||||||
|
|
||||||
|
#ifdef HAVE_CLOVER_NATIVE
|
||||||
|
|
||||||
|
#include <libelf.h>
|
||||||
|
#include <gelf.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
namespace elf {
|
namespace elf {
|
||||||
std::unique_ptr<Elf, int (*)(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;
|
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'
|
clover_cpp_args += '-DHAVE_CLOVER_ICD'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if with_opencl_native
|
||||||
|
clover_spirv_cpp_args += '-DHAVE_CLOVER_NATIVE'
|
||||||
|
endif
|
||||||
|
|
||||||
if with_opencl_spirv
|
if with_opencl_spirv
|
||||||
clover_spirv_cpp_args += '-DHAVE_CLOVER_SPIRV'
|
clover_spirv_cpp_args += '-DHAVE_CLOVER_SPIRV'
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue