amd: drop support for LLVM 14
authorMarek Olšák <marek.olsak@amd.com>
Tue, 6 Jun 2023 15:40:13 +0000 (11:40 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 7 Jun 2023 19:56:55 +0000 (19:56 +0000)
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/compiler/tests/test_assembler.cpp
src/amd/compiler/tests/test_isel.cpp
src/amd/llvm/ac_llvm_build.c
src/amd/llvm/ac_llvm_helper.cpp
src/amd/llvm/ac_llvm_util.c
src/amd/llvm/ac_nir_to_llvm.c
src/gallium/drivers/radeonsi/si_shader_nir.c

index df925c4..529669f 100644 (file)
@@ -1642,7 +1642,7 @@ if draw_with_llvm
 endif
 
 if with_amd_vk or with_gallium_radeonsi
-  _llvm_version = '>= 14.0.0'
+  _llvm_version = '>= 15.0.0'
 elif with_intel_clc
   _llvm_version = '>= 13.0.0'
 elif with_gallium_opencl
index 2802fdf..226d567 100644 (file)
@@ -310,32 +310,6 @@ disasm_instr(amd_gfx_level gfx_level, LLVMDisasmContextRef disasm, uint32_t* bin
       size = l / 4;
    }
 
-#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
-    */
-   if (invalid) {
-      /* do nothing */
-   } else if (gfx_level == GFX9 && (binary[pos] & 0xfc024000) == 0xc0024000) {
-      /* SMEM with IMM=1 and SOE=1: LLVM ignores SOFFSET */
-      size_t len = strlen(outline);
-
-      char imm[16] = {0};
-      while (outline[--len] != ' ') ;
-      strncpy(imm, outline + len + 1, sizeof(imm) - 1);
-
-      snprintf(outline + len, outline_size - len, " s%u offset:%s", binary[pos + 1] >> 25, imm);
-   } else if (gfx_level >= GFX10 && (binary[pos] & 0xfc000000) == 0xf4000000 &&
-              (binary[pos + 1] & 0xfe000000) != 0xfa000000) {
-      /* SMEM non-NULL SOFFSET: LLVM ignores OFFSET */
-      uint32_t offset = binary[pos + 1] & 0x1fffff;
-      if (offset) {
-         size_t len = strlen(outline);
-         snprintf(outline + len, outline_size - len, " offset:0x%x", offset);
-      }
-   }
-#endif
-
    return std::make_pair(invalid, size);
 }
 
index ad9a406..5f4aac4 100644 (file)
@@ -379,7 +379,6 @@ BEGIN_TEST(assembler.vopc_sdwa)
    }
 END_TEST
 
-#if LLVM_VERSION_MAJOR >= 15
 BEGIN_TEST(assembler.gfx11.smem)
    if (!setup_cs(NULL, GFX11))
       return;
@@ -972,4 +971,3 @@ BEGIN_TEST(assembler.vop3_dpp)
 
    finish_assembler_test();
 END_TEST
-#endif
index ebc8f5b..887f827 100644 (file)
@@ -186,7 +186,6 @@ BEGIN_TEST(isel.sparse.clause)
    }
 END_TEST
 
-#if LLVM_VERSION_MAJOR >= 15
 BEGIN_TEST(isel.discard_early_exit.mrtz)
    QoShaderModuleCreateInfo vs = qoShaderModuleCreateInfoGLSL(VERTEX,
       void main() {}
@@ -235,4 +234,3 @@ BEGIN_TEST(isel.discard_early_exit.mrt0)
    pbld.add_vsfs(vs, fs);
    pbld.print_ir(VK_SHADER_STAGE_FRAGMENT_BIT, "Assembly");
 END_TEST
-#endif
index 32b930a..f7a855e 100644 (file)
@@ -294,12 +294,8 @@ LLVMValueRef ac_build_intrinsic(struct ac_llvm_context *ctx, const char *name,
 
    call = LLVMBuildCall2(ctx->builder, function_type, function, params, param_count, "");
 
-   if (attrib_mask & AC_ATTR_INVARIANT_LOAD) {
-      if (LLVM_VERSION_MAJOR >= 15)
-         LLVMSetMetadata(call, ctx->invariant_load_md_kind, ctx->empty_md);
-      else
-         LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "readnone"));
-   }
+   if (attrib_mask & AC_ATTR_INVARIANT_LOAD)
+      LLVMSetMetadata(call, ctx->invariant_load_md_kind, ctx->empty_md);
 
    if (attrib_mask & AC_ATTR_CONVERGENT)
       LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "convergent"));
@@ -3819,7 +3815,7 @@ struct ac_llvm_pointer ac_build_main(const struct ac_shader_args *args, struct a
    LLVMAddTargetDependentFunctionAttr(main_function, "denormal-fp-math-f32",
                                       "preserve-sign,preserve-sign");
 
-   if (LLVM_VERSION_MAJOR >= 15 && convention == AC_LLVM_AMDGPU_PS) {
+   if (convention == AC_LLVM_AMDGPU_PS) {
       LLVMAddTargetDependentFunctionAttr(main_function, "amdgpu-depth-export",
                                          ctx->exports_mrtz ? "1" : "0");
       LLVMAddTargetDependentFunctionAttr(main_function, "amdgpu-color-export",
index a7cbe45..492d823 100644 (file)
@@ -18,9 +18,7 @@
 #include <llvm/Transforms/IPO/AlwaysInliner.h>
 #include <llvm/Transforms/InstCombine/InstCombine.h>
 #include <llvm/Transforms/IPO/SCCP.h>
-#if LLVM_VERSION_MAJOR >= 15
 #include "llvm/CodeGen/SelectionDAGNodes.h"
-#endif
 
 #include <cstring>
 
@@ -37,7 +35,6 @@
 
 using namespace llvm;
 
-#if LLVM_VERSION_MAJOR >= 15
 class RunAtExitForStaticDestructors : public SDNode
 {
 public:
@@ -46,11 +43,9 @@ public:
    {
    }
 };
-#endif
 
 void ac_llvm_run_atexit_for_destructors(void)
 {
-#if LLVM_VERSION_MAJOR >= 15
    /* LLVM >= 16 registers static variable destructors on the first compile, which gcc
     * implements by calling atexit there. Before that, u_queue registers its atexit
     * handler to kill all threads. Since exit() runs atexit handlers in the reverse order,
@@ -65,7 +60,6 @@ void ac_llvm_run_atexit_for_destructors(void)
     * This just executes the code that declares static variables.
     */
    RunAtExitForStaticDestructors();
-#endif
 }
 
 bool ac_is_llvm_processor_supported(LLVMTargetMachineRef tm, const char *processor)
index fce2755..2854c2d 100644 (file)
@@ -154,7 +154,7 @@ const char *ac_get_llvm_processor_name(enum radeon_family family)
    case CHIP_REMBRANDT:
       return "gfx1035";
    case CHIP_RAPHAEL_MENDOCINO:
-      return LLVM_VERSION_MAJOR >= 15 ? "gfx1036" : "gfx1030";
+      return "gfx1036";
    case CHIP_GFX1100:
       return "gfx1100";
    case CHIP_GFX1101:
index d781e36..6593d06 100644 (file)
@@ -2181,15 +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
-         /* To work around old LLVM bug which won't change the output type to
-          * LLVMBuildLoad2 type argument.
-          */
-         output = LLVMBuildLoad2(ctx->ac.builder, ctx->ac.f32, output_addr, "");
-         output = LLVMBuildBitCast(ctx->ac.builder, output, ctx->ac.v2f16, "");
-#else
          output = LLVMBuildLoad2(ctx->ac.builder, ctx->ac.v2f16, output_addr, "");
-#endif
          output = LLVMBuildInsertElement(ctx->ac.builder, output, value, index, "");
          value = LLVMBuildBitCast(ctx->ac.builder, output, ctx->ac.f32, "");
       }
index f363e8d..5adf4d6 100644 (file)
@@ -92,8 +92,8 @@ void si_nir_opts(struct si_screen *sscreen, struct nir_shader *nir, bool first)
       NIR_PASS(progress, nir, nir_opt_dce);
       /* nir_opt_if_optimize_phi_true_false is disabled on LLVM14 (#6976) */
       NIR_PASS(lower_phis_to_scalar, nir, nir_opt_if,
-         nir_opt_if_aggressive_last_continue |
-            (LLVM_VERSION_MAJOR == 14 ? 0 : nir_opt_if_optimize_phi_true_false));
+               nir_opt_if_aggressive_last_continue |
+               nir_opt_if_optimize_phi_true_false);
       NIR_PASS(progress, nir, nir_opt_dead_cf);
 
       if (lower_alu_to_scalar) {