mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-04 02:18:16 +02:00
jay: merge partition blocks
The way we construct partitions, it is tricky to avoid empty blocks sometimes
leading to mergeable adjacent blocks. Simplify this at runtime.
Stats are kind of a mixed bag but this is the obvious right thing to do.
simd16:
Totals:
Instrs: 2752919 -> 2752284 (-0.02%); split: -0.03%, +0.01%
CodeSize: 41105312 -> 41096640 (-0.02%); split: -0.03%, +0.01%
Totals from 236 (8.92% of 2647) affected shaders:
Instrs: 740015 -> 739380 (-0.09%); split: -0.12%, +0.04%
CodeSize: 11076496 -> 11067824 (-0.08%); split: -0.11%, +0.04%
simd32:
Totals:
Instrs: 4121085 -> 4121638 (+0.01%); split: -0.01%, +0.02%
CodeSize: 61394672 -> 61404720 (+0.02%); split: -0.00%, +0.02%
Totals from 145 (5.48% of 2647) affected shaders:
Instrs: 1104897 -> 1105450 (+0.05%); split: -0.02%, +0.07%
CodeSize: 16845728 -> 16855776 (+0.06%); split: -0.02%, +0.08%
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41808>
This commit is contained in:
parent
598931f653
commit
04236b3912
1 changed files with 33 additions and 16 deletions
|
|
@ -36,25 +36,42 @@ build_partition(jay_shader *shader, struct jay_partition_builder *b, unsigned n)
|
|||
.units_x16[MEM] = 16 / jay_grf_per_gpr(shader),
|
||||
};
|
||||
|
||||
/* Drop empty blocks and merge the resulting neighbours. This avoids needless
|
||||
* partition boundaries that would unnecessarily constrain RA, while allowing
|
||||
* the caller the convenience of passing in holes sometimes.
|
||||
*/
|
||||
signed j = -1;
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
if (b[i].len_grf) {
|
||||
enum jay_file file = b[i].file;
|
||||
unsigned len_gpr = (b[i].len_grf * p->units_x16[file]) / 16;
|
||||
bool grf = file < JAY_NUM_GRF_FILES;
|
||||
assert(p->nr_blocks[file] < JAY_PARTITION_BLOCKS);
|
||||
struct jay_partition_builder B = b[i];
|
||||
if (j >= 0 &&
|
||||
B.file == b[j].file &&
|
||||
B.stride == b[j].stride &&
|
||||
B.type == b[j].type) {
|
||||
|
||||
p->blocks[file][p->nr_blocks[file]++] = (struct jay_register_block) {
|
||||
.start_grf = grf ? base_grf : 0,
|
||||
.start_gpr = base_gpr[file],
|
||||
.len_gpr = (b[i].len_grf * p->units_x16[file]) / 16,
|
||||
.stride = b[i].stride,
|
||||
.type = b[i].type,
|
||||
};
|
||||
b[j].len_grf += B.len_grf;
|
||||
} else if (B.len_grf) {
|
||||
b[++j] = B;
|
||||
}
|
||||
}
|
||||
|
||||
if (file < JAY_NUM_GRF_FILES) {
|
||||
base_grf += b[i].len_grf;
|
||||
base_gpr[file] += len_gpr;
|
||||
}
|
||||
/* Translate to jay_register_block */
|
||||
for (signed i = 0; i <= j; ++i) {
|
||||
enum jay_file file = b[i].file;
|
||||
unsigned len_gpr = (b[i].len_grf * p->units_x16[file]) / 16;
|
||||
bool grf = file < JAY_NUM_GRF_FILES;
|
||||
assert(p->nr_blocks[file] < JAY_PARTITION_BLOCKS);
|
||||
|
||||
p->blocks[file][p->nr_blocks[file]++] = (struct jay_register_block) {
|
||||
.start_grf = grf ? base_grf : 0,
|
||||
.start_gpr = base_gpr[file],
|
||||
.len_gpr = (b[i].len_grf * p->units_x16[file]) / 16,
|
||||
.stride = b[i].stride,
|
||||
.type = b[i].type,
|
||||
};
|
||||
|
||||
if (file < JAY_NUM_GRF_FILES) {
|
||||
base_grf += b[i].len_grf;
|
||||
base_gpr[file] += len_gpr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue