intel/compiler: don't allocate compaction arrays on the stack
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7569
Cc: mesa-stable
Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19339>
(cherry picked from commit 920aed2121
)
This commit is contained in:

committed by
Dylan Baker

parent
633ebd0c22
commit
e3a5a7683d
@@ -2083,7 +2083,7 @@
|
||||
"description": "intel/compiler: don't allocate compaction arrays on the stack",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
@@ -3163,7 +3163,7 @@
|
||||
"description": "anv: disable mesh in memcpy",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "ef04caea9b8b98187340fd0ec6550aed06424b60"
|
||||
},
|
||||
|
@@ -2484,19 +2484,25 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset,
|
||||
return;
|
||||
|
||||
const struct intel_device_info *devinfo = p->devinfo;
|
||||
if (devinfo->ver == 4 && devinfo->platform != INTEL_PLATFORM_G4X)
|
||||
return;
|
||||
|
||||
void *store = p->store + start_offset / 16;
|
||||
/* For an instruction at byte offset 16*i before compaction, this is the
|
||||
* number of compacted instructions minus the number of padding NOP/NENOPs
|
||||
* that preceded it.
|
||||
*/
|
||||
int compacted_counts[(p->next_insn_offset - start_offset) / sizeof(brw_inst)];
|
||||
unsigned num_compacted_counts =
|
||||
(p->next_insn_offset - start_offset) / sizeof(brw_inst);
|
||||
int *compacted_counts =
|
||||
calloc(1, sizeof(*compacted_counts) * num_compacted_counts);
|
||||
|
||||
/* For an instruction at byte offset 8*i after compaction, this was its IP
|
||||
* (in 16-byte units) before compaction.
|
||||
*/
|
||||
int old_ip[(p->next_insn_offset - start_offset) / sizeof(brw_compact_inst) + 1];
|
||||
|
||||
if (devinfo->ver == 4 && devinfo->platform != INTEL_PLATFORM_G4X)
|
||||
return;
|
||||
unsigned num_old_ip =
|
||||
(p->next_insn_offset - start_offset) / sizeof(brw_compact_inst) + 1;
|
||||
int *old_ip = calloc(1, sizeof(*old_ip) * num_old_ip);
|
||||
|
||||
struct compaction_state c;
|
||||
compaction_state_init(&c, p->isa);
|
||||
@@ -2683,4 +2689,7 @@ brw_compact_instructions(struct brw_codegen *p, int start_offset,
|
||||
offset = next_offset(devinfo, store, offset);
|
||||
}
|
||||
}
|
||||
|
||||
free(compacted_counts);
|
||||
free(old_ip);
|
||||
}
|
||||
|
Reference in New Issue
Block a user