From 52b445f3f993a4a6f132a7635bcb4cd116a35a01 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Aug 2025 06:24:08 +1000 Subject: [PATCH] spirv: move cmat store barrier after the store. Fixes: b98f87612bc ("spirv: Implement SPV_KHR_cooperative_matrix") Reviewed-by: Faith Ekstrand Reviewed-by: Caio Oliveira Part-of: (cherry picked from commit b1242e6b30510d595fa8cc577bf0b23919a37537) --- .pick_status.json | 2 +- src/compiler/spirv/vtn_cmat.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 92e7138f909..dbc9739a8cd 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4384,7 +4384,7 @@ "description": "spirv: move cmat store barrier after the store.", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "b98f87612bc14fe88184dc099d9d4f8e6b3b23cb", "notes": null diff --git a/src/compiler/spirv/vtn_cmat.c b/src/compiler/spirv/vtn_cmat.c index e9744d0313a..15ff117f7f0 100644 --- a/src/compiler/spirv/vtn_cmat.c +++ b/src/compiler/spirv/vtn_cmat.c @@ -119,6 +119,10 @@ vtn_handle_cooperative_instruction(struct vtn_builder *b, SpvOp opcode, const SpvCooperativeMatrixLayout layout = vtn_constant_uint(b, w[3]); nir_def *stride = count > 4 ? vtn_get_nir_ssa(b, w[4]) : nir_imm_zero(&b->nb, 1, 32); + nir_deref_instr *src = vtn_get_cmat_deref(b, w[2]); + nir_cmat_store(&b->nb, vtn_pointer_to_ssa(b, dest), &src->def, stride, + .matrix_layout = vtn_matrix_layout_to_glsl(layout)); + SpvMemoryAccessMask access = SpvMemoryAccessMaskNone; if (count > 5) { unsigned idx = 5, alignment; @@ -127,9 +131,6 @@ vtn_handle_cooperative_instruction(struct vtn_builder *b, SpvOp opcode, vtn_emit_make_available_barrier(b, access, scope, dest->mode); } - nir_deref_instr *src = vtn_get_cmat_deref(b, w[2]); - nir_cmat_store(&b->nb, vtn_pointer_to_ssa(b, dest), &src->def, stride, - .matrix_layout = vtn_matrix_layout_to_glsl(layout)); break; }