Mesa (master): intel: fix the gen 11 compute shader scratch IDs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 3 00:49:08 UTC 2020


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

Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Fri Jan 31 15:51:41 2020 -0800

intel: fix the gen 11 compute shader scratch IDs

Scratch space allocation is based on the number of threads in the base
configuration, and we only have one base configuration for ICL, with 8
subslices.

This fixes an issue with Aztec on Vulkan in a machine with a
configuration that's not the base. The issue looks like a regression
from b9e93db20896, but it seems things are broken since forever, just
not easily reproducible.

v2: Reimplement it using the subslices variable. Don't touch TGL.

Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
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/4006>

---

 src/gallium/drivers/iris/iris_program.c | 7 ++++++-
 src/intel/vulkan/anv_allocator.c        | 7 ++++++-
 src/mesa/drivers/dri/i965/brw_program.c | 7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index 01b08f24b93..701cfa20aea 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -2053,9 +2053,14 @@ iris_get_scratch_space(struct iris_context *ice,
     * as well.  This is not currently documented at all.
     *
     * This hack is no longer necessary on Gen11+.
+    *
+    * For, ICL, scratch space allocation is based on the number of threads
+    * in the base configuration.
     */
    unsigned subslice_total = screen->subslice_total;
-   if (devinfo->gen < 11)
+   if (devinfo->gen == 11)
+      subslice_total = 8;
+   else if (devinfo->gen < 11)
       subslice_total = 4 * devinfo->num_slices;
    assert(subslice_total >= screen->subslice_total);
 
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 7965008e060..112a12014cb 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1395,7 +1395,12 @@ anv_scratch_pool_alloc(struct anv_device *device, struct anv_scratch_pool *pool,
 
    const struct gen_device_info *devinfo = &device->info;
 
-   const unsigned subslices = MAX2(device->physical->subslice_total, 1);
+   unsigned subslices = MAX2(device->physical->subslice_total, 1);
+
+   /* For, ICL, scratch space allocation is based on the number of threads
+    * in the base configuration. */
+   if (devinfo->gen == 11)
+      subslices = 8;
 
    unsigned scratch_ids_per_subslice;
    if (devinfo->gen >= 11) {
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 4a76ee58ddd..9933eb27e7e 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -467,8 +467,13 @@ brw_alloc_stage_scratch(struct brw_context *brw,
        * brw->screen->subslice_total is the TOTAL number of subslices
        * and we wish to view that there are 4 subslices per slice
        * instead of the actual number of subslices per slice.
+       *
+       * For, ICL, scratch space allocation is based on the number of threads
+       * in the base configuration.
        */
-      if (devinfo->gen >= 9 && devinfo->gen < 11)
+      if (devinfo->gen == 11)
+         subslices = 8;
+      else if (devinfo->gen >= 9 && devinfo->gen < 11)
          subslices = 4 * brw->screen->devinfo.num_slices;
 
       unsigned scratch_ids_per_subslice;



More information about the mesa-commit mailing list