amd: drop support for LLVM 13
authorMarek Olšák <marek.olsak@amd.com>
Tue, 6 Jun 2023 15:09:11 +0000 (11:09 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 7 Jun 2023 19:56:55 +0000 (19:56 +0000)
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>

meson.build
src/amd/compiler/aco_print_asm.cpp
src/amd/llvm/ac_nir_to_llvm.c
src/amd/vulkan/radv_physical_device.c
src/amd/vulkan/radv_rt_common.c
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_shader_info.c
src/gallium/drivers/radeonsi/si_state_shaders.cpp

index d86b71e..df925c4 100644 (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'
index 8ee2475..2802fdf 100644 (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
     */
index 43d911f..d781e36 100644 (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);
    }
index d62acf2..005331b 100644 (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,
index adaa727..6478350 100644 (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;
 
index 18c8845..4c5c143 100644 (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)
index c44ba6e..126be56 100644 (file)
@@ -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,
index 1daf8ac..927bc83 100644 (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.
     */