anv: fix anv_nir_lower_ubo_loads pass

In order to use load_global_const_block_intel we need to ensure the
64bit address in src[0] is uniform. This is not the case in the
vkd3d-proton test_bindless_cbv tests for example.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22624>
(cherry picked from commit 9fb9ae5ac6)
This commit is contained in:
Lionel Landwerlin 2023-04-21 12:29:00 +03:00 committed by Eric Engestrom
parent 3a9a3356d3
commit ddd39dbf89
3 changed files with 10 additions and 2 deletions

View file

@ -1273,7 +1273,7 @@
"description": "anv: fix anv_nir_lower_ubo_loads pass",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -47,7 +47,7 @@ lower_ubo_load_instr(nir_builder *b, nir_instr *instr, UNUSED void *_data)
unsigned byte_size = bit_size / 8;
nir_ssa_def *val;
if (nir_src_is_const(load->src[1])) {
if (!nir_src_is_divergent(load->src[0]) && nir_src_is_const(load->src[1])) {
uint32_t offset = nir_src_as_uint(load->src[1]);
/* Things should be component-aligned. */

View file

@ -884,8 +884,16 @@ anv_pipeline_lower_nir(struct anv_pipeline *pipeline,
NIR_PASS(_, nir, nir_copy_prop);
NIR_PASS(_, nir, nir_opt_constant_folding);
/* Required for nir_divergence_analysis() which is needed for
* anv_nir_lower_ubo_loads.
*/
NIR_PASS(_, nir, nir_convert_to_lcssa, true, true);
nir_divergence_analysis(nir);
NIR_PASS(_, nir, anv_nir_lower_ubo_loads);
NIR_PASS(_, nir, nir_opt_remove_phis);
enum nir_lower_non_uniform_access_type lower_non_uniform_access_types =
nir_lower_non_uniform_texture_access | nir_lower_non_uniform_image_access;