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 <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005>
(cherry picked from commit dc3bbd351a)
This commit is contained in:
Timur Kristóf 2023-07-04 14:28:45 +02:00 committed by Eric Engestrom
parent 671deb11e4
commit 506a84dc94
2 changed files with 4 additions and 3 deletions

View file

@ -346,7 +346,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
},

View file

@ -8354,9 +8354,10 @@ visit_intrinsic(isel_context* ctx, nir_intrinsic_instr* instr)
}
case nir_intrinsic_load_subgroup_id: {
if (ctx->stage.hw == HWStage::CS) {
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 == HWStage::NGG) {
/* 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)),