About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaith Ekstrand <faith.ekstrand@collabora.com>2025-11-05 14:02:24 -0500
committerMarge Bot <marge-bot@fdo.invalid>2025-11-06 14:57:31 +0000
commit949a4458eab131e732fe04633b83cf02c54c7b19 (patch)
treea915d06108809a4457dca26049773f868743561e
parent0fae56e100251d2e31c9715a31f768549dc2934b (diff)
pan/bi: Call constant folding in postprocess()
The comment explicitly calls out pan_nir_lower_store_component(), which is in a different function call so it's a bit weird to have it in the caller. Also, we already do this in postprocess() on midgard so it makes more sense to just move it into bifrost. Reviewed-by: Olivia Lee <olivia.lee@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38265>
-rw-r--r--src/gallium/drivers/panfrost/pan_shader.c6
-rw-r--r--src/panfrost/compiler/bifrost_compile.c5
-rw-r--r--src/panfrost/vulkan/panvk_vX_shader.c6
3 files changed, 5 insertions, 12 deletions
diff --git a/src/gallium/drivers/panfrost/pan_shader.c b/src/gallium/drivers/panfrost/pan_shader.c
index 733b2c9c374..5c714c09d17 100644
--- a/src/gallium/drivers/panfrost/pan_shader.c
+++ b/src/gallium/drivers/panfrost/pan_shader.c
@@ -519,12 +519,6 @@ panfrost_create_shader_state(struct pipe_context *pctx,
if (dev->arch >= 6 && nir->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS(_, nir, pan_nir_lower_noperspective_fs);
- /* nir_lower[_explicit]_io is lazy and emits mul+add chains even for
- * offsets it could figure out are constant. Do some constant folding
- * before bifrost_nir_lower_store_component below.
- */
- NIR_PASS(_, nir, nir_opt_constant_folding);
-
pan_shader_postprocess(nir, panfrost_device_gpu_id(dev));
if (nir->info.stage == MESA_SHADER_FRAGMENT)
diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c
index 9de6adbc411..8204688783d 100644
--- a/src/panfrost/compiler/bifrost_compile.c
+++ b/src/panfrost/compiler/bifrost_compile.c
@@ -6014,6 +6014,11 @@ bifrost_postprocess_nir(nir_shader *nir, unsigned gpu_id)
VARYING_BIT_PSIZ, false);
}
+ /* nir_lower[_explicit]_io is lazy and emits mul+add chains even
+ * for offsets it could figure out are constant. Do some
+ * constant folding before pan_nir_lower_store_component below.
+ */
+ NIR_PASS(_, nir, nir_opt_constant_folding);
NIR_PASS(_, nir, pan_nir_lower_store_component);
}
diff --git a/src/panfrost/vulkan/panvk_vX_shader.c b/src/panfrost/vulkan/panvk_vX_shader.c
index ca1e2e0bd0f..ba3f04e287a 100644
--- a/src/panfrost/vulkan/panvk_vX_shader.c
+++ b/src/panfrost/vulkan/panvk_vX_shader.c
@@ -927,12 +927,6 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
if (nir->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS(_, nir, pan_nir_lower_noperspective_fs);
- /* nir_lower[_explicit]_io is lazy and emits mul+add chains even for
- * offsets it could figure out are constant. Do some constant folding
- * before bifrost_nir_lower_store_component below.
- */
- NIR_PASS(_, nir, nir_opt_constant_folding);
-
pan_shader_postprocess(nir, compile_input->gpu_id);
if (stage == MESA_SHADER_VERTEX)