Mesa (staging/22.0): iris: fix register spilling on compute shaders on XeHP

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 25 21:11:14 UTC 2022


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

Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Wed Feb 16 17:15:01 2022 -0800

iris: fix register spilling on compute shaders on XeHP

XeHP scratch space is handled differently. Commit ae18e1e707c4
implemented support for it, but handled it differently between render
and compute shaders: it calculates scratch_addr differently and
doesn't pin the buffer on compute. Make it work on compute shaders by
calling pin_scratch_space() from iris_compute_walker(), which fixes
both the address and the pinning.

This commit can be verified by the two-year-old-but-still-unreviewed
Piglit MR 234. You can also verify this by running a very simple
compute shader with INTEL_DEBUG=spill_fs.

References: https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/234
Fixes: ae18e1e707c4 ("iris: Add support for scratch on XeHP")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15070>
(cherry picked from commit d10fd5b7c9a695565c009c446882bed49bc20fdd)

---

 .pick_status.json                     | 2 +-
 src/gallium/drivers/iris/iris_state.c | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index ddd0678ca3b..6ad5b1f0e6e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -832,7 +832,7 @@
         "description": "iris: fix register spilling on compute shaders on XeHP",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "ae18e1e707c4be005256305a30b747ab1bdf55d8"
     },
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 622752b0e97..b5eb96e9e4e 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -7080,10 +7080,9 @@ iris_upload_compute_walker(struct iris_context *ice,
       iris_emit_cmd(batch, GENX(CFE_STATE), cfe) {
          cfe.MaximumNumberofThreads =
             devinfo->max_cs_threads * devinfo->subslice_total - 1;
-         if (prog_data->total_scratch > 0) {
-            cfe.ScratchSpaceBuffer =
-               iris_get_scratch_surf(ice, prog_data->total_scratch)->offset >> 4;
-         }
+         uint32_t scratch_addr = pin_scratch_space(ice, batch, prog_data,
+                                                   MESA_SHADER_COMPUTE);
+         cfe.ScratchSpaceBuffer = scratch_addr >> 4;
       }
    }
 



More information about the mesa-commit mailing list