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 <yuq825@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23471>
This commit is contained in:
Marek Olšák
2023-06-06 11:09:11 -04:00
committed by Marge Bot
parent 3a9f8730f5
commit ab5662dc61
8 changed files with 6 additions and 36 deletions

View File

@@ -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'

View File

@@ -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
*/

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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;

View File

@@ -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)

View File

@@ -22,11 +22,6 @@ static struct si_shader_profile profiles[] =
{0x485320cd, 0x87a9ba05, 0x24a60e4f, 0x25aa19f7, 0xf5287451},
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},

View File

@@ -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.
*/