[Mesa-dev] [PATCH 3/5] i965/chv: Check that compute threads are above threshold

Ben Widawsky benjamin.widawsky at intel.com
Tue Mar 8 01:39:26 UTC 2016


The way we are organizing this code, the statically configured max_cs_threads
should always be the minimum value we actually support (ie. are aware of). As a
result, we can fall back to that if we get invalid numbers from the kernel (ie.
when the query succeeds, but the result is lower than expected).

I was originally planning to use an assert, but there is no reason to be so
mean.

Cc: Jordan Justen <jordan.l.justen at intel.com>
Signed-off-by: Ben Widawsky <benjamin.widawsky at intel.com>
---
 src/mesa/drivers/dri/i965/brw_context.c     | 8 ++++++--
 src/mesa/drivers/dri/i965/brw_device_info.h | 5 +++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 6e3e97b..df0f6bb 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -931,10 +931,14 @@ brwCreateContext(gl_api api,
    brw->max_wm_threads = devinfo->max_wm_threads;
    /* FINISHME: Do this for all platforms that the kernel supports */
    if (brw->is_cherryview &&
-       screen->subslice_total > 0 && screen->eu_total > 0)
+       screen->subslice_total > 0 && screen->eu_total > 0) {
       /* Logical CS threads = n EUs per subslice * 7 threads per EU */
       brw->max_cs_threads = screen->eu_total / screen->subslice_total * 7;
-   else
+
+      /* Fuse configurations may give more threads than expected, never less. */
+      if (brw->max_cs_threads < devinfo->max_cs_threads)
+         brw->max_cs_threads = devinfo->max_cs_threads;
+   } else
       brw->max_cs_threads = devinfo->max_cs_threads;
    brw->urb.size = devinfo->urb.size;
    brw->urb.min_vs_entries = devinfo->urb.min_vs_entries;
diff --git a/src/mesa/drivers/dri/i965/brw_device_info.h b/src/mesa/drivers/dri/i965/brw_device_info.h
index 73d6820..5c9517e 100644
--- a/src/mesa/drivers/dri/i965/brw_device_info.h
+++ b/src/mesa/drivers/dri/i965/brw_device_info.h
@@ -71,6 +71,11 @@ struct brw_device_info
    /**
     * Total number of slices present on the device whether or not they've been
     * fused off.
+    *
+    * XXX: CS thread counts are limited by the inability to do cross subslice
+    * communication. It is the effectively the number of logical threads which
+    * can be executed in a subslice. Fuse configurations may cause this number
+    * to change, so we program @max_cs_threads as the lower maximum.
     */
    unsigned num_slices;
    unsigned max_vs_threads;
-- 
2.7.1



More information about the mesa-dev mailing list