diff options
author | Kenneth Graunke <[email protected]> | 2020-03-27 02:05:56 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2020-04-22 21:22:36 -0700 |
commit | 155bb74ea965e9b686a6bce89c7a77065f41755f (patch) | |
tree | a5ff3320dcdf4a71ceaec09f1a278ab5535c5da2 /src/mesa/vbo | |
parent | 51c1c4d95a05b6eb6fce74e8d624615e4a1b38ab (diff) |
nir: Actually do load/store vectorization beyond vec2
nir_opt_load_store_vectorize has an is_strided_vector() function that
looks for types with weird explicit strides. It does so by comparing
the explicit stride against the type-size-derived typical stride.
This had a subtle bug. Simple vector types (vec2/3/4) have no explicit
stride, so glsl_get_explicit_stride() returns 0. This never matches the
typical stride for a vector, so is_strided_vector() would return true
for basically any vector type, causing the vectorizer to bail.
I found this by looking at a compute shader with scalar SSBO loads at
offsets 0x220, 0x224, 0x228, 0x22c. nir_opt_load_store_vectorize would
properly vectorize the first two into a vec2 load, but would refuse to
extend it to a vec3 and ultimately vec4 load because is_strided_vector()
saw a vec2 and freaked out.
Neither ACO nor ANV do load/store vectorization before lowering derefs,
so this shouldn't affect them. However, I'd like to fix this bug to
avoid the trap for anyone who decides to in the future. In a branch
where anv used this lowering, this cut an additional 38% of the send
messages in the shader by properly vectorizing more things.
Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4255>
Diffstat (limited to 'src/mesa/vbo')
0 files changed, 0 insertions, 0 deletions