ir3: use ldg.k load size
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

ldg.k can copy up to 256 vec4s at once but we currently emit one ldg.k
per vec4. Fix this by using the load size field of ldg.k.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40947>
This commit is contained in:
Job Noorman 2026-04-14 14:41:20 +02:00 committed by Marge Bot
parent a1272cabe0
commit 118b975ce7

View file

@ -406,10 +406,12 @@ copy_global_to_uniform(nir_shader *nir, struct ir3_ubo_analysis_state *state)
}
unsigned size = (range->end - range->start);
for (unsigned offset = 0; offset < size; offset += 16) {
/* ldg.k can copy at most 256 vec4s. */
for (unsigned offset = 0; offset < size; offset += 256 * 16) {
unsigned const_offset = range->offset / 4 + offset / 4;
nir_copy_global_to_uniform_ir3(b, base, .base = start + offset,
.range_base = const_offset, .range = 1);
nir_copy_global_to_uniform_ir3(
b, base, .base = start + offset, .range_base = const_offset,
.range = MIN2(256, (size - offset) / 16));
}
}