mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 00:49:04 +02:00
aco/gfx12: implement broadcast dmask shrink behavior
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26897>
This commit is contained in:
parent
4a6ee2c483
commit
71edf4de5e
1 changed files with 13 additions and 5 deletions
|
|
@ -6411,15 +6411,23 @@ visit_image_store(isel_context* ctx, nir_intrinsic_instr* instr)
|
|||
((access & (ACCESS_VOLATILE | ACCESS_COHERENT)) && ctx->program->gfx_level < GFX11);
|
||||
|
||||
uint32_t dmask = BITFIELD_MASK(num_components);
|
||||
/* remove zero/undef elements from data, components which aren't in dmask
|
||||
* are zeroed anyway
|
||||
*/
|
||||
if (instr->src[3].ssa->bit_size == 32 || instr->src[3].ssa->bit_size == 16) {
|
||||
for (uint32_t i = 0; i < instr->num_components; i++) {
|
||||
/* components not in dmask receive:
|
||||
* GFX6-11.5: zero
|
||||
* GFX12+: first component in dmask
|
||||
*/
|
||||
nir_scalar comp = nir_scalar_resolved(instr->src[3].ssa, i);
|
||||
if ((nir_scalar_is_const(comp) && nir_scalar_as_uint(comp) == 0) ||
|
||||
nir_scalar_is_undef(comp))
|
||||
if (nir_scalar_is_undef(comp)) {
|
||||
dmask &= ~BITFIELD_BIT(i);
|
||||
} else if (ctx->options->gfx_level <= GFX11_5) {
|
||||
if (nir_scalar_is_const(comp) && nir_scalar_as_uint(comp) == 0)
|
||||
dmask &= ~BITFIELD_BIT(i);
|
||||
} else {
|
||||
unsigned first = dim == GLSL_SAMPLER_DIM_BUF ? 0 : ffs(dmask) - 1;
|
||||
if (i != first && nir_scalar_equal(nir_scalar_resolved(instr->src[3].ssa, first), comp))
|
||||
dmask &= ~BITFIELD_BIT(i);
|
||||
}
|
||||
}
|
||||
|
||||
/* dmask cannot be 0, at least one vgpr is always read */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue