Mesa (master): radv: call nir_opt_algebraic_late() after lowering idiv for small bitsizes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 12 16:23:58 UTC 2021


Module: Mesa
Branch: master
Commit: 987a0e6a67c856be207364ada4b838073710ba7d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=987a0e6a67c856be207364ada4b838073710ba7d

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Mon Jan 11 14:34:26 2021 +0100

radv: call nir_opt_algebraic_late() after lowering idiv for small bitsizes

This is needed because lower_idiv() introduces ineg again
which we'll remove next.

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8425>

---

 src/amd/vulkan/radv_pipeline.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index dfd697d5f9a..0e5ea1981dd 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -3367,9 +3367,11 @@ VkResult radv_create_shaders(struct radv_pipeline *pipeline,
 				}
 
 				if (nir_lower_bit_size(nir[i], lower_bit_size_callback, device)) {
-					nir_lower_idiv(nir[i], nir_lower_idiv_precise);
-					nir_opt_constant_folding(nir[i]);
-					nir_opt_dce(nir[i]);
+					// TODO: lower idiv beforehand
+					if (nir_lower_idiv(nir[i], nir_lower_idiv_precise))
+						NIR_PASS_V(nir[i], nir_opt_algebraic_late); /* needed for removing ineg again */
+					NIR_PASS_V(nir[i], nir_opt_constant_folding);
+					NIR_PASS_V(nir[i], nir_opt_dce);
 				}
 
 				if (device->physical_device->rad_info.chip_class >= GFX8)



More information about the mesa-commit mailing list