Skip to content
Snippets Groups Projects
Commit ac78b12e authored by Marek Olšák's avatar Marek Olšák Committed by Marge Bot
Browse files

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: mesa/mesa#4439



Cc: 20.3 21.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: default avatarPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <mesa/mesa!9795>
parent 57916fbd
No related branches found
No related tags found
Loading
......@@ -196,13 +196,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 =
......
......@@ -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),
......
......@@ -142,8 +142,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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment