From: Marek Olšák Date: Tue, 6 Jun 2023 15:09:11 +0000 (-0400) Subject: amd: drop support for LLVM 13 X-Git-Tag: upstream/23.3.3~7403 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab5662dc6177111c2b7399a61cc15ae5ca8723b9;p=platform%2Fupstream%2Fmesa.git amd: drop support for LLVM 13 We can remove the LLVM 13 Wave32 discard workaround and SI_PROFILE_IGNORE_LLVM13_DISCARD_BUG that disabled the workaround. Reviewed-by: Qiang Yu Reviewed-by: Samuel Pitoiset Part-of: --- diff --git a/meson.build b/meson.build index d86b71e..df925c4 100644 --- a/meson.build +++ b/meson.build @@ -1641,7 +1641,9 @@ if draw_with_llvm llvm_optional_modules += ['lto'] endif -if with_intel_clc or with_amd_vk or with_gallium_radeonsi +if with_amd_vk or with_gallium_radeonsi + _llvm_version = '>= 14.0.0' +elif with_intel_clc _llvm_version = '>= 13.0.0' elif with_gallium_opencl _llvm_version = '>= 11.0.0' diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp index 8ee2475..2802fdf 100644 --- a/src/amd/compiler/aco_print_asm.cpp +++ b/src/amd/compiler/aco_print_asm.cpp @@ -310,7 +310,7 @@ disasm_instr(amd_gfx_level gfx_level, LLVMDisasmContextRef disasm, uint32_t* bin size = l / 4; } -#if LLVM_VERSION_MAJOR <= 14 +#if LLVM_VERSION_MAJOR == 14 /* See: https://github.com/GPUOpen-Tools/radeon_gpu_profiler/issues/65 and * https://github.com/llvm/llvm-project/issues/38652 */ diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 43d911f..d781e36 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -2181,7 +2181,7 @@ static void visit_store_output(struct ac_nir_context *ctx, nir_intrinsic_instr * */ index = LLVMConstInt(ctx->ac.i32, nir_intrinsic_io_semantics(instr).high_16bits, 0); -#if LLVM_VERSION_MAJOR <= 14 +#if LLVM_VERSION_MAJOR == 14 /* To work around old LLVM bug which won't change the output type to * LLVMBuildLoad2 type argument. */ @@ -2669,11 +2669,6 @@ static LLVMValueRef visit_load_shared(struct ac_nir_context *ctx, const nir_intr for (int chan = 0; chan < instr->num_components; chan++) { index = LLVMConstInt(ctx->ac.i32, chan, 0); - #if LLVM_VERSION_MAJOR < 14 - ptr = LLVMBuildBitCast( - ctx->ac.builder, ptr, - LLVMPointerType(elem_type, LLVMGetPointerAddressSpace(LLVMTypeOf(ptr))), ""); - #endif derived_ptr = LLVMBuildGEP2(ctx->ac.builder, elem_type, ptr, &index, 1, ""); values[chan] = LLVMBuildLoad2(ctx->ac.builder, elem_type, derived_ptr, ""); } @@ -2700,11 +2695,6 @@ static void visit_store_shared(struct ac_nir_context *ctx, const nir_intrinsic_i } data = ac_llvm_extract_elem(&ctx->ac, src, chan); index = LLVMConstInt(ctx->ac.i32, chan, 0); - #if LLVM_VERSION_MAJOR < 14 - ptr = LLVMBuildBitCast( - ctx->ac.builder, ptr, - LLVMPointerType(elem_type, LLVMGetPointerAddressSpace(LLVMTypeOf(ptr))), ""); - #endif derived_ptr = LLVMBuildGEP2(builder, elem_type, ptr, &index, 1, ""); LLVMBuildStore(builder, data, derived_ptr); } diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index d62acf2..005331b 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -545,11 +545,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device .EXT_scalar_block_layout = device->rad_info.gfx_level >= GFX7, .EXT_separate_stencil_usage = true, .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_module_identifier = true, diff --git a/src/amd/vulkan/radv_rt_common.c b/src/amd/vulkan/radv_rt_common.c index adaa727..6478350 100644 --- a/src/amd/vulkan/radv_rt_common.c +++ b/src/amd/vulkan/radv_rt_common.c @@ -35,11 +35,6 @@ static nir_ssa_def *build_node_to_addr(struct radv_device *device, nir_builder * bool radv_enable_rt(const struct radv_physical_device *pdevice, bool rt_pipelines) { -#ifdef LLVM_AVAILABLE - if (pdevice->use_llvm && LLVM_VERSION_MAJOR < 14) - return false; -#endif - if (pdevice->rad_info.gfx_level < GFX10_3 && !radv_emulate_rt(pdevice)) return false; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 18c8845..4c5c143 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -299,7 +299,7 @@ enum #define SI_PROFILE_WAVE32 (1 << 0) #define SI_PROFILE_WAVE64 (1 << 1) -#define SI_PROFILE_IGNORE_LLVM13_DISCARD_BUG (1 << 2) +/* bit gap */ #define SI_PROFILE_VS_NO_BINNING (1 << 3) #define SI_PROFILE_PS_NO_BINNING (1 << 4) #define SI_PROFILE_CLAMP_DIV_BY_ZERO (1 << 5) diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c b/src/gallium/drivers/radeonsi/si_shader_info.c index c44ba6e..126be56 100644 --- a/src/gallium/drivers/radeonsi/si_shader_info.c +++ b/src/gallium/drivers/radeonsi/si_shader_info.c @@ -23,11 +23,6 @@ static struct si_shader_profile profiles[] = SI_PROFILE_VS_NO_BINNING, }, { - /* Viewperf/Energy isn't affected by the discard bug. */ - {0x17118671, 0xd0102e0c, 0x947f3592, 0xb2057e7b, 0x4da5d9b0}, - SI_PROFILE_IGNORE_LLVM13_DISCARD_BUG, - }, - { /* Viewperf/Medical */ {0x4dce4331, 0x38f778d5, 0x1b75a717, 0x3e454fb9, 0xeb1527f0}, SI_PROFILE_PS_NO_BINNING, diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index 1daf8ac..927bc83 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -77,14 +77,6 @@ unsigned si_determine_wave_size(struct si_screen *sscreen, struct si_shader *sha return profile_wave_size; } - /* LLVM 13 has a bug that causes compile failures with discard in Wave32 - * in some cases. Alpha test in Wave32 is luckily unaffected. - */ - if (stage == MESA_SHADER_FRAGMENT && info->base.fs.uses_discard && - !(info && info->options & SI_PROFILE_IGNORE_LLVM13_DISCARD_BUG) && - LLVM_VERSION_MAJOR == 13 && !(sscreen->debug_flags & DBG(W32_PS_DISCARD))) - return 64; - /* Debug flags except w32psdiscard don't override the discard bug workaround, * but they override everything else. */