Mesa (staging/21.0): ac/llvm: don't set unsupported xnack options to fix LLVM crashes on gfx6-8

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 6 17:35:37 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: 816fd2cf5f0c811b1baf0eb2c5a7bd3267f5b4e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=816fd2cf5f0c811b1baf0eb2c5a7bd3267f5b4e7

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Mar 28 07:46:25 2021 -0400

ac/llvm: don't set unsupported xnack options to fix LLVM crashes on gfx6-8

LLVM prints an error if xnack is unsupported and it uses a global stream
object that is not thread-safe. Since Mesa uses multiple threads to compile
shaders, there is a small chance that it will crash.

Just don't set any xnack options to use LLVM defaults.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4439

Cc: 20.3 21.0 <mesa-stable at lists.freedesktop.org>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9795>
(cherry picked from commit ac78b12e2307565adff436e101b5a8dba61a64b3)

---

 .pick_status.json                      | 2 +-
 src/amd/llvm/ac_llvm_util.c            | 4 +---
 src/amd/llvm/ac_llvm_util.h            | 2 --
 src/gallium/drivers/radeonsi/si_pipe.c | 2 --
 4 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 86d931c77ce..e2525e57d14 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1120,7 +1120,7 @@
         "description": "ac/llvm: don't set unsupported xnack options to fix LLVM crashes on gfx6-8",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/llvm/ac_llvm_util.c b/src/amd/llvm/ac_llvm_util.c
index 503b19c245e..bac6c1d65e8 100644
--- a/src/amd/llvm/ac_llvm_util.c
+++ b/src/amd/llvm/ac_llvm_util.c
@@ -194,13 +194,11 @@ static LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family,
    const char *triple = (tm_options & AC_TM_SUPPORTS_SPILL) ? "amdgcn-mesa-mesa3d" : "amdgcn--";
    LLVMTargetRef target = ac_get_llvm_target(triple);
 
-   snprintf(features, sizeof(features), "+DumpCode%s%s%s%s%s",
+   snprintf(features, sizeof(features), "+DumpCode%s%s%s",
             LLVM_VERSION_MAJOR >= 11 ? "" : ",-fp32-denormals,+fp64-denormals",
             family >= CHIP_NAVI10 && !(tm_options & AC_TM_WAVE32)
                ? ",+wavefrontsize64,-wavefrontsize32"
                : "",
-            family <= CHIP_NAVI14 && tm_options & AC_TM_FORCE_ENABLE_XNACK ? ",+xnack" : "",
-            family <= CHIP_NAVI14 && tm_options & AC_TM_FORCE_DISABLE_XNACK ? ",-xnack" : "",
             tm_options & AC_TM_PROMOTE_ALLOCA_TO_SCRATCH ? ",-promote-alloca" : "");
 
    LLVMTargetMachineRef tm =
diff --git a/src/amd/llvm/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h
index 149478d60f7..0e25bcc5fef 100644
--- a/src/amd/llvm/ac_llvm_util.h
+++ b/src/amd/llvm/ac_llvm_util.h
@@ -62,8 +62,6 @@ enum ac_func_attr
 enum ac_target_machine_options
 {
    AC_TM_SUPPORTS_SPILL = (1 << 0),
-   AC_TM_FORCE_ENABLE_XNACK = (1 << 1),
-   AC_TM_FORCE_DISABLE_XNACK = (1 << 2),
    AC_TM_PROMOTE_ALLOCA_TO_SCRATCH = (1 << 3),
    AC_TM_CHECK_IR = (1 << 4),
    AC_TM_ENABLE_GLOBAL_ISEL = (1 << 5),
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index fdee2c509a2..90fca0b6c38 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -140,8 +140,6 @@ void si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compil
 
    enum ac_target_machine_options tm_options =
       (sscreen->debug_flags & DBG(GISEL) ? AC_TM_ENABLE_GLOBAL_ISEL : 0) |
-      (sscreen->info.chip_class <= GFX8 ? AC_TM_FORCE_DISABLE_XNACK :
-       sscreen->info.chip_class <= GFX10 ? AC_TM_FORCE_ENABLE_XNACK : 0) |
       (!sscreen->llvm_has_working_vgpr_indexing ? AC_TM_PROMOTE_ALLOCA_TO_SCRATCH : 0) |
       (sscreen->debug_flags & DBG(CHECK_IR) ? AC_TM_CHECK_IR : 0) |
       (create_low_opt_compiler ? AC_TM_CREATE_LOW_OPT : 0);



More information about the mesa-commit mailing list