pan/bi: Use nir_lower_mem_access_bit_sizes
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 30 Mar 2023 22:00:27 +0000 (18:00 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 13 Apr 2023 01:49:33 +0000 (01:49 +0000)
commit2f2738dc9020d2e46dd0154ee9eb7f1f38481803
tree28cbeabfd8b1c1de1ec1253915215c0152383aad
parent934b0f1add1a843e0ed14f15adbdef2f2c34c88b
pan/bi: Use nir_lower_mem_access_bit_sizes

OpenCL can generate large loads and stores that we can't support, so we need to
lower. We can load/store up to 128-bits in a single go. We currently only handle
up to 32-bit components in the load and no more than vec4, so we split up
accordingly.

It's not clear to me what the requirements are for alignment on Valhall, so we
conservatively generate aligned access, at worst there's a performance penalty
in those cases. I think unaligned access is suppoerted, but likely with a
performance penalty of its own? So in the absence of hard data otherwise, let's
just use natural alignment.

Oddly, this shaves off a tiny bit of ALU in a few compute shaders on Valhall,
all in gfxbench. Seems to just be noise from the RA lottery.

total instructions in shared programs: 2686768 -> 2686756 (<.01%)
instructions in affected programs: 584 -> 572 (-2.05%)
helped: 6
HURT: 0
Instructions are helped.

total cvt in shared programs: 14644.33 -> 14644.14 (<.01%)
cvt in affected programs: 5.77 -> 5.58 (-3.25%)
helped: 6
HURT: 0

total quadwords in shared programs: 1455320 -> 1455312 (<.01%)
quadwords in affected programs: 56 -> 48 (-14.29%)
helped: 1
HURT: 0

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22228>
src/panfrost/compiler/bifrost_compile.c