From 9df62df55eb239f14a01b9ea31c1ad96c154a2c0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 14 Apr 2026 11:58:43 -0400 Subject: [PATCH] jay: fix bfn cmod affects dEQP-GLES31.functional.compute.basic.image_atomic_op_local_size_8 Signed-off-by: Alyssa Rosenzweig Part-of: --- src/intel/compiler/jay/jay_opt_propagate.c | 9 +++++++++ src/intel/compiler/jay/jay_to_binary.c | 13 ++++++++++++- src/intel/compiler/jay/test/test-optimizer.cpp | 9 ++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/jay/jay_opt_propagate.c b/src/intel/compiler/jay/jay_opt_propagate.c index 25a58253d93..449cac68421 100644 --- a/src/intel/compiler/jay/jay_opt_propagate.c +++ b/src/intel/compiler/jay/jay_opt_propagate.c @@ -42,6 +42,15 @@ propagate_cmod(jay_function *func, jay_inst *I, jay_inst **defs) if (!def || !jay_is_null(def->cond_flag) || !jay_opcode_infos[def->op].cmod) return false; + /* bfn bspec says "only zero(ze), greater-than(gt), and less-than(lt) + * conditional modifiers are valid." + */ + if (def->op == JAY_OPCODE_BFN && !(cmod == JAY_CONDITIONAL_EQ || + cmod == JAY_CONDITIONAL_GT || + cmod == JAY_CONDITIONAL_LT)) { + return false; + } + /* "Neither Saturate nor conditional modifier allowed with DW integer * multiply." * diff --git a/src/intel/compiler/jay/jay_to_binary.c b/src/intel/compiler/jay/jay_to_binary.c index 2742ca37a09..62b9576ec9c 100644 --- a/src/intel/compiler/jay/jay_to_binary.c +++ b/src/intel/compiler/jay/jay_to_binary.c @@ -504,7 +504,18 @@ emit(struct brw_codegen *p, } if (cmod != BRW_CONDITIONAL_NONE) { - brw_eu_inst_set_cond_modifier(p->devinfo, brw_eu_last_inst(p), cmod); + if (I->op != JAY_OPCODE_BFN) { + brw_eu_inst_set_cond_modifier(p->devinfo, brw_eu_last_inst(p), cmod); + } else { + unsigned cc = cmod == BRW_CONDITIONAL_L ? 3 : + cmod == BRW_CONDITIONAL_G ? 2 : + cmod == BRW_CONDITIONAL_Z ? 1 : + cmod == BRW_CONDITIONAL_NONE ? 0 : + -1; + assert(cc < 4 && "invalid cmod for bfn"); + brw_eu_inst_set_boolean_func_cond_modifier(p->devinfo, + brw_eu_last_inst(p), cc); + } } assert(p->nr_insn == (nr_ins_before + jay_macro_length(I)) && diff --git a/src/intel/compiler/jay/test/test-optimizer.cpp b/src/intel/compiler/jay/test/test-optimizer.cpp index 739a2d15610..28e493aa732 100644 --- a/src/intel/compiler/jay/test/test-optimizer.cpp +++ b/src/intel/compiler/jay/test/test-optimizer.cpp @@ -251,7 +251,14 @@ TEST_F(Optimizer, TypeNeutralConditionalMods) jay_def flag = jay_alloc_def(b, FLAG, 1); jay_def x = jay_alloc_def(b, GPR, 1); jay_inst *bfn3 = jay_BFN(b, x, wx, wy, wz, UTIL_LUT3(a & b & c)); - jay_set_conditional_mod(b, bfn3, flag, mods[i]); + + /* BFN.ne is not permitted & should not be propagated */ + if (mods[i] == JAY_CONDITIONAL_EQ) { + jay_set_conditional_mod(b, bfn3, flag, mods[i]); + } else { + jay_CMP(b, JAY_TYPE_S32, mods[i], flag, x, 0); + } + jay_SEL(b, JAY_TYPE_U32, out, x, 123, flag); });