mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 19:10:14 +01:00
intel/fs: Linked list micro optimizations in brw_nir_move_interpolation_to_top
Two linked list management changes: - Use the list head sentinel as the initial cursor. It is, after all, a proper node in the list. - Iterate the list of blocks starting with the second block instead of skipping the first block in the loop. On my Ice Lake laptop (using a locked CPU speed and other measures to prevent thermal throttling, etc.) using a release build, improves performance of compiling shaders from batman_arkham_city_goty.foz by -0.24% ± 0.09% (n = 5, pooled s = 0.324106). v2: Use nir_cursor instead of direct list manipultion. Suggested by Lionel. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22299>
This commit is contained in:
parent
78ee74de4a
commit
3037603b70
1 changed files with 5 additions and 12 deletions
|
|
@ -7261,11 +7261,11 @@ brw_nir_move_interpolation_to_top(nir_shader *nir)
|
|||
continue;
|
||||
|
||||
nir_block *top = nir_start_block(f->impl);
|
||||
exec_node *cursor_node = NULL;
|
||||
nir_cursor cursor = nir_before_instr(nir_block_first_instr(top));
|
||||
|
||||
nir_foreach_block(block, f->impl) {
|
||||
if (block == top)
|
||||
continue;
|
||||
for (nir_block *block = nir_block_cf_tree_next(top);
|
||||
block != NULL;
|
||||
block = nir_block_cf_tree_next(block)) {
|
||||
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
|
|
@ -7291,14 +7291,7 @@ brw_nir_move_interpolation_to_top(nir_shader *nir)
|
|||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(move); i++) {
|
||||
if (move[i]->block != top) {
|
||||
move[i]->block = top;
|
||||
exec_node_remove(&move[i]->node);
|
||||
if (cursor_node) {
|
||||
exec_node_insert_after(cursor_node, &move[i]->node);
|
||||
} else {
|
||||
exec_list_push_head(&top->instr_list, &move[i]->node);
|
||||
}
|
||||
cursor_node = &move[i]->node;
|
||||
nir_instr_move(cursor, move[i]);
|
||||
progress = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue