mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +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> (cherry picked from commitdd1ca1588d)
This commit is contained in:
parent
5200d13a0f
commit
390317a99e
4 changed files with 5 additions and 18 deletions
|
|
@ -604,7 +604,7 @@
|
|||
"description": "brw: Fix size in assembler when compacting",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "6267585778fac35c89dc6784e175dd88d39672f2",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -133,22 +133,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