Module: Mesa
Branch: main
Commit: 6495fe3d37c37f2a476cfcd2b98d42e80f185136
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6495fe3d37c37f2a476cfcd2b98d42e80f185136

Author: Jordan Justen <[email protected]>
Date:   Fri Dec  1 23:06:27 2023 -0800

intel/xe2+: Implement brw_wm_state_simd_width_for_ksp() on Xe2+.

The mechanism for selecting dispatch modes has changed from previous
platforms, add a new implementation brw_wm_state_simd_width_for_ksp()
using the new kernel dispatch controls.

[ Francisco Jerez: Split from a larger patch, handle multipolygon
                   dispatch, add additional comments. ]

Signed-off-by: Francisco Jerez <[email protected]>
Reviewed-by: Caio Oliveira <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26606>

---

 src/intel/compiler/brw_compiler.h | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/intel/compiler/brw_compiler.h 
b/src/intel/compiler/brw_compiler.h
index 924d3a8e930..b6cd0308c9d 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -1085,25 +1085,27 @@ struct brw_wm_prog_data {
  * kernel start pointer (KSP) indices that is based on what dispatch widths
  * are enabled.  This function provides, effectively, the reverse mapping.
  *
- * If the given KSP is valid with respect to the SIMD8/16/32 enables, a SIMD
- * width of 8, 16, or 32 is returned.  If the KSP is invalid, 0 is returned.
+ * If the given KSP is enabled, a SIMD width of 8, 16, or 32 is
+ * returned.  Note that for a multipolygon dispatch kernel 8 is always
+ * returned, since multipolygon kernels use the "_8" fields from
+ * brw_wm_prog_data regardless of their SIMD width.  If the KSP is
+ * invalid, 0 is returned.
  */
 static inline unsigned
 brw_fs_simd_width_for_ksp(unsigned ksp_idx, bool enabled, unsigned width_sel)
 {
-   if (ksp_idx < 2) {
-      return enabled ? (width_sel == 0 ? 16 : 32) : 0;
-   } else {
-      unreachable("Invalid KSP index");
-   }
+   assert(ksp_idx < 2);
+   return !enabled ? 0 :
+          width_sel ? 32 :
+          16;
 }
 
 #define brw_wm_state_simd_width_for_ksp(wm_state, ksp_idx)              \
-   (ksp_idx == 0 ?                                                      \
-      brw_fs_simd_width_for_ksp(ksp_idx, (wm_state).Kernel0Enable,      \
-                                (wm_state).Kernel0SIMDWidth) :          \
-      brw_fs_simd_width_for_ksp(ksp_idx, (wm_state).Kernel1Enable,      \
-                                (wm_state).Kernel1SIMDWidth))
+        (ksp_idx == 0 && (wm_state).Kernel0MaximumPolysperThread ? 8 :  \
+         ksp_idx == 0 ? brw_fs_simd_width_for_ksp(ksp_idx, 
(wm_state).Kernel0Enable, \
+                                                  
(wm_state).Kernel0SIMDWidth): \
+         brw_fs_simd_width_for_ksp(ksp_idx, (wm_state).Kernel1Enable,   \
+                                   (wm_state).Kernel1SIMDWidth))
 
 #else
 

Reply via email to