mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
brw: Fix size in assembler when compacting
Calculation was wrongly walking uncompacted instructions, even if we had
some compacted in the middle, generating invalid size. Since we are
here just drop the instruction count, since in practice the caller will
have to walk the instruction stream anyway.
Fixes: 6267585778 ("intel/brw: Also return the size of the assembled shader")
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33532>
This commit is contained in:
parent
08483e9bfa
commit
dd1ca1588d
3 changed files with 4 additions and 17 deletions
|
|
@ -135,22 +135,11 @@ brw_assemble(void *mem_ctx, const struct intel_device_info *devinfo,
|
|||
goto end;
|
||||
}
|
||||
|
||||
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_eu_inst *inst = result.bin + i;
|
||||
if (brw_eu_inst_cmpt_control(devinfo, inst))
|
||||
compacted++;
|
||||
}
|
||||
result.bin_size -= compacted * 8;
|
||||
}
|
||||
result.bin = p->store;
|
||||
result.bin_size = p->next_insn_offset;
|
||||
|
||||
if ((flags & BRW_ASSEMBLE_DUMP) != 0)
|
||||
dump_assembly(p->store, 0, p->next_insn_offset, disasm_info, NULL);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ struct intel_device_info;
|
|||
typedef struct {
|
||||
void *bin;
|
||||
int bin_size;
|
||||
int inst_count;
|
||||
} brw_assemble_result;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ int main(int argc, char **argv)
|
|||
FILE *output = stdout;
|
||||
bool help = false, compact = false;
|
||||
uint64_t pci_id = 0;
|
||||
int offset = 0;
|
||||
struct intel_device_info *devinfo = NULL;
|
||||
int result = EXIT_FAILURE;
|
||||
|
||||
|
|
@ -237,7 +236,7 @@ int main(int argc, char **argv)
|
|||
if (output_type == OPT_OUTPUT_C_LITERAL)
|
||||
fprintf(output, "{\n");
|
||||
|
||||
for (int i = 0; i < r.inst_count; i++) {
|
||||
for (int offset = 0; offset < r.bin_size;) {
|
||||
const brw_eu_inst *insn = r.bin + offset;
|
||||
bool compacted = false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue