From bafbe7c23a1cdd8c27ee5ea2da6b0575c53e2c5f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 7 Dec 2022 12:00:33 -0800 Subject: [PATCH] intel/compiler: Set NoMask on cr0 access for float controls mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is trying to clear a bit in the control register. However, it's executing with whatever channel mask happens to be active. Typically this is the one at the start of the program, so at least some channels will be active. Typically the first channel will be active due to packed dispatch, but that's not always guaranteed. Without NoMask, the float controls writes may randomly not happen. Recent GPUs also seem to have a hang issue when the first instruction in the shader doesn't have any active channels. Having an instruction with NoMask at the start of the program works around the issue. See HSD bug 14017989577. In our case, the float controls preamble was breaking that restriction every time, causing us to run into this problem frequently. Thanks to Tapani Pälli for finding this hang issue, and Francisco Jerez and Lionel Landwerlin for helping pinpoint this issue during review of a workaround patch in !20194. Fixes GPU hangs in Elder Scrolls Online, Witcher 3, and likely more. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7639 Fixes: 9da56ffc522 ("i965/fs: add emit_shader_float_controls_execution_mode() and aux functions") Reviewed-by: Francisco Jerez Reviewed-by: Lionel Landwerlin Reviewed-by: Tapani Pälli Part-of: --- src/intel/compiler/brw_fs_visitor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_fs_visitor.cpp b/src/intel/compiler/brw_fs_visitor.cpp index 8075076ece5..eb0e56c693f 100644 --- a/src/intel/compiler/brw_fs_visitor.cpp +++ b/src/intel/compiler/brw_fs_visitor.cpp @@ -269,7 +269,8 @@ fs_visitor::emit_shader_float_controls_execution_mode() if (execution_mode == FLOAT_CONTROLS_DEFAULT_FLOAT_CONTROL_MODE) return; - fs_builder abld = bld.annotate("shader floats control execution mode"); + fs_builder ubld = bld.exec_all().group(1, 0); + fs_builder abld = ubld.annotate("shader floats control execution mode"); unsigned mask, mode = brw_rnd_mode_from_nir(execution_mode, &mask); if (mask == 0)