hasvk/elk: stop turning load_push_constants into load_uniform

Those intrinsics have different semantics in particular with regards
to divergence. Turning one into the other without invalidating the
divergence information breaks NIR validation. But also the conversion
means we get artificially less convergent values in the shaders.

So just handle load_push_constants in the backend and stop changing
things in Hasvk.

Fixes a bunch of tests in
   dEQP-VK.descriptor_indexing.*
   dEQP-VK.pipeline.*.push_constant.graphics_pipeline.dynamic_index_*

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34546>
This commit is contained in:
Lionel Landwerlin 2025-05-05 09:05:20 +03:00 committed by Marge Bot
parent df15968813
commit b036d2ded2
3 changed files with 7 additions and 6 deletions

View file

@ -4969,7 +4969,8 @@ fs_nir_emit_intrinsic(nir_to_elk_state &ntb,
break;
}
case nir_intrinsic_load_uniform: {
case nir_intrinsic_load_uniform:
case nir_intrinsic_load_push_constant: {
/* Offsets are in bytes but they should always aligned to
* the type size
*/
@ -7057,4 +7058,3 @@ nir_to_elk(elk_fs_visitor *s)
ralloc_free(ntb.mem_ctx);
}

View file

@ -463,9 +463,9 @@ build_buffer_addr_for_res_index(nir_builder *b,
nir_iadd(b, res.dyn_offset_base, res.array_index);
nir_def *dyn_load =
nir_load_push_constant(b, 1, 32, nir_imul_imm(b, dyn_offset_idx, 4),
.base = offsetof(struct anv_push_constants, dynamic_offsets),
.range = MAX_DYNAMIC_BUFFERS * 4);
nir_load_uniform(b, 1, 32, nir_imul_imm(b, dyn_offset_idx, 4),
.base = offsetof(struct anv_push_constants, dynamic_offsets),
.range = MAX_DYNAMIC_BUFFERS * 4);
nir_def *dynamic_offset =
nir_bcsel(b, nir_ieq_imm(b, res.dyn_offset_base, 0xff),

View file

@ -55,6 +55,7 @@ anv_nir_compute_push_layout(nir_shader *nir,
has_const_ubo = true;
break;
case nir_intrinsic_load_uniform:
case nir_intrinsic_load_push_constant: {
unsigned base = nir_intrinsic_base(intrin);
unsigned range = nir_intrinsic_range(intrin);
@ -131,6 +132,7 @@ anv_nir_compute_push_layout(nir_shader *nir,
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
switch (intrin->intrinsic) {
case nir_intrinsic_load_uniform:
case nir_intrinsic_load_push_constant: {
/* With bindless shaders we load uniforms with SEND
* messages. All the push constants are located after the
@ -139,7 +141,6 @@ anv_nir_compute_push_layout(nir_shader *nir,
* elk_nir_lower_rt_intrinsics.c).
*/
unsigned base_offset = push_start;
intrin->intrinsic = nir_intrinsic_load_uniform;
nir_intrinsic_set_base(intrin,
nir_intrinsic_base(intrin) -
base_offset);