intel/nir: Set lower txs with non-zero LOD
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 30 Apr 2021 04:05:08 +0000 (23:05 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 4 May 2021 00:02:43 +0000 (00:02 +0000)
commit05a37e2422080278a668f048cd8bc7a0e4d5d644
treeab8dedbb3b62039a9e7a71737842ce9c3422429e
parent3f36e027d37e28af08b91019df4bf3cdf08bfa2f
intel/nir: Set lower txs with non-zero LOD

There's a recently discovered HW bug affecting hardware at least as far
back as Skylake where, if the LOD is out-of-bounds for any SIMD lane,
then garbage may be returned in all SIMD lanes.  The easy solution is to
set lower_txs_lod so that we always have a constant LOD of 0 which we
know a priori is always in-bounds.  Fortunately, not many shaders
actually use textureSize() with LOD.

Shader-db results on Ice Lake:

    total instructions in shared programs: 19948537 -> 19948564 (<.01%)
    instructions in affected programs: 3859 -> 3886 (0.70%)
    helped: 0
    HURT: 7

One of the shaders is in Civilization: Beyond Earth, and the rest are
all in Civilization VI.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10538>
src/intel/compiler/brw_nir.c