Mesa (staging/21.0): pan/mdg: Fix spilling when scratch memory is used

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 20 17:22:35 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: be774d182524e2c4a4c73a153f01643a8559065e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=be774d182524e2c4a4c73a153f01643a8559065e

Author: Icecream95 <ixn at disroot.org>
Date:   Sun Jan  3 22:03:57 2021 +1300

pan/mdg: Fix spilling when scratch memory is used

Add the tls_size from NIR before spilling so that it doesn't alias
with spill slots.

Fixes: 152bc5d15e1 ("pan/mdg: Support loads and stores to scratch memory")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
(cherry picked from commit a8c91f15f0339bf03fae5b0712e4a657f8d09c72)

---

 .pick_status.json                 | 2 +-
 src/panfrost/midgard/midgard_ra.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index a32c116e7d7..c5868b3ffe7 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -175,7 +175,7 @@
         "description": "pan/mdg: Fix spilling when scratch memory is used",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "152bc5d15e1a3a6685dfd6bf955c9b4d66eaacb8"
     },
diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c
index 04be27da50e..72c06ade683 100644
--- a/src/panfrost/midgard/midgard_ra.c
+++ b/src/panfrost/midgard/midgard_ra.c
@@ -1011,7 +1011,7 @@ mir_ra(compiler_context *ctx)
         int iter_count = 1000; /* max iterations */
 
         /* Number of 128-bit slots in memory we've spilled into */
-        unsigned spill_count = 0;
+        unsigned spill_count = DIV_ROUND_UP(ctx->tls_size, 16);
 
 
         mir_create_pipeline_registers(ctx);
@@ -1054,7 +1054,7 @@ mir_ra(compiler_context *ctx)
         /* Report spilling information. spill_count is in 128-bit slots (vec4 x
          * fp32), but tls_size is in bytes, so multiply by 16 */
 
-        ctx->tls_size += spill_count * 16;
+        ctx->tls_size = spill_count * 16;
 
         install_registers(ctx, l);
 



More information about the mesa-commit mailing list