summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonggang Luo <luoyonggang@gmail.com>2022-09-20 23:10:22 +0800
committerMarge Bot <emma+marge@anholt.net>2022-09-22 05:07:35 +0000
commitc74595ead3f431705edc5e32df6b88a259239237 (patch)
treed764e386c69282a84c0d6b742036e7b069bec8e4
parent3f18709f1f9722891c836812875cb0816c578236 (diff)
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>
-rw-r--r--.gitlab-ci/build/gitlab-ci.yml1
-rw-r--r--.gitlab-ci/windows/mesa_build.ps13
-rw-r--r--meson.build17
-rw-r--r--meson_options.txt6
-rw-r--r--src/amd/common/ac_rgp.c4
-rw-r--r--src/amd/common/meson.build2
-rw-r--r--src/amd/vulkan/radv_shader.c10
-rw-r--r--src/gallium/drivers/r600/meson.build6
-rw-r--r--src/gallium/frontends/clover/llvm/codegen/native.cpp2
-rw-r--r--src/gallium/frontends/clover/meson.build4
10 files changed, 23 insertions, 32 deletions
diff --git a/.gitlab-ci/build/gitlab-ci.yml b/.gitlab-ci/build/gitlab-ci.yml
index 9e49814df3a..75f7500cad3 100644
--- a/.gitlab-ci/build/gitlab-ci.yml
+++ b/.gitlab-ci/build/gitlab-ci.yml
@@ -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
diff --git a/.gitlab-ci/windows/mesa_build.ps1 b/.gitlab-ci/windows/mesa_build.ps1
index 326e5268f12..8d40489c3dc 100644
--- a/.gitlab-ci/windows/mesa_build.ps1
+++ b/.gitlab-ci/windows/mesa_build.ps1
@@ -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 `
diff --git a/meson.build b/meson.build
index eb419e410f5..43d14352897 100644
--- a/meson.build
+++ b/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
diff --git a/meson_options.txt b/meson_options.txt
index e83d4762699..95d07964e28 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -182,12 +182,6 @@ option(
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',
value : [],
diff --git a/src/amd/common/ac_rgp.c b/src/amd/common/ac_rgp.c
index 31f236940da..d323b4b846a 100644
--- a/src/amd/common/ac_rgp.c
+++ b/src/amd/common/ac_rgp.c
@@ -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];
diff --git a/src/amd/common/meson.build b/src/amd/common/meson.build
index 10c120b05b5..1262c3a056e 100644
--- a/src/amd/common/meson.build
+++ b/src/amd/common/meson.build
@@ -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',
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 8aecfb94795..52d2e7c24f0 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -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
diff --git a/src/gallium/drivers/r600/meson.build b/src/gallium/drivers/r600/meson.build
index 88181642dfa..a2b644d8688 100644
--- a/src/gallium/drivers/r600/meson.build
+++ b/src/gallium/drivers/r600/meson.build
@@ -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 = []
diff --git a/src/gallium/frontends/clover/llvm/codegen/native.cpp b/src/gallium/frontends/clover/llvm/codegen/native.cpp
index 03166b26d20..2c14ccb5fc3 100644
--- a/src/gallium/frontends/clover/llvm/codegen/native.cpp
+++ b/src/gallium/frontends/clover/llvm/codegen/native.cpp
@@ -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>
diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build
index b7240c9c03f..88761db6b2e 100644
--- a/src/gallium/frontends/clover/meson.build
+++ b/src/gallium/frontends/clover/meson.build
@@ -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