From 87ce33bbf3682c5d08140d42633f1e98db2cad07 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 29 May 2026 12:14:44 -0400 Subject: [PATCH] jay: replace BYTE/WORD_PACK with a simple MOV MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Equivalent now that the IR allows it. For the dynamic case: < (32&W) mov.u16 g0, g38<16,8,2> │ I@1 --- > (32&W) mov.u16 g0, g38<2> │ I@1 For the constant case it's actually better since copyprop can see through it: < (1&W) mov.u32 u0.0, 0xaaaaaaaa │ < (32&W) mov.u16 g1, u0.0 │ I@1 --- > (32&W) mov.u16 g0, 0xaaaa │ Signed-off-by: Alyssa Rosenzweig Part-of: --- src/intel/compiler/jay/jay_from_nir.c | 8 ++++---- src/intel/compiler/jay/jay_opcodes.py | 9 --------- src/intel/compiler/jay/jay_opt_propagate.c | 5 +---- src/intel/compiler/jay/jay_to_binary.c | 11 ----------- 4 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/intel/compiler/jay/jay_from_nir.c b/src/intel/compiler/jay/jay_from_nir.c index c1633590fb9..65c15eb40ea 100644 --- a/src/intel/compiler/jay/jay_from_nir.c +++ b/src/intel/compiler/jay/jay_from_nir.c @@ -816,8 +816,8 @@ jay_emit_fb_write(jay_builder *b, nir_intrinsic_instr *intr) srcs[len++] = jay_as_gpr(b, src0_alpha); if (!jay_is_null(omask)) { - jay_def packed = jay_alloc_def(b, UGPR, jay_ugpr_per_grf(b->shader)); - jay_WORD_PACK(b, packed, omask); + jay_def packed = jay_alloc_def(b, UGPR, b->shader->dispatch_width / 2); + jay_MOV(b, packed, omask)->type = JAY_TYPE_U16; for (unsigned i = 0; i < jay_num_values(packed); i++) srcs[len++] = jay_extract(packed, i); @@ -833,8 +833,8 @@ jay_emit_fb_write(jay_builder *b, nir_intrinsic_instr *intr) srcs[len++] = jay_as_gpr(b, depth); if (!jay_is_null(stencil)) { - jay_def packed = jay_alloc_def(b, UGPR, jay_ugpr_per_grf(b->shader)); - jay_BYTE_PACK(b, packed, jay_as_gpr(b, stencil)); + jay_def packed = jay_alloc_def(b, UGPR, b->shader->dispatch_width / 4); + jay_MOV(b, packed, stencil)->type = JAY_TYPE_U8; /* Split send before stencil due to file difference */ assert(split == -1 && "TODO: samplemask and stencil outputs together"); diff --git a/src/intel/compiler/jay/jay_opcodes.py b/src/intel/compiler/jay/jay_opcodes.py index aed12cfcf6f..16765c05c4e 100644 --- a/src/intel/compiler/jay/jay_opcodes.py +++ b/src/intel/compiler/jay/jay_opcodes.py @@ -167,15 +167,6 @@ op('extract_byte_per_8lanes', 2, 'u32') op('shr_odd_subspans_by_4', 1, 'u16') op('and_u32_u16', 2, 'u32') -# Copy the first byte of each lane, treating the destination as if it were -# effectively JAY_STRIDE_1 (which doesn't exist). Because the destination -# doesn't follow proper lane alignments, this should not write to GPRs. -# This is used for stencil outputs in render target write messages. -op('byte_pack', 1, 'u32') - -# Similar to byte_pack, but for words -op('word_pack', 1, 'u32') - # Pixel coord calculations. expand_quad replicates out the per-2x2 values from # its source g0.[10...13] and - in the case of SIMD32 - g1.[10...13] into a # per-lane value. Then offset_packed_pixel_coords adds the appropriate packed diff --git a/src/intel/compiler/jay/jay_opt_propagate.c b/src/intel/compiler/jay/jay_opt_propagate.c index 24b07d49f52..32840983b9d 100644 --- a/src/intel/compiler/jay/jay_opt_propagate.c +++ b/src/intel/compiler/jay/jay_opt_propagate.c @@ -153,10 +153,7 @@ propagate_forwards(jay_function *f) } /* Don't propagate into phis yet - TODO: File awareness */ - if (I->op == JAY_OPCODE_PHI_SRC || - I->op == JAY_OPCODE_SEND || - I->op == JAY_OPCODE_BYTE_PACK || - I->op == JAY_OPCODE_WORD_PACK) + if (I->op == JAY_OPCODE_PHI_SRC || I->op == JAY_OPCODE_SEND) continue; jay_foreach_ssa_src(I, s) { diff --git a/src/intel/compiler/jay/jay_to_binary.c b/src/intel/compiler/jay/jay_to_binary.c index ce6e831c1f6..9ba2a1e8a13 100644 --- a/src/intel/compiler/jay/jay_to_binary.c +++ b/src/intel/compiler/jay/jay_to_binary.c @@ -650,17 +650,6 @@ emit(struct jay_codegen *jc, break; } - case JAY_OPCODE_BYTE_PACK: - jc_MOV(jc, gen_restride(gen_retype(dst, GEN_TYPE_UB), 1, 1, 0), - gen_restride(gen_retype(SRC(0), GEN_TYPE_UB), 4, 1, 0)); - break; - - case JAY_OPCODE_WORD_PACK: - jc->state.exec_size = 2 * exec_size; - jc_MOV(jc, gen_retype(dst, GEN_TYPE_UW), - gen_subscript(jc->devinfo, SRC(0), GEN_TYPE_UW, 0)); - break; - case JAY_OPCODE_SHR_ODD_SUBSPANS_BY_4: jc_append2(GEN_OP_SHR, dst, SRC(0), gen_imm_uv(0x44440000)); break;