Mesa (main): ac/nir/taskmesh: Preserve workgroup ID Y and Z when applying firstTask.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 19:09:23 UTC 2022


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

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Mon Feb 28 14:22:09 2022 +0100

ac/nir/taskmesh: Preserve workgroup ID Y and Z when applying firstTask.

NV_mesh_shader workgroups are only 1 dimensional, so it's OK to
only add firstTask to the X dimension.
However, let's keep the Y and Z dimensions so this doesn't mess up
the workgroup ID for future 3 dimensional task shader dispatches.

Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17023>

---

 src/amd/common/ac_nir_lower_taskmesh_io_to_mem.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_nir_lower_taskmesh_io_to_mem.c b/src/amd/common/ac_nir_lower_taskmesh_io_to_mem.c
index 5bcb97a6ea7..fa4f53b39f4 100644
--- a/src/amd/common/ac_nir_lower_taskmesh_io_to_mem.c
+++ b/src/amd/common/ac_nir_lower_taskmesh_io_to_mem.c
@@ -124,10 +124,12 @@ ac_nir_apply_first_task_to_task_shader(nir_shader *shader)
    nir_pop_if(b, if_stride);
    first_task = nir_if_phi(b, first_task, zero);
 
-   /* NV_mesh_shader workgroups are 1 dimensional so we only care about X here. */
+   /* NV_mesh_shader workgroups are 1 dimensional.
+    * Apply firstTask to the X dimension, but leave Y and Z intact.
+    */
    nir_ssa_def *hw_workgroup_id = nir_load_workgroup_id(b, 32);
    nir_ssa_def *api_workgroup_id_x = nir_iadd(b, nir_channel(b, hw_workgroup_id, 0), first_task);
-   nir_ssa_def *api_workgroup_id = nir_vec3(b, api_workgroup_id_x, zero, zero);
+   nir_ssa_def *api_workgroup_id = nir_vector_insert_imm(b, hw_workgroup_id, api_workgroup_id_x, 0);
 
    add_first_task_to_workgroup_id_state state = {
       .hw_workgroup_id = hw_workgroup_id,



More information about the mesa-commit mailing list