diff options
author | Eric Engestrom <[email protected]> | 2019-08-28 00:06:03 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2019-09-06 22:26:29 +0100 |
commit | 19d9e57f2c0c3e6cd9809dbc6ef65eab163ee255 (patch) | |
tree | bd3a0e3b9cb58cc0354639b2ce0f6c65485ba1aa /src/amd | |
parent | bce9c05ca8820bb0f31976e35674485b2ec15a8d (diff) |
amd: replace major llvm version checks with LLVM_VERSION_MAJOR
Signed-off-by: Eric Engestrom <[email protected]>
Acked-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 17 | ||||
-rw-r--r-- | src/amd/common/ac_llvm_util.h | 3 | ||||
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 12 | ||||
-rw-r--r-- | src/amd/vulkan/radv_device.c | 9 | ||||
-rw-r--r-- | src/amd/vulkan/radv_extensions.py | 2 | ||||
-rw-r--r-- | src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 3 |
6 files changed, 26 insertions, 20 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index f4d91567fa1..94ec569ad9f 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -26,6 +26,7 @@ #include "ac_llvm_build.h" #include <llvm-c/Core.h> +#include <llvm/Config/llvm-config.h> #include "c11/threads.h" @@ -443,7 +444,7 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx, LLVMValueRef ac_build_shader_clock(struct ac_llvm_context *ctx) { - const char *intr = HAVE_LLVM >= 0x0900 && ctx->chip_class >= GFX8 ? + const char *intr = LLVM_VERSION_MAJOR >= 9 && ctx->chip_class >= GFX8 ? "llvm.amdgcn.s.memrealtime" : "llvm.readcyclecounter"; LLVMValueRef tmp = ac_build_intrinsic(ctx, intr, ctx->i64, NULL, 0, 0); return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, ""); @@ -455,7 +456,7 @@ ac_build_ballot(struct ac_llvm_context *ctx, { const char *name; - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { if (ctx->wave_size == 64) name = "llvm.amdgcn.icmp.i64.i32"; else @@ -485,7 +486,7 @@ ac_build_ballot(struct ac_llvm_context *ctx, LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx, LLVMValueRef value) { - const char *name = HAVE_LLVM >= 0x900 ? "llvm.amdgcn.icmp.i64.i1" : "llvm.amdgcn.icmp.i1"; + const char *name = LLVM_VERSION_MAJOR >= 9 ? "llvm.amdgcn.icmp.i64.i1" : "llvm.amdgcn.icmp.i1"; LLVMValueRef args[3] = { value, ctx->i1false, @@ -1511,7 +1512,7 @@ ac_build_tbuffer_load_short(struct ac_llvm_context *ctx, { LLVMValueRef res; - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, ""); /* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */ @@ -1543,7 +1544,7 @@ ac_build_tbuffer_load_byte(struct ac_llvm_context *ctx, { LLVMValueRef res; - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, ""); /* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */ @@ -1685,7 +1686,7 @@ ac_build_opencoded_load_format(struct ac_llvm_context *ctx, load_log_size += -log_recombine; } - assert(load_log_size >= 2 || HAVE_LLVM >= 0x0900); + assert(load_log_size >= 2 || LLVM_VERSION_MAJOR >= 9); LLVMValueRef loads[32]; /* up to 32 bytes */ for (unsigned i = 0; i < load_num_channels; ++i) { @@ -1955,7 +1956,7 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx, { vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i16, ""); - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { /* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */ ac_build_buffer_store_common(ctx, rsrc, vdata, NULL, voffset, soffset, 1, @@ -1982,7 +1983,7 @@ ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx, { vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i8, ""); - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { /* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */ ac_build_buffer_store_common(ctx, rsrc, vdata, NULL, voffset, soffset, 1, diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h index 8209b6dcabc..60c9a17e447 100644 --- a/src/amd/common/ac_llvm_util.h +++ b/src/amd/common/ac_llvm_util.h @@ -28,6 +28,7 @@ #include <stdbool.h> #include <llvm-c/TargetMachine.h> +#include <llvm/Config/llvm-config.h> #include "amd_family.h" @@ -152,7 +153,7 @@ ac_has_vec3_support(enum chip_class chip, bool use_format) return false; } - return HAVE_LLVM >= 0x900; + return LLVM_VERSION_MAJOR >= 9; } #ifdef __cplusplus diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 13578770d4a..5ed21b1650b 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -21,6 +21,8 @@ * IN THE SOFTWARE. */ +#include <llvm/Config/llvm-config.h> + #include "ac_nir_to_llvm.h" #include "ac_llvm_build.h" #include "ac_llvm_util.h" @@ -1806,7 +1808,7 @@ static LLVMValueRef visit_atomic_ssbo(struct ac_nir_context *ctx, params[arg_count++] = ac_llvm_extract_elem(&ctx->ac, get_src(ctx, instr->src[2]), 0); params[arg_count++] = descriptor; - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { /* XXX: The new raw/struct atomic intrinsics are buggy with * LLVM 8, see r358579. */ @@ -2546,7 +2548,7 @@ static LLVMValueRef get_image_buffer_descriptor(struct ac_nir_context *ctx, bool write, bool atomic) { LLVMValueRef rsrc = get_image_descriptor(ctx, instr, AC_DESC_BUFFER, write); - if (ctx->ac.chip_class == GFX9 && HAVE_LLVM < 0x900 && atomic) { + if (ctx->ac.chip_class == GFX9 && LLVM_VERSION_MAJOR < 9 && atomic) { LLVMValueRef elem_count = LLVMBuildExtractElement(ctx->ac.builder, rsrc, LLVMConstInt(ctx->ac.i32, 2, 0), ""); LLVMValueRef stride = LLVMBuildExtractElement(ctx->ac.builder, rsrc, LLVMConstInt(ctx->ac.i32, 1, 0), ""); stride = LLVMBuildLShr(ctx->ac.builder, stride, LLVMConstInt(ctx->ac.i32, 16, 0), ""); @@ -2791,7 +2793,7 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx, params[param_count++] = LLVMBuildExtractElement(ctx->ac.builder, get_src(ctx, instr->src[1]), ctx->ac.i32_0, ""); /* vindex */ params[param_count++] = ctx->ac.i32_0; /* voffset */ - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { /* XXX: The new raw/struct atomic intrinsics are buggy * with LLVM 8, see r358579. */ @@ -3052,7 +3054,7 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx, LLVMValueRef result; LLVMValueRef src = get_src(ctx, instr->src[src_idx]); - const char *sync_scope = HAVE_LLVM >= 0x0900 ? "workgroup-one-as" : "workgroup"; + const char *sync_scope = LLVM_VERSION_MAJOR >= 9 ? "workgroup-one-as" : "workgroup"; if (instr->intrinsic == nir_intrinsic_shared_atomic_comp_swap || instr->intrinsic == nir_intrinsic_deref_atomic_comp_swap) { @@ -4723,7 +4725,7 @@ setup_constant_data(struct ac_nir_context *ctx, * the code sections. See https://reviews.llvm.org/D65813. */ unsigned address_space = - HAVE_LLVM < 0x1000 ? AC_ADDR_SPACE_GLOBAL : AC_ADDR_SPACE_CONST; + LLVM_VERSION_MAJOR < 10 ? AC_ADDR_SPACE_GLOBAL : AC_ADDR_SPACE_CONST; LLVMValueRef global = LLVMAddGlobalInAddressSpace(ctx->ac.module, type, diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 265a7bd7912..b9d6ccc4c03 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -29,6 +29,7 @@ #include <string.h> #include <unistd.h> #include <fcntl.h> +#include <llvm/Config/llvm-config.h> #include "radv_debug.h" #include "radv_private.h" #include "radv_shader.h" @@ -531,7 +532,7 @@ radv_handle_per_app_options(struct radv_instance *instance, * load/store memory operations. * See https://reviews.llvm.org/D61313 */ - if (HAVE_LLVM < 0x900) + if (LLVM_VERSION_MAJOR < 9) instance->debug_flags |= RADV_DEBUG_NO_LOAD_STORE_OPT; } else if (!strcmp(name, "Wolfenstein: Youngblood")) { if (!(instance->debug_flags & RADV_DEBUG_NO_SHADER_BALLOT)) { @@ -857,7 +858,7 @@ void radv_GetPhysicalDeviceFeatures2( features->storageBuffer16BitAccess = enabled; features->uniformAndStorageBuffer16BitAccess = enabled; features->storagePushConstant16 = enabled; - features->storageInputOutput16 = enabled && HAVE_LLVM >= 0x900; + features->storageInputOutput16 = enabled && LLVM_VERSION_MAJOR >= 9; break; } case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: { @@ -963,8 +964,8 @@ void radv_GetPhysicalDeviceFeatures2( case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR: { VkPhysicalDeviceShaderAtomicInt64FeaturesKHR *features = (VkPhysicalDeviceShaderAtomicInt64FeaturesKHR *)ext; - features->shaderBufferInt64Atomics = HAVE_LLVM >= 0x0900; - features->shaderSharedInt64Atomics = HAVE_LLVM >= 0x0900; + features->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9; + features->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9; break; } case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT: { diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index 34d63ed90c3..4bb4c4dfc23 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -85,7 +85,7 @@ EXTENSIONS = [ Extension('VK_KHR_relaxed_block_layout', 1, True), Extension('VK_KHR_sampler_mirror_clamp_to_edge', 1, True), Extension('VK_KHR_sampler_ycbcr_conversion', 1, True), - Extension('VK_KHR_shader_atomic_int64', 1, 'HAVE_LLVM >= 0x0900'), + Extension('VK_KHR_shader_atomic_int64', 1, 'LLVM_VERSION_MAJOR >= 9'), Extension('VK_KHR_shader_draw_parameters', 1, True), Extension('VK_KHR_shader_float16_int8', 1, True), Extension('VK_KHR_storage_buffer_storage_class', 1, True), diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c index 7e861736f23..c85bbe4cee8 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c @@ -33,6 +33,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <llvm/Config/llvm-config.h> #include <amdgpu_drm.h> #include <assert.h> #include "radv_amdgpu_cs.h" @@ -46,7 +47,7 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd) return false; /* LLVM 9.0 is required for GFX10. */ - if (ws->info.chip_class == GFX10 && HAVE_LLVM < 0x0900) { + if (ws->info.chip_class == GFX10 && LLVM_VERSION_MAJOR < 9) { fprintf(stderr, "radv: Navi family support requires LLVM 9 or higher\n"); return false; } |