intel/brw: Also return the size of the assembled shader

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30062>
This commit is contained in:
Caio Oliveira 2024-07-05 11:47:42 -07:00 committed by Marge Bot
parent f6e7d1dca2
commit 6267585778
2 changed files with 13 additions and 1 deletions

View file

@ -129,11 +129,22 @@ brw_assemble(void *mem_ctx, const struct intel_device_info *devinfo,
} }
result.bin = p->store; result.bin = p->store;
result.bin_size = p->next_insn_offset;
result.inst_count = p->next_insn_offset / 16; result.inst_count = p->next_insn_offset / 16;
if ((flags & BRW_ASSEMBLE_COMPACT) != 0) if ((flags & BRW_ASSEMBLE_COMPACT) != 0) {
brw_compact_instructions(p, 0, disasm_info); brw_compact_instructions(p, 0, disasm_info);
/* Adjust bin size to account for compacted instructions. */
int compacted = 0;
for (int i = 0; i < result.inst_count; i++) {
const brw_inst *inst = result.bin + i;
if (brw_inst_cmpt_control(devinfo, inst))
compacted++;
}
result.bin_size -= compacted * 8;
}
ralloc_free(disasm_info); ralloc_free(disasm_info);
end: end:

View file

@ -13,6 +13,7 @@ struct intel_device_info;
typedef struct { typedef struct {
void *bin; void *bin;
int bin_size;
int inst_count; int inst_count;
} brw_assemble_result; } brw_assemble_result;