jay: workaround the while bug

fixes dEQP-VK.reconvergence.maximal.compute.nesting2.6.2

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41872>
This commit is contained in:
Alyssa Rosenzweig 2026-06-02 16:16:56 -04:00 committed by Marge Bot
parent ccf936dd9f
commit 2c9df4caad
2 changed files with 21 additions and 1 deletions

View file

@ -62,6 +62,7 @@ def op(name: str, num_srcs: int, types: str | None = None,
extra_struct_)
op('nop', 0, 'untyped', Props.NO_DEST)
op('and', 2, 'u1 u16 u32', Props.NEGATE | Props.CMOD | Props.COMMUTATIVE)
op('or', 2, 'u1 u16 u32', Props.NEGATE | Props.CMOD | Props.COMMUTATIVE)
op('xor', 2, 'u1 u16 u32', Props.NEGATE | Props.CMOD | Props.COMMUTATIVE)

View file

@ -16,6 +16,7 @@
#include "util/u_dynarray.h"
#include "util/u_math.h"
#include "jay.h"
#include "jay_builder.h"
#include "jay_ir.h"
#include "jay_opcodes.h"
#include "jay_private.h"
@ -278,6 +279,7 @@ static const struct {
OP(MUL_32X16, MUL, 2),
OP(MUL, MUL, 2),
OP(NOT, NOT, 1),
OP(NOP, NOP, 0),
OP(OFFSET_PACKED_PIXEL_COORDS, ADD, 1),
OP(OR, OR, 2),
OP(QUAD_SWIZZLE, MOV, 1),
@ -597,10 +599,27 @@ jay_to_binary(jay_shader *s,
int total_gen_insts = 0;
jay_foreach_function(s, f) {
jay_inst *last = NULL;
jay_foreach_block(f, block) {
jay_foreach_inst_in_block(block, I) {
jay_foreach_inst_in_block_safe(block, I) {
total_gen_insts +=
(1 << jay_simd_split(s, I)) * jay_macro_length(I);
/* Workaround for an issue with branch prediction for WHILE
* instructions that may lead to misrendering or GPU hangs.
* See HSDs 22020521218 and 16026360541.
*/
if (I->op == JAY_OPCODE_WHILE &&
(last && jay_op_is_control_flow(last->op)) &&
s->devinfo->ver >= 20) {
jay_builder b = jay_init_builder(f, jay_before_inst(I));
jay_NOP(&b);
total_gen_insts++;
}
last = I;
}
}
}