Mesa (staging/22.0): nir/lower_int64: Fix [iu]mul_high handling
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 02:01:39 UTC 2022
Module: Mesa
Branch: staging/22.0
Commit: f48ba9910a4cd399543c9936e5e3fd1e96944765
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f48ba9910a4cd399543c9936e5e3fd1e96944765
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Fri Apr 8 15:06:11 2022 -0500
nir/lower_int64: Fix [iu]mul_high handling
e551040c602d, which added a new mechanism for 64-bit imul which is more
efficient on BDW and later Intel hardware also introduced a bug where we
weren't properly walking both X and Y. No idea how testing didn't find
this.
Fixes: e551040c602d ("nir/glsl: Add another way of doing lower_imul64 for gen8+"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6306
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15829>
(cherry picked from commit d0ace287902b1fac4a8ddcb91fac65c99218f01b)
---
.pick_status.json | 2 +-
src/compiler/nir/nir_lower_int64.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index e1900d14b60..e249dfe00e6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -412,7 +412,7 @@
"description": "nir/lower_int64: Fix [iu]mul_high handling",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"because_sha": "e551040c602d392019e68f54d9a3a310d2a937a3"
},
{
diff --git a/src/compiler/nir/nir_lower_int64.c b/src/compiler/nir/nir_lower_int64.c
index 7900431ce2d..d5b161206bf 100644
--- a/src/compiler/nir/nir_lower_int64.c
+++ b/src/compiler/nir/nir_lower_int64.c
@@ -455,7 +455,7 @@ lower_mul_high64(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y,
for (unsigned i = 0; i < 4; i++) {
nir_ssa_def *carry = NULL;
for (unsigned j = 0; j < 4; j++) {
- /* The maximum values of x32[i] and y32[i] are UINT32_MAX so the
+ /* The maximum values of x32[i] and y32[j] are UINT32_MAX so the
* maximum value of tmp is UINT32_MAX * UINT32_MAX. The maximum
* value that will fit in tmp is
*
@@ -466,7 +466,7 @@ lower_mul_high64(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y,
* so we're guaranteed that we can add in two more 32-bit values
* without overflowing tmp.
*/
- nir_ssa_def *tmp = nir_umul_2x32_64(b, x32[i], y32[i]);
+ nir_ssa_def *tmp = nir_umul_2x32_64(b, x32[i], y32[j]);
if (res[i + j])
tmp = nir_iadd(b, tmp, nir_u2u64(b, res[i + j]));
More information about the mesa-commit
mailing list