Mesa (staging/20.3): intel/gen12: Fix memory corruption issues in fused Gen12 parts.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 26 17:53:54 UTC 2021


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

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Thu Jan 21 14:21:50 2021 -0800

intel/gen12: Fix memory corruption issues in fused Gen12 parts.

According to the BSpec page for MEDIA_VFE_STATE, on Gen12 platforms
"if a fused configuration has fewer threads than the native POR
configuration, the scratch space allocation is based on the number of
threads in the base native POR configuration".  However we currently
use the subslice count from devinfo->num_subslices[0], which only
includes the subslices currently enabled by the platform fusing.  This
leads to scratch space underallocation and occasional hangs.

The problem is likely to affect most Gen12 GPUs with less than 96 EUs.
GFXBench5 Aztec Ruins is able to reproduce the issue fairly reliably.

Fixes: 9e5ce30da7fa3f1cc3badf "intel: fix the gen 12 compute shader scratch IDs"
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8636>
(cherry picked from commit e2c5ef6cd6571a8522b9b75a99d245a538cf6183)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/iris/iris_program.c | 4 ++--
 src/intel/vulkan/anv_allocator.c        | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 36669d2df46..dec1b35ba02 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -265,7 +265,7 @@
         "description": "intel/gen12: Fix memory corruption issues in fused Gen12 parts.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "9e5ce30da7fa3f1cc3badfd348e5f8fda1bbacb2"
     },
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index 8157e921850..971fc80b5ac 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -2109,8 +2109,8 @@ iris_get_scratch_space(struct iris_context *ice,
     * in the base configuration.
     */
    unsigned subslice_total = screen->subslice_total;
-   if (devinfo->gen >= 12)
-      subslice_total = devinfo->num_subslices[0];
+   if (devinfo->gen == 12)
+      subslice_total = (devinfo->is_dg1 || devinfo->gt == 2 ? 6 : 2);
    else if (devinfo->gen == 11)
       subslice_total = 8;
    else if (devinfo->gen < 11)
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 9007cd00e85..48811912e95 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1447,8 +1447,8 @@ anv_scratch_pool_alloc(struct anv_device *device, struct anv_scratch_pool *pool,
     * For, Gen11+, scratch space allocation is based on the number of threads
     * in the base configuration.
     */
-   if (devinfo->gen >= 12)
-      subslices = devinfo->num_subslices[0];
+   if (devinfo->gen == 12)
+      subslices = (devinfo->is_dg1 || devinfo->gt == 2 ? 6 : 2);
    else if (devinfo->gen == 11)
       subslices = 8;
    else if (devinfo->gen >= 9)



More information about the mesa-commit mailing list