From 3120d28d2d9fa8f93be14477bcd4ba6e6ceb9279 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 1 Feb 2024 10:48:47 -0500 Subject: [PATCH] zink: run sparse lowering after all optimization passes some passes (e.g., opt_shrink_vector) operate on the assumption that sparse tex ops have a certain number of components and then remove components and unset the sparse flag if they can optimize out the sparse usage zink's sparse ops do not have the standard number of components, which causes such passes to make incorrect assumptions and tag them as not being sparse, which breaks everything fix #10540 Fixes: 0d652c0c8db ("zink: shrink vectors during optimization") Part-of: (cherry picked from commit 2085d6043804c316939ac47d6b334007872655b7) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_compiler.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 12c9d4d7e6c..7ea071e1624 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -10194,7 +10194,7 @@ "description": "zink: run sparse lowering after all optimization passes", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "0d652c0c8db33ff80d16f30b2d2e8f4413946338", "notes": null diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 7b1bd87b355..9abcd86760f 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -4018,6 +4018,7 @@ zink_shader_compile(struct zink_screen *screen, bool can_shobj, struct zink_shad zs->can_inline = false; } else if (need_optimize) optimize_nir(nir, zs, true); + NIR_PASS_V(nir, lower_sparse); struct zink_shader_object obj = compile_module(screen, zs, nir, can_shobj, pg); ralloc_free(nir); @@ -5468,7 +5469,6 @@ zink_shader_create(struct zink_screen *screen, struct nir_shader *nir) NIR_PASS_V(nir, lower_basevertex); NIR_PASS_V(nir, lower_baseinstance); - NIR_PASS_V(nir, lower_sparse); NIR_PASS_V(nir, split_bitfields); NIR_PASS_V(nir, nir_lower_frexp); /* TODO: Use the spirv instructions for this. */