ac/nir/lower_ngg: don't use gfx12 xfb defs outside their basic block on gfx11

Move the defs after nir_pop_if and phis and inside the gfx12 branch.

Fixes: 1ea96a47cd - ac/nir/lower_ngg: use voffset in global_atomic_add for xfb

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29564>
This commit is contained in:
Marek Olšák 2024-06-05 23:35:47 -04:00
parent ea99c3fcb9
commit 1b9ce2625f

View file

@ -1881,9 +1881,7 @@ ngg_build_streamout_buffer_info(nir_builder *b,
workgroup_buffer_sizes[buffer] = undef;
}
nir_def *buffer_offsets = NULL;
nir_def *xfb_state_address = nir_load_xfb_state_address_gfx12_amd(b);
nir_def *xfb_voffset = nir_imul_imm(b, tid_in_tg, 8);
nir_def *buffer_offsets = NULL, *xfb_state_address = NULL, *xfb_voffset = NULL;
/* Get current global offset of buffer and increase by amount of
* workgroup buffer size. This is an ordered operation sorted by
@ -1895,6 +1893,10 @@ ngg_build_streamout_buffer_info(nir_builder *b,
for (unsigned buffer = 0; buffer < 4; buffer++)
workgroup_buffer_sizes[buffer] = nir_if_phi(b, workgroup_buffer_sizes[buffer], undef);
/* These must be set after nir_pop_if and phis. */
xfb_state_address = nir_load_xfb_state_address_gfx12_amd(b);
xfb_voffset = nir_imul_imm(b, tid_in_tg, 8);
nir_if *if_4lanes = nir_push_if(b, nir_ult_imm(b, tid_in_tg, 4));
{
/* Move workgroup buffer sizes from SGPRs to the first 4 lanes. */