From 65697d6438fae5730ff0dbd915d2b9d3a3929ad9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 2 Jun 2026 02:29:28 -0700 Subject: [PATCH] jay: Remember sp_delta_B when rematerializing stack pointer lane 0 The stack pointer starts out at b.shader->scratch_size, plus per-lane offsets. Every time we spill/fill, we adjust the stack pointer to the offset for our desired memory location, and leave it there. Over the course of each block's spills/fills, we track the current delta from the original value, and restore it to there at the end of the block. However, when we started clobbering lane 0 and rematerializing it, we were recreating it as the original base value (b.shader->scratch_size + sizeof(uint32_t) * 0). We need to include sp_delta_B too, or else we will calculate our deltas incorrectly for that lane, and restore it incorrectly at the end of the block too. Found while debugging the issue fixed by the previous commit. Part-of: --- src/intel/compiler/jay/jay_lower_spill.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/jay/jay_lower_spill.c b/src/intel/compiler/jay/jay_lower_spill.c index e7300728a7e..2532c2cc531 100644 --- a/src/intel/compiler/jay/jay_lower_spill.c +++ b/src/intel/compiler/jay/jay_lower_spill.c @@ -116,7 +116,7 @@ jay_lower_spill(jay_function *func) if (I->op == JAY_OPCODE_MOV && jay_is_send_like(I)) { if (!address_valid) { jay_MOV(&b, ADDRESS_REG, tmpu); - jay_MOV(&b, tmpu, b.shader->scratch_size); + jay_MOV(&b, tmpu, b.shader->scratch_size + sp_delta_B); address_valid = true; } @@ -140,7 +140,7 @@ jay_lower_spill(jay_function *func) if (jay_num_successors(block, GPR) > 0) { if (!address_valid) { jay_MOV(&b, ADDRESS_REG, tmpu); - jay_MOV(&b, tmpu, b.shader->scratch_size); + jay_MOV(&b, tmpu, b.shader->scratch_size + sp_delta_B); } if (sp_delta_B > 0) {