intel/fs: Disable sample mask predication for scratch stores
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Thu, 23 Jul 2020 12:15:34 +0000 (15:15 +0300)
committerMarge Bot <eric+marge@anholt.net>
Fri, 25 Sep 2020 09:48:06 +0000 (09:48 +0000)
commit77486db867bd39aa9b76e549c946b0a165fcb21a
tree846dc231751be3389ae156946c5ea69d2f98f3fd
parentcbef2dc7d3ca60df2307d04032395b2beeece2ec
intel/fs: Disable sample mask predication for scratch stores

Scratch stores are being lowered to the instructions with side-effects,
however they should be enabled in fs helper invocations, since they
are produced from operations which don't imply side-effects.

To fix this - we move the decision of whether the sample mask predication
is enable to the point where logical brw instructions are created.

GLSL example of the issue:

 int tmp[1024];
 ...
 do {
   // changes to tmp
 } while (some_condition(tmp))

If `tmp` is lowered to scrach memory, `some_condition` would be
undefined if scratch write is predicated on sample mask, making
possible for the while loop to become infinite and hang the GPU.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3256
Fixes: 53bfcdeecf4c9632e09ee641d2ca02dd9ec25e34
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6056>
src/intel/compiler/brw_eu_defines.h
src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_fs_nir.cpp