Mesa (staging/19.0): anv/pipeline: Fix MEDIA_VFE_STATE::PerThreadScratchSpace on gen7

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 12 20:37:20 UTC 2019


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Apr 10 14:47:12 2019 -0500

anv/pipeline: Fix MEDIA_VFE_STATE::PerThreadScratchSpace on gen7

We were always programming it with the Broadwell convention which is too
large by a factor of two on Haswell and just plain wrong on IVB and BYT.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: mesa-stable at lists.freedesktop.org
(cherry picked from commit 7eaaff18cb6109dd6c4c58de5a4d3be1362b21ae)

---

 src/intel/vulkan/genX_pipeline.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 35f783f786f..3e13a12d776 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -2087,9 +2087,29 @@ compute_pipeline_create(
       vfe.URBEntryAllocationSize = GEN_GEN <= 7 ? 0 : 2;
       vfe.CURBEAllocationSize    = vfe_curbe_allocation;
 
-      vfe.PerThreadScratchSpace = get_scratch_space(cs_bin);
-      vfe.ScratchSpaceBasePointer =
-         get_scratch_address(pipeline, MESA_SHADER_COMPUTE, cs_bin);
+      if (cs_bin->prog_data->total_scratch) {
+         if (GEN_GEN >= 8) {
+            /* Broadwell's Per Thread Scratch Space is in the range [0, 11]
+             * where 0 = 1k, 1 = 2k, 2 = 4k, ..., 11 = 2M.
+             */
+            vfe.PerThreadScratchSpace =
+               ffs(cs_bin->prog_data->total_scratch) - 11;
+         } else if (GEN_IS_HASWELL) {
+            /* Haswell's Per Thread Scratch Space is in the range [0, 10]
+             * where 0 = 2k, 1 = 4k, 2 = 8k, ..., 10 = 2M.
+             */
+            vfe.PerThreadScratchSpace =
+               ffs(cs_bin->prog_data->total_scratch) - 12;
+         } else {
+            /* IVB and BYT use the range [0, 11] to mean [1kB, 12kB]
+             * where 0 = 1kB, 1 = 2kB, 2 = 3kB, ..., 11 = 12kB.
+             */
+            vfe.PerThreadScratchSpace =
+               cs_bin->prog_data->total_scratch / 1024 - 1;
+         }
+         vfe.ScratchSpaceBasePointer =
+            get_scratch_address(pipeline, MESA_SHADER_COMPUTE, cs_bin);
+      }
    }
 
    struct GENX(INTERFACE_DESCRIPTOR_DATA) desc = {




More information about the mesa-commit mailing list