[Mesa-dev] [PATCH 08/19] tgsi: add SUBGROUP_* semantics

Nicolai Hähnle nhaehnle at gmail.com
Fri Mar 31 17:14:08 UTC 2017


From: Ilia Mirkin <imirkin at alum.mit.edu>

v2: add documentation (Nicolai)

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
 src/gallium/auxiliary/tgsi/tgsi_strings.c  |  7 ++++
 src/gallium/docs/source/tgsi.rst           | 51 ++++++++++++++++++++++++++++++
 src/gallium/include/pipe/p_shader_tokens.h |  7 ++++
 3 files changed, 65 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index d7201fc..19e5cea 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -93,20 +93,27 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
    "BASEVERTEX",
    "PATCH",
    "TESSCOORD",
    "TESSOUTER",
    "TESSINNER",
    "VERTICESIN",
    "HELPER_INVOCATION",
    "BASEINSTANCE",
    "DRAWID",
    "WORK_DIM",
+   "SUBGROUP_SIZE",
+   "SUBGROUP_INVOCATION",
+   "SUBGROUP_EQ_MASK",
+   "SUBGROUP_GE_MASK",
+   "SUBGROUP_GT_MASK",
+   "SUBGROUP_LE_MASK",
+   "SUBGROUP_LT_MASK",
 };
 
 const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
 {
    "BUFFER",
    "1D",
    "2D",
    "3D",
    "CUBE",
    "RECT",
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 7e9b47c..2adac3b 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -3422,20 +3422,71 @@ For compute shaders, this semantic indicates the maximum (x, y, z) dimensions
 of a block in threads.
 
 
 TGSI_SEMANTIC_THREAD_ID
 """""""""""""""""""""""
 
 For compute shaders, this semantic indicates the (x, y, z) coordinates of the
 current thread inside of the block.
 
 
+TGSI_SEMANTIC_SUBGROUP_SIZE
+"""""""""""""""""""""""""""
+
+This semantic indicates the subgroup size for the current invocation. This is
+an integer of at most 64, as it indicates the width of lanemasks. It does not
+depend on the number of invocations that are active.
+
+
+TGSI_SEMANTIC_SUBGROUP_INVOCATION
+"""""""""""""""""""""""""""""""""
+
+The index of the current invocation within its subgroup.
+
+
+TGSI_SEMANTIC_SUBGROUP_EQ_MASK
+""""""""""""""""""""""""""""""
+
+A bit mask of ``bit index == TGSI_SEMANTIC_SUBGROUP_INVOCATION``, i.e.
+``1 << subgroup_invocation`` in arbitrary precision arithmetic.
+
+
+TGSI_SEMANTIC_SUBGROUP_GE_MASK
+""""""""""""""""""""""""""""""
+
+A bit mask of ``bit index >= TGSI_SEMANTIC_SUBGROUP_INVOCATION``, i.e.
+``((1 << (subgroup_size - subgroup_invocation)) - 1) << subgroup_invocation``
+in arbitrary precision arithmetic.
+
+
+TGSI_SEMANTIC_SUBGROUP_GT_MASK
+""""""""""""""""""""""""""""""
+
+A bit mask of ``bit index > TGSI_SEMANTIC_SUBGROUP_INVOCATION``, i.e.
+``((1 << (subgroup_size - subgroup_invocation - 1)) - 1) << (subgroup_invocation + 1)``
+in arbitrary precision arithmetic.
+
+
+TGSI_SEMANTIC_SUBGROUP_LE_MASK
+""""""""""""""""""""""""""""""
+
+A bit mask of ``bit index <= TGSI_SEMANTIC_SUBGROUP_INVOCATION``, i.e.
+``(1 << (subgroup_invocation + 1)) - 1`` in arbitrary precision arithmetic.
+
+
+TGSI_SEMANTIC_SUBGROUP_LT_MASK
+""""""""""""""""""""""""""""""
+
+A bit mask of ``bit index > TGSI_SEMANTIC_SUBGROUP_INVOCATION``, i.e.
+``(1 << subgroup_invocation) - 1`` in arbitrary precision arithmetic.
+
+
 Declaration Interpolate
 ^^^^^^^^^^^^^^^^^^^^^^^
 
 This token is only valid for fragment shader INPUT declarations.
 
 The Interpolate field specifes the way input is being interpolated by
 the rasteriser and is one of TGSI_INTERPOLATE_*.
 
 The Location field specifies the location inside the pixel that the
 interpolation should be done at, one of ``TGSI_INTERPOLATE_LOC_*``. Note that
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index d461f78..dbab23c 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -193,20 +193,27 @@ enum tgsi_semantic {
    TGSI_SEMANTIC_BASEVERTEX,
    TGSI_SEMANTIC_PATCH,       /**< generic per-patch semantic */
    TGSI_SEMANTIC_TESSCOORD,   /**< coordinate being processed by tess */
    TGSI_SEMANTIC_TESSOUTER,   /**< outer tessellation levels */
    TGSI_SEMANTIC_TESSINNER,   /**< inner tessellation levels */
    TGSI_SEMANTIC_VERTICESIN,  /**< number of input vertices */
    TGSI_SEMANTIC_HELPER_INVOCATION,  /**< current invocation is helper */
    TGSI_SEMANTIC_BASEINSTANCE,
    TGSI_SEMANTIC_DRAWID,
    TGSI_SEMANTIC_WORK_DIM,    /**< opencl get_work_dim value */
+   TGSI_SEMANTIC_SUBGROUP_SIZE,
+   TGSI_SEMANTIC_SUBGROUP_INVOCATION,
+   TGSI_SEMANTIC_SUBGROUP_EQ_MASK,
+   TGSI_SEMANTIC_SUBGROUP_GE_MASK,
+   TGSI_SEMANTIC_SUBGROUP_GT_MASK,
+   TGSI_SEMANTIC_SUBGROUP_LE_MASK,
+   TGSI_SEMANTIC_SUBGROUP_LT_MASK,
    TGSI_SEMANTIC_COUNT,       /**< number of semantic values */
 };
 
 struct tgsi_declaration_semantic
 {
    unsigned Name           : 8;  /**< one of TGSI_SEMANTIC_x */
    unsigned Index          : 16; /**< UINT */
    unsigned StreamX        : 2; /**< vertex stream (for GS output) */
    unsigned StreamY        : 2;
    unsigned StreamZ        : 2;
-- 
2.9.3



More information about the mesa-dev mailing list