radv/r600/clover: Getting libelf to be optional
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18503>
This commit is contained in:
@@ -613,7 +613,6 @@ debian-mingw32-x86_64:
|
||||
GALLIUM_ST: >
|
||||
-D gallium-opencl=icd
|
||||
-D gallium-rusticl=false
|
||||
-D opencl-native=false
|
||||
-D opencl-spirv=true
|
||||
-D microsoft-clc=enabled
|
||||
-D static-libclc=all
|
||||
|
@@ -51,6 +51,9 @@ meson `
|
||||
-Dgallium-drivers="swrast,d3d12,zink" `
|
||||
-Dshared-glapi=enabled `
|
||||
-Dgles2=enabled `
|
||||
-Dgallium-opencl=icd `
|
||||
-Dgallium-rusticl=false `
|
||||
-Dopencl-spirv=true `
|
||||
-Dmicrosoft-clc=enabled `
|
||||
-Dstatic-libclc=all `
|
||||
-Dspirv-to-dxil=true `
|
||||
|
17
meson.build
17
meson.build
@@ -1903,17 +1903,12 @@ if host_machine.system() == 'windows'
|
||||
dep_version = cpp.find_library('version')
|
||||
endif
|
||||
|
||||
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 with_platform_windows and not dep_elf.found()
|
||||
dep_elf = cc.find_library('elf')
|
||||
endif
|
||||
else
|
||||
dep_elf = null_dep
|
||||
dep_elf = dependency('libelf', required : false)
|
||||
if not with_platform_windows and not dep_elf.found()
|
||||
dep_elf = cc.find_library('elf')
|
||||
endif
|
||||
if dep_elf.found()
|
||||
pre_args += '-DUSE_LIBELF'
|
||||
endif
|
||||
|
||||
dep_glvnd = null_dep
|
||||
|
@@ -181,12 +181,6 @@ 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',
|
||||
|
@@ -965,7 +965,7 @@ static void ac_sqtt_dump_spm(const struct ac_spm_trace_data *spm_trace,
|
||||
fseek(output, file_offset, SEEK_SET);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
#if defined(USE_LIBELF)
|
||||
static void ac_sqtt_dump_data(struct radeon_info *rad_info,
|
||||
struct ac_thread_trace *thread_trace,
|
||||
const struct ac_spm_trace_data *spm_trace,
|
||||
@@ -1158,7 +1158,7 @@ int ac_dump_rgp_capture(struct radeon_info *info,
|
||||
struct ac_thread_trace *thread_trace,
|
||||
const struct ac_spm_trace_data *spm_trace)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if !defined(USE_LIBELF)
|
||||
return -1;
|
||||
#else
|
||||
char filename[2048];
|
||||
|
@@ -102,7 +102,7 @@ amd_common_files = files(
|
||||
'ac_perfcounter.h',
|
||||
)
|
||||
|
||||
if not with_platform_windows
|
||||
if dep_elf.found()
|
||||
amd_common_files += files(
|
||||
'ac_rtld.c',
|
||||
'ac_rtld.h',
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#include "util/debug.h"
|
||||
#include "ac_binary.h"
|
||||
#include "ac_nir.h"
|
||||
#ifndef _WIN32
|
||||
#if defined(USE_LIBELF)
|
||||
#include "ac_rtld.h"
|
||||
#endif
|
||||
#include "aco_interface.h"
|
||||
@@ -1955,7 +1955,7 @@ radv_postprocess_config(const struct radv_device *device, const struct ac_shader
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
#if defined(USE_LIBELF)
|
||||
static bool
|
||||
radv_open_rtld_binary(struct radv_device *device, const struct radv_shader *shader,
|
||||
const struct radv_shader_binary *binary, struct ac_rtld_binary *rtld_binary)
|
||||
@@ -2006,7 +2006,7 @@ radv_shader_binary_upload(struct radv_device *device, const struct radv_shader_b
|
||||
struct radv_shader *shader, void *dest_ptr)
|
||||
{
|
||||
if (binary->type == RADV_BINARY_TYPE_RTLD) {
|
||||
#ifdef _WIN32
|
||||
#if !defined(USE_LIBELF)
|
||||
return false;
|
||||
#else
|
||||
struct ac_rtld_binary rtld_binary = {0};
|
||||
@@ -2059,7 +2059,7 @@ radv_shader_create(struct radv_device *device, struct radv_shader_binary *binary
|
||||
shader->binary = binary;
|
||||
|
||||
if (binary->type == RADV_BINARY_TYPE_RTLD) {
|
||||
#ifdef _WIN32
|
||||
#if !defined(USE_LIBELF)
|
||||
free(shader);
|
||||
return NULL;
|
||||
#else
|
||||
@@ -2110,7 +2110,7 @@ radv_shader_create(struct radv_device *device, struct radv_shader_binary *binary
|
||||
}
|
||||
|
||||
if (binary->type == RADV_BINARY_TYPE_RTLD) {
|
||||
#ifdef _WIN32
|
||||
#if !defined(USE_LIBELF)
|
||||
free(shader);
|
||||
return NULL;
|
||||
#else
|
||||
|
@@ -190,7 +190,11 @@ egd_tables_h = custom_target(
|
||||
|
||||
r600_c_args = []
|
||||
if with_gallium_opencl
|
||||
r600_c_args += '-DHAVE_OPENCL'
|
||||
if dep_elf.found()
|
||||
r600_c_args += '-DHAVE_OPENCL'
|
||||
else
|
||||
warning('r600 requires libelf to support opencl.')
|
||||
endif
|
||||
endif
|
||||
|
||||
r600_cpp_args = []
|
||||
|
@@ -40,7 +40,7 @@ using clover::build_error;
|
||||
using namespace clover::llvm;
|
||||
using ::llvm::TargetMachine;
|
||||
|
||||
#ifdef HAVE_CLOVER_NATIVE
|
||||
#if defined(USE_LIBELF)
|
||||
|
||||
#include <libelf.h>
|
||||
#include <gelf.h>
|
||||
|
@@ -44,10 +44,6 @@ 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
|
||||
|
Reference in New Issue
Block a user