From 06ccaad5f19719ded6fe32d371aa4b4b78774194 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Sat, 14 Dec 2024 21:00:44 -0800 Subject: [PATCH] intel/brw: Rename brw_compact_inst to brw_eu_compact_inst Consistent with brw_eu_inst. Acked-by: Sagar Ghuge Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_eu.c | 8 +-- src/intel/compiler/brw_eu.h | 4 +- src/intel/compiler/brw_eu_compact.c | 70 +++++++++++++------------- src/intel/compiler/brw_eu_inst.h | 20 ++++---- src/intel/compiler/brw_eu_validate.c | 4 +- src/intel/compiler/test_eu_compact.cpp | 4 +- 6 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/intel/compiler/brw_eu.c b/src/intel/compiler/brw_eu.c index f9358ed25d7..52b4dfa3a95 100644 --- a/src/intel/compiler/brw_eu.c +++ b/src/intel/compiler/brw_eu.c @@ -451,7 +451,7 @@ brw_label_assembly(const struct brw_isa_info *isa, bool is_compact = brw_inst_cmpt_control(devinfo, inst); if (is_compact) { - brw_compact_inst *compacted = (brw_compact_inst *)inst; + brw_eu_compact_inst *compacted = (brw_eu_compact_inst *)inst; brw_uncompact_instruction(isa, &uncompacted, compacted); inst = &uncompacted; } @@ -469,7 +469,7 @@ brw_label_assembly(const struct brw_isa_info *isa, } if (is_compact) { - offset += sizeof(brw_compact_inst); + offset += sizeof(brw_eu_compact_inst); } else { offset += sizeof(brw_eu_inst); } @@ -516,7 +516,7 @@ brw_disassemble(const struct brw_isa_info *isa, fprintf(out, "0x%08x: ", offset); if (compacted) { - brw_compact_inst *compacted = (brw_compact_inst *)insn; + brw_eu_compact_inst *compacted = (brw_eu_compact_inst *)insn; if (dump_hex) { unsigned char * insn_ptr = ((unsigned char *)&insn[0]); const unsigned int blank_spaces = 24; @@ -551,7 +551,7 @@ brw_disassemble(const struct brw_isa_info *isa, brw_disassemble_inst(out, isa, insn, compacted, offset, root_label); if (compacted) { - offset += sizeof(brw_compact_inst); + offset += sizeof(brw_eu_compact_inst); } else { offset += sizeof(brw_eu_inst); } diff --git a/src/intel/compiler/brw_eu.h b/src/intel/compiler/brw_eu.h index eac3a052add..e745ba257a1 100644 --- a/src/intel/compiler/brw_eu.h +++ b/src/intel/compiler/brw_eu.h @@ -1572,9 +1572,9 @@ enum brw_conditional_mod brw_swap_cmod(enum brw_conditional_mod cmod); void brw_compact_instructions(struct brw_codegen *p, int start_offset, struct disasm_info *disasm); void brw_uncompact_instruction(const struct brw_isa_info *isa, - brw_eu_inst *dst, brw_compact_inst *src); + brw_eu_inst *dst, brw_eu_compact_inst *src); bool brw_try_compact_instruction(const struct brw_isa_info *isa, - brw_compact_inst *dst, const brw_eu_inst *src); + brw_eu_compact_inst *dst, const brw_eu_inst *src); void brw_debug_compact_uncompact(const struct brw_isa_info *isa, brw_eu_inst *orig, brw_eu_inst *uncompacted); diff --git a/src/intel/compiler/brw_eu_compact.c b/src/intel/compiler/brw_eu_compact.c index 5e73a80e9c9..dcfa4122178 100644 --- a/src/intel/compiler/brw_eu_compact.c +++ b/src/intel/compiler/brw_eu_compact.c @@ -926,7 +926,7 @@ static void compaction_state_init(struct compaction_state *c, static bool set_control_index(const struct compaction_state *c, - brw_compact_inst *dst, const brw_eu_inst *src) + brw_eu_compact_inst *dst, const brw_eu_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; uint32_t uncompacted; /* 19b/IVB+; 21b/TGL+ */ @@ -971,7 +971,7 @@ set_control_index(const struct compaction_state *c, } static bool -set_datatype_index(const struct compaction_state *c, brw_compact_inst *dst, +set_datatype_index(const struct compaction_state *c, brw_eu_compact_inst *dst, const brw_eu_inst *src, bool is_immediate) { const struct intel_device_info *devinfo = c->isa->devinfo; @@ -1011,7 +1011,7 @@ set_datatype_index(const struct compaction_state *c, brw_compact_inst *dst, } static bool -set_subreg_index(const struct compaction_state *c, brw_compact_inst *dst, +set_subreg_index(const struct compaction_state *c, brw_eu_compact_inst *dst, const brw_eu_inst *src, bool is_immediate) { const struct intel_device_info *devinfo = c->isa->devinfo; @@ -1049,7 +1049,7 @@ set_subreg_index(const struct compaction_state *c, brw_compact_inst *dst, } static bool -set_src0_index(const struct compaction_state *c, brw_compact_inst *dst, +set_src0_index(const struct compaction_state *c, brw_eu_compact_inst *dst, const brw_eu_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; @@ -1082,7 +1082,7 @@ set_src0_index(const struct compaction_state *c, brw_compact_inst *dst, } static bool -set_src1_index(const struct compaction_state *c, brw_compact_inst *dst, +set_src1_index(const struct compaction_state *c, brw_eu_compact_inst *dst, const brw_eu_inst *src, bool is_immediate, unsigned imm) { const struct intel_device_info *devinfo = c->isa->devinfo; @@ -1132,7 +1132,7 @@ set_src1_index(const struct compaction_state *c, brw_compact_inst *dst, static bool set_3src_control_index(const struct intel_device_info *devinfo, - brw_compact_inst *dst, const brw_eu_inst *src, + brw_eu_compact_inst *dst, const brw_eu_inst *src, bool is_dpas) { if (devinfo->ver >= 20) { @@ -1242,7 +1242,7 @@ set_3src_control_index(const struct intel_device_info *devinfo, static bool set_3src_source_index(const struct intel_device_info *devinfo, - brw_compact_inst *dst, const brw_eu_inst *src, + brw_eu_compact_inst *dst, const brw_eu_inst *src, bool is_dpas) { if (devinfo->ver >= 12) { @@ -1307,7 +1307,7 @@ set_3src_source_index(const struct intel_device_info *devinfo, static bool set_3src_subreg_index(const struct intel_device_info *devinfo, - brw_compact_inst *dst, const brw_eu_inst *src) + brw_eu_compact_inst *dst, const brw_eu_inst *src) { assert(devinfo->ver >= 12); @@ -1389,7 +1389,7 @@ has_3src_unmapped_bits(const struct intel_device_info *devinfo, static bool brw_try_compact_3src_instruction(const struct brw_isa_info *isa, - brw_compact_inst *dst, const brw_eu_inst *src) + brw_eu_compact_inst *dst, const brw_eu_inst *src) { const struct intel_device_info *devinfo = isa->devinfo; @@ -1698,10 +1698,10 @@ precompact(const struct brw_isa_info *isa, brw_eu_inst inst) */ static bool try_compact_instruction(const struct compaction_state *c, - brw_compact_inst *dst, const brw_eu_inst *src) + brw_eu_compact_inst *dst, const brw_eu_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; - brw_compact_inst temp; + brw_eu_compact_inst temp; assert(brw_inst_cmpt_control(devinfo, src) == 0); @@ -1790,7 +1790,7 @@ try_compact_instruction(const struct compaction_state *c, bool brw_try_compact_instruction(const struct brw_isa_info *isa, - brw_compact_inst *dst, const brw_eu_inst *src) + brw_eu_compact_inst *dst, const brw_eu_inst *src) { struct compaction_state c; compaction_state_init(&c, isa); @@ -1799,7 +1799,7 @@ brw_try_compact_instruction(const struct brw_isa_info *isa, static void set_uncompacted_control(const struct compaction_state *c, brw_eu_inst *dst, - brw_compact_inst *src) + brw_eu_compact_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; uint32_t uncompacted = @@ -1837,7 +1837,7 @@ set_uncompacted_control(const struct compaction_state *c, brw_eu_inst *dst, static void set_uncompacted_datatype(const struct compaction_state *c, brw_eu_inst *dst, - brw_compact_inst *src) + brw_eu_compact_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; uint32_t uncompacted = @@ -1863,7 +1863,7 @@ set_uncompacted_datatype(const struct compaction_state *c, brw_eu_inst *dst, static void set_uncompacted_subreg(const struct compaction_state *c, brw_eu_inst *dst, - brw_compact_inst *src) + brw_eu_compact_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; uint16_t uncompacted = @@ -1887,7 +1887,7 @@ set_uncompacted_subreg(const struct compaction_state *c, brw_eu_inst *dst, static void set_uncompacted_src0(const struct compaction_state *c, brw_eu_inst *dst, - brw_compact_inst *src) + brw_eu_compact_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; uint32_t compacted = brw_compact_inst_src0_index(devinfo, src); @@ -1908,7 +1908,7 @@ set_uncompacted_src0(const struct compaction_state *c, brw_eu_inst *dst, static void set_uncompacted_src1(const struct compaction_state *c, brw_eu_inst *dst, - brw_compact_inst *src) + brw_eu_compact_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; uint16_t uncompacted = @@ -1934,7 +1934,7 @@ set_uncompacted_src1(const struct compaction_state *c, brw_eu_inst *dst, static void set_uncompacted_3src_control_index(const struct compaction_state *c, - brw_eu_inst *dst, brw_compact_inst *src, + brw_eu_inst *dst, brw_eu_compact_inst *src, bool is_dpas) { const struct intel_device_info *devinfo = c->isa->devinfo; @@ -2019,7 +2019,7 @@ set_uncompacted_3src_control_index(const struct compaction_state *c, static void set_uncompacted_3src_source_index(const struct intel_device_info *devinfo, - brw_eu_inst *dst, brw_compact_inst *src, + brw_eu_inst *dst, brw_eu_compact_inst *src, bool is_dpas) { uint32_t compacted = brw_compact_inst_3src_source_index(devinfo, src); @@ -2064,7 +2064,7 @@ set_uncompacted_3src_source_index(const struct intel_device_info *devinfo, static void set_uncompacted_3src_subreg_index(const struct intel_device_info *devinfo, - brw_eu_inst *dst, brw_compact_inst *src) + brw_eu_inst *dst, brw_eu_compact_inst *src) { assert(devinfo->ver >= 12); @@ -2080,7 +2080,7 @@ set_uncompacted_3src_subreg_index(const struct intel_device_info *devinfo, static void brw_uncompact_3src_instruction(const struct compaction_state *c, - brw_eu_inst *dst, brw_compact_inst *src, bool is_dpas) + brw_eu_inst *dst, brw_eu_compact_inst *src, bool is_dpas) { const struct intel_device_info *devinfo = c->isa->devinfo; @@ -2127,7 +2127,7 @@ brw_uncompact_3src_instruction(const struct compaction_state *c, static void uncompact_instruction(const struct compaction_state *c, brw_eu_inst *dst, - brw_compact_inst *src) + brw_eu_compact_inst *src) { const struct intel_device_info *devinfo = c->isa->devinfo; memset(dst, 0, sizeof(*dst)); @@ -2184,7 +2184,7 @@ uncompact_instruction(const struct compaction_state *c, brw_eu_inst *dst, void brw_uncompact_instruction(const struct brw_isa_info *isa, - brw_eu_inst *dst, brw_compact_inst *src) + brw_eu_inst *dst, brw_eu_compact_inst *src) { struct compaction_state c; compaction_state_init(&c, isa); @@ -2349,7 +2349,7 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, * (in 16-byte units) before compaction. */ unsigned num_old_ip = - (p->next_insn_offset - start_offset) / sizeof(brw_compact_inst) + 1; + (p->next_insn_offset - start_offset) / sizeof(brw_eu_compact_inst) + 1; int *old_ip = calloc(1, sizeof(*old_ip) * num_old_ip); struct compaction_state c; @@ -2362,7 +2362,7 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, brw_eu_inst *src = store + src_offset; void *dst = store + offset; - old_ip[offset / sizeof(brw_compact_inst)] = src_offset / sizeof(brw_eu_inst); + old_ip[offset / sizeof(brw_eu_compact_inst)] = src_offset / sizeof(brw_eu_inst); compacted_counts[src_offset / sizeof(brw_eu_inst)] = compacted_count; brw_eu_inst inst = precompact(p->isa, *src); @@ -2381,7 +2381,7 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, } } - offset += sizeof(brw_compact_inst); + offset += sizeof(brw_eu_compact_inst); } else { /* If we didn't compact this instruction, we need to move it down into * place. @@ -2396,7 +2396,7 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, /* Add an entry for the ending offset of the program. This greatly * simplifies the linked list walk at the end of the function. */ - old_ip[offset / sizeof(brw_compact_inst)] = + old_ip[offset / sizeof(brw_eu_compact_inst)] = (p->next_insn_offset - start_offset) / sizeof(brw_eu_inst); /* Fix up control flow offsets. */ @@ -2404,7 +2404,7 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, for (offset = 0; offset < p->next_insn_offset - start_offset; offset = next_offset(devinfo, store, offset)) { brw_eu_inst *insn = store + offset; - int this_old_ip = old_ip[offset / sizeof(brw_compact_inst)]; + int this_old_ip = old_ip[offset / sizeof(brw_eu_compact_inst)]; int this_compacted_count = compacted_counts[this_old_ip]; switch (brw_inst_opcode(p->isa, insn)) { @@ -2421,12 +2421,12 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, if (brw_inst_cmpt_control(devinfo, insn)) { brw_eu_inst uncompacted; uncompact_instruction(&c, &uncompacted, - (brw_compact_inst *)insn); + (brw_eu_compact_inst *)insn); update_uip_jip(p->isa, &uncompacted, this_old_ip, compacted_counts); - bool ret = try_compact_instruction(&c, (brw_compact_inst *)insn, + bool ret = try_compact_instruction(&c, (brw_eu_compact_inst *)insn, &uncompacted); assert(ret); (void)ret; } else { @@ -2466,13 +2466,13 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, * alignment padding, so that the next compression pass (for the FS 8/16 * compile passes) parses correctly. */ - if (p->next_insn_offset & sizeof(brw_compact_inst)) { - brw_compact_inst *align = store + offset; + if (p->next_insn_offset & sizeof(brw_eu_compact_inst)) { + brw_eu_compact_inst *align = store + offset; memset(align, 0, sizeof(*align)); brw_compact_inst_set_hw_opcode( devinfo, align, brw_opcode_encode(p->isa, BRW_OPCODE_NOP)); brw_compact_inst_set_cmpt_control(devinfo, align, true); - p->next_insn_offset += sizeof(brw_compact_inst); + p->next_insn_offset += sizeof(brw_eu_compact_inst); } p->nr_insn = p->next_insn_offset / sizeof(brw_eu_inst); @@ -2490,9 +2490,9 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset, int offset = 0; foreach_list_typed(struct inst_group, group, link, &disasm->group_list) { - while (start_offset + old_ip[offset / sizeof(brw_compact_inst)] * + while (start_offset + old_ip[offset / sizeof(brw_eu_compact_inst)] * sizeof(brw_eu_inst) != group->offset) { - assert(start_offset + old_ip[offset / sizeof(brw_compact_inst)] * + assert(start_offset + old_ip[offset / sizeof(brw_eu_compact_inst)] * sizeof(brw_eu_inst) < group->offset); offset = next_offset(devinfo, store, offset); } diff --git a/src/intel/compiler/brw_eu_inst.h b/src/intel/compiler/brw_eu_inst.h index 6a932e4a28e..2e6f9dead87 100644 --- a/src/intel/compiler/brw_eu_inst.h +++ b/src/intel/compiler/brw_eu_inst.h @@ -1253,7 +1253,7 @@ brw_inst_set_bits(brw_eu_inst *inst, unsigned high, unsigned low, uint64_t value typedef struct { uint64_t data; -} brw_compact_inst; +} brw_eu_compact_inst; /** * Fetch a set of contiguous bits from the compacted instruction. @@ -1261,7 +1261,7 @@ typedef struct { * Bits indices range from 0..63. */ static inline unsigned -brw_compact_inst_bits(const brw_compact_inst *inst, unsigned high, unsigned low) +brw_compact_inst_bits(const brw_eu_compact_inst *inst, unsigned high, unsigned low) { assume(high < 64); assume(high >= low); @@ -1276,7 +1276,7 @@ brw_compact_inst_bits(const brw_compact_inst *inst, unsigned high, unsigned low) * Bits indices range from 0..63. */ static inline void -brw_compact_inst_set_bits(brw_compact_inst *inst, unsigned high, unsigned low, +brw_compact_inst_set_bits(brw_eu_compact_inst *inst, unsigned high, unsigned low, uint64_t value) { assume(high < 64); @@ -1293,7 +1293,7 @@ brw_compact_inst_set_bits(brw_compact_inst *inst, unsigned high, unsigned low, static inline void \ brw_compact_inst_set_##name(const struct \ intel_device_info *devinfo, \ - brw_compact_inst *inst, unsigned v) \ + brw_eu_compact_inst *inst, unsigned v) \ { \ assert(assertions); \ if (devinfo->ver >= 12) \ @@ -1303,7 +1303,7 @@ brw_compact_inst_set_##name(const struct \ } \ static inline unsigned \ brw_compact_inst_##name(const struct intel_device_info *devinfo, \ - const brw_compact_inst *inst) \ + const brw_eu_compact_inst *inst) \ { \ assert(assertions); \ if (devinfo->ver >= 12) \ @@ -1324,7 +1324,7 @@ brw_compact_inst_##name(const struct intel_device_info *devinfo, \ static inline void \ brw_compact_inst_set_##name(const struct \ intel_device_info *devinfo, \ - brw_compact_inst *inst, unsigned v) \ + brw_eu_compact_inst *inst, unsigned v) \ { \ if (devinfo->ver >= 20) \ brw_compact_inst_set_bits(inst, hi20, lo20, v); \ @@ -1335,7 +1335,7 @@ brw_compact_inst_set_##name(const struct \ } \ static inline unsigned \ brw_compact_inst_##name(const struct intel_device_info *devinfo, \ - const brw_compact_inst *inst) \ + const brw_eu_compact_inst *inst) \ { \ if (devinfo->ver >= 20) \ return brw_compact_inst_bits(inst, hi20, lo20); \ @@ -1353,7 +1353,7 @@ brw_compact_inst_##name(const struct intel_device_info *devinfo, \ static inline void \ brw_compact_inst_set_##name(const struct \ intel_device_info *devinfo, \ - brw_compact_inst *inst, unsigned v) \ + brw_eu_compact_inst *inst, unsigned v) \ { \ if (devinfo->ver >= 20) { \ const unsigned k = hi20 - lo20 + 1; \ @@ -1367,7 +1367,7 @@ brw_compact_inst_set_##name(const struct \ } \ static inline unsigned \ brw_compact_inst_##name(const struct intel_device_info *devinfo, \ - const brw_compact_inst *inst) \ + const brw_eu_compact_inst *inst) \ { \ if (devinfo->ver >= 20) { \ const unsigned k = hi20 - lo20 + 1; \ @@ -1397,7 +1397,7 @@ F(hw_opcode, /* 9+ */ 6, 0, /* 12+ */ 6, 0) /* Same location as brw_ static inline unsigned brw_compact_inst_imm(const struct intel_device_info *devinfo, - const brw_compact_inst *inst) + const brw_eu_compact_inst *inst) { if (devinfo->ver >= 12) { return brw_compact_inst_bits(inst, 63, 52); diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c index 78d293c92ed..8d495e2ff00 100644 --- a/src/intel/compiler/brw_eu_validate.c +++ b/src/intel/compiler/brw_eu_validate.c @@ -2832,12 +2832,12 @@ brw_validate_instructions(const struct brw_isa_info *isa, for (int src_offset = start_offset; src_offset < end_offset;) { const brw_eu_inst *inst = assembly + src_offset; bool is_compact = brw_inst_cmpt_control(devinfo, inst); - unsigned inst_size = is_compact ? sizeof(brw_compact_inst) + unsigned inst_size = is_compact ? sizeof(brw_eu_compact_inst) : sizeof(brw_eu_inst); brw_eu_inst uncompacted; if (is_compact) { - brw_compact_inst *compacted = (void *)inst; + brw_eu_compact_inst *compacted = (void *)inst; brw_uncompact_instruction(isa, &uncompacted, compacted); inst = &uncompacted; } diff --git a/src/intel/compiler/test_eu_compact.cpp b/src/intel/compiler/test_eu_compact.cpp index 00ad11f93e9..6b0457109de 100644 --- a/src/intel/compiler/test_eu_compact.cpp +++ b/src/intel/compiler/test_eu_compact.cpp @@ -57,7 +57,7 @@ get_compact_params_name(const testing::TestParamInfo p) static bool test_compact_instruction(struct brw_codegen *p, brw_eu_inst src) { - brw_compact_inst dst; + brw_eu_compact_inst dst; memset(&dst, 0xd0, sizeof(dst)); if (brw_try_compact_instruction(p->isa, &dst, &src)) { @@ -69,7 +69,7 @@ test_compact_instruction(struct brw_codegen *p, brw_eu_inst src) return false; } } else { - brw_compact_inst unchanged; + brw_eu_compact_inst unchanged; memset(&unchanged, 0xd0, sizeof(unchanged)); /* It's not supposed to change dst unless it compacted. */ if (memcmp(&unchanged, &dst, sizeof(dst))) {