Mesa (main): radv: Support device initialization without LLVM dependencies
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 09:05:43 UTC 2021
Module: Mesa
Branch: main
Commit: 02ee0a0a7f1a264f2df688f1383f0cda8f598610
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=02ee0a0a7f1a264f2df688f1383f0cda8f598610
Author: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
Date: Fri Jul 31 16:38:56 2020 +0200
radv: Support device initialization without LLVM dependencies
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>
---
src/amd/vulkan/radv_device.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 3951c7c36ae..c6fc66be192 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -58,12 +58,15 @@ typedef void *drmDevicePtr;
#include "util/timespec.h"
#include "util/u_atomic.h"
#include "winsys/null/radv_null_winsys_public.h"
-#include "ac_llvm_util.h"
#include "git_sha1.h"
#include "sid.h"
#include "vk_format.h"
#include "vulkan/vk_icd.h"
+#ifdef LLVM_AVAILABLE
+#include "ac_llvm_util.h"
+#endif
+
/* The number of IBs per submit isn't infinite, it depends on the ring type
* (ie. some initial setup needed for a submit) and the number of IBs (4 DW).
* This limit is arbitrary but should be safe for now. Ideally, we should get
@@ -120,8 +123,11 @@ radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
memset(uuid, 0, VK_UUID_SIZE);
_mesa_sha1_init(&ctx);
- if (!disk_cache_get_function_identifier(radv_device_get_cache_uuid, &ctx) ||
- !disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, &ctx))
+ if (!disk_cache_get_function_identifier(radv_device_get_cache_uuid, &ctx)
+#ifdef LLVM_AVAILABLE
+ || !disk_cache_get_function_identifier(LLVMInitializeAMDGPUTargetInfo, &ctx)
+#endif
+ )
return -1;
_mesa_sha1_update(&ctx, &family, sizeof(family));
@@ -305,7 +311,11 @@ radv_get_compiler_string(struct radv_physical_device *pdevice)
return "";
}
+#ifdef LLVM_AVAILABLE
return " (LLVM " MESA_LLVM_VERSION_STRING ")";
+#else
+ unreachable("LLVM is not available");
+#endif
}
int
@@ -504,7 +514,11 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
.EXT_sampler_filter_minmax = true,
.EXT_scalar_block_layout = device->rad_info.chip_class >= GFX7,
.EXT_shader_atomic_float = true,
+#ifdef LLVM_AVAILABLE
.EXT_shader_atomic_float2 = !device->use_llvm || LLVM_VERSION_MAJOR >= 14,
+#else
+ .EXT_shader_atomic_float2 = true,
+#endif
.EXT_shader_demote_to_helper_invocation = true,
.EXT_shader_image_atomic_int64 = true,
.EXT_shader_stencil_export = true,
@@ -653,6 +667,13 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
device->ws->query_info(device->ws, &device->rad_info);
device->use_llvm = instance->debug_flags & RADV_DEBUG_LLVM;
+#ifndef LLVM_AVAILABLE
+ if (device->use_llvm) {
+ fprintf(stderr, "ERROR: LLVM compiler backend selected for radv, but LLVM support was not "
+ "enabled at build time.\n");
+ abort();
+ }
+#endif
snprintf(device->name, sizeof(device->name), "AMD RADV %s%s", device->rad_info.name,
radv_get_compiler_string(device));
More information about the mesa-commit
mailing list