nir: Add an alignment to nir_intrinsic_load_constant
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 8 Apr 2020 20:08:03 +0000 (15:08 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 16 Apr 2020 17:00:13 +0000 (17:00 +0000)
commit33eb43349e8c3e8216f51ec838d9b9ab23361873
treeccd01ca1b2b5c6e1448ccec4627538f653601a7e
parent8cbeb13704a59034ffe19a7ffef7b3856a1733e8
nir: Add an alignment to nir_intrinsic_load_constant

In f1883cc73d4 we tried to pass through alignments from load_constant
intrinsics when rewriting them to load_ubo in iris.  However, those
intrinsics don't have ALIGN_MUL or ALIGN_OFFSET indices.  It's easy
enough to add them.  We just call the size/align function on the vector
type at the end of our deref chain and use the alignment returned from
there.  It's possible we could do better by walking the whole deref
chain but this should be good enough.

Fixes: f1883cc73d4 "iris: Set alignments on cbuf0 and constant reads"
Closes: #2739
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4468>
src/compiler/nir/nir_intrinsics.py
src/compiler/nir/nir_opt_large_constants.c
src/compiler/nir/nir_validate.c