From 849cdbcf7259ceb6fb92a6064a47669880d4093c Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 19 Feb 2026 11:47:47 +0000 Subject: [PATCH] aco: fix gfx6-8 store_scratch() with function calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Might happen with radv_emulate_rt=true. Fixes the_great_circle/a6079328b8df7712 with polaris10. Signed-off-by: Rhys Perry Fixes: e006f68b11ad ("aco/isel: Don't add scratch offset as gfx8- soffset if no offsets exist") Reviewed-by: Daniel Schürmann (cherry picked from commit 75722da9096d315fe414346f47c53d30fa774016) Part-of: --- .pick_status.json | 2 +- .../instruction_selection/aco_select_nir_intrinsics.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index cba3b67e406..fd611abd34f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2174,7 +2174,7 @@ "description": "aco: fix gfx6-8 store_scratch() with function calls", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "e006f68b11ad7af8c0c4d7267ee04d9dfa1889a1", "notes": null diff --git a/src/amd/compiler/instruction_selection/aco_select_nir_intrinsics.cpp b/src/amd/compiler/instruction_selection/aco_select_nir_intrinsics.cpp index 97587b3667d..e6fd1964619 100644 --- a/src/amd/compiler/instruction_selection/aco_select_nir_intrinsics.cpp +++ b/src/amd/compiler/instruction_selection/aco_select_nir_intrinsics.cpp @@ -3392,7 +3392,10 @@ visit_store_scratch(isel_context* ctx, nir_intrinsic_instr* instr) offset = as_vgpr(ctx, offset); for (unsigned i = 0; i < write_count; i++) { aco_opcode op = get_buffer_store_op(write_datas[i].bytes()); - Instruction* mubuf = bld.mubuf(op, rsrc, offset, ctx->program->scratch_offsets.back(), + Operand soffset = Operand::c32(0); + if (!ctx->program->scratch_offsets.empty()) + soffset = Operand(ctx->program->scratch_offsets.back()); + Instruction* mubuf = bld.mubuf(op, rsrc, offset, soffset, write_datas[i], offsets[i], true); mubuf->mubuf().sync = memory_sync_info(storage_scratch, semantic_private); enum ac_access_type type =