diff --git a/src/intel/compiler/brw_asm.c b/src/intel/compiler/brw_asm.c index 10793e94a9d..1fc2211c3f8 100644 --- a/src/intel/compiler/brw_asm.c +++ b/src/intel/compiler/brw_asm.c @@ -129,11 +129,22 @@ brw_assemble(void *mem_ctx, const struct intel_device_info *devinfo, } result.bin = p->store; + result.bin_size = p->next_insn_offset; 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); + /* 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); end: diff --git a/src/intel/compiler/brw_asm.h b/src/intel/compiler/brw_asm.h index faf723269f0..20a79d6199f 100644 --- a/src/intel/compiler/brw_asm.h +++ b/src/intel/compiler/brw_asm.h @@ -13,6 +13,7 @@ struct intel_device_info; typedef struct { void *bin; + int bin_size; int inst_count; } brw_assemble_result;