ac/nir: mark all input loads as reorderable and speculatable (for LICM)
These are only memory loads. We could do the same for LDS loads, which are not truly speculatable in merged shaders (can't be moved before the barrier), but that's fine because LICM only moves code out of loops, which can't have barriers. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35950>
This commit is contained in:
@@ -54,7 +54,8 @@ ac_nir_create_gs_copy_shader(const nir_shader *gs_nir, ac_nir_lower_legacy_gs_op
|
||||
out->outputs[i][j] =
|
||||
nir_load_buffer_amd(&b, 1, 32, gsvs_ring, vtx_offset, zero, zero,
|
||||
.base = base,
|
||||
.access = ACCESS_COHERENT | ACCESS_NON_TEMPORAL);
|
||||
.access = ACCESS_COHERENT | ACCESS_NON_TEMPORAL |
|
||||
ACCESS_CAN_REORDER | ACCESS_CAN_SPECULATE);
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,13 +64,15 @@ emit_split_buffer_load(nir_builder *b, unsigned num_components, unsigned bit_siz
|
||||
for (unsigned i = 0; i < full_dwords; ++i)
|
||||
comps[i] = nir_load_buffer_amd(b, 1, 32, desc, v_off, s_off, zero,
|
||||
.base = component_stride * i, .memory_modes = nir_var_shader_in,
|
||||
.access = ACCESS_COHERENT);
|
||||
.access = ACCESS_COHERENT | ACCESS_CAN_REORDER |
|
||||
ACCESS_CAN_SPECULATE);
|
||||
|
||||
if (remaining_bytes)
|
||||
comps[full_dwords] = nir_load_buffer_amd(b, 1, remaining_bytes * 8, desc, v_off, s_off, zero,
|
||||
.base = component_stride * full_dwords,
|
||||
.memory_modes = nir_var_shader_in,
|
||||
.access = ACCESS_COHERENT);
|
||||
.access = ACCESS_COHERENT | ACCESS_CAN_REORDER |
|
||||
ACCESS_CAN_SPECULATE);
|
||||
|
||||
return nir_extract_bits(b, comps, full_dwords + !!remaining_bytes, 0, num_components, bit_size);
|
||||
}
|
||||
|
||||
@@ -1499,7 +1499,8 @@ lower_tes_input_load(nir_builder *b,
|
||||
nir_def *load = NULL;
|
||||
|
||||
AC_NIR_LOAD_IO(load, b, intrin->def.num_components, intrin->def.bit_size, io_sem.high_16bits,
|
||||
nir_load_buffer_amd, offchip_ring, off, offchip_offset, zero, .access = ACCESS_COHERENT,
|
||||
nir_load_buffer_amd, offchip_ring, off, offchip_offset, zero,
|
||||
.access = ACCESS_COHERENT | ACCESS_CAN_REORDER | ACCESS_CAN_SPECULATE,
|
||||
.memory_modes = nir_var_shader_in);
|
||||
|
||||
return load;
|
||||
|
||||
Reference in New Issue
Block a user