Module: Mesa
Branch: staging/23.2
Commit: 6e46d67a3cebd44d304f7d5a8510f810064ac8f5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e46d67a3cebd44d304f7d5a8510f810064ac8f5

Author: Timur Kristóf <[email protected]>
Date:   Tue Jul  4 14:28:45 2023 +0200

aco: Fix subgroup_id intrinsic on GFX10.3+.

Change this to match how it works in the LLVM backend.

Cc: mesa-stable
Signed-off-by: Timur Kristóf <[email protected]>
Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>
(cherry picked from commit dc3bbd351a081a90b57a8772ade8d693048f6403)

---

 .pick_status.json                              | 2 +-
 src/amd/compiler/aco_instruction_selection.cpp | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8675b6de378..e259ee117d3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -334,7 +334,7 @@
         "description": "aco: Fix subgroup_id intrinsic on GFX10.3+.",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/amd/compiler/aco_instruction_selection.cpp 
b/src/amd/compiler/aco_instruction_selection.cpp
index 84a7ee0a4ad..b349f15c2c2 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -8235,9 +8235,10 @@ visit_intrinsic(isel_context* ctx, nir_intrinsic_instr* 
instr)
    }
    case nir_intrinsic_load_subgroup_id: {
       if (ctx->stage.hw == AC_HW_COMPUTE_SHADER) {
+         const unsigned bfe_const =
+            ctx->program->gfx_level >= GFX10_3 ? (0x14u | 0x5u << 16) : (0x6u 
| (0x6u << 16));
          bld.sop2(aco_opcode::s_bfe_u32, Definition(get_ssa_temp(ctx, 
&instr->dest.ssa)),
-                  bld.def(s1, scc), get_arg(ctx, ctx->args->tg_size),
-                  Operand::c32(0x6u | (0x6u << 16)));
+                  bld.def(s1, scc), get_arg(ctx, ctx->args->tg_size), 
Operand::c32(bfe_const));
       } else if (ctx->stage.hw == AC_HW_NEXT_GEN_GEOMETRY_SHADER) {
          /* Get the id of the current wave within the threadgroup (workgroup) 
*/
          bld.sop2(aco_opcode::s_bfe_u32, Definition(get_ssa_temp(ctx, 
&instr->dest.ssa)),

Reply via email to