intel/compiler: Set NoMask on cr0 access for float controls mode
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 7 Dec 2022 20:00:33 +0000 (12:00 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Dec 2022 09:54:09 +0000 (09:54 +0000)
commitbafbe7c23a1cdd8c27ee5ea2da6b0575c53e2c5f
treeba92d4e622016f6206a6979c9807d4fd25cebf79
parentb6616b036f7e8d88be50d46448890b1dee057cbb
intel/compiler: Set NoMask on cr0 access for float controls mode

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 <currojerez@riseup.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20214>
src/intel/compiler/brw_fs_visitor.cpp