jay/liveness: speed up physical CFG merging

on top of scheduler changes, compile-time of shaders/blender/1017.shader_test:

Difference at 95.0% confidence
	-0.00173202 +/- 0.00116931
	-0.791537% +/- 0.532384%

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41688>
This commit is contained in:
Alyssa Rosenzweig 2026-05-14 09:00:20 -04:00 committed by Marge Bot
parent 1b50d3eed2
commit 9b68b4e7a1
2 changed files with 20 additions and 7 deletions

View file

@ -1379,6 +1379,13 @@ jay_block_add_successor(jay_block *block, jay_block *succ, enum jay_file file)
}
}
static inline bool
jay_cfg_has_edge(jay_block *pred, jay_block *succ, enum jay_file file)
{
return jay_successors(pred, file)[0] == succ ||
jay_successors(pred, file)[1] == succ;
}
static inline unsigned
jay_source_last_use_bit(const jay_def *srcs, unsigned src_idx)
{

View file

@ -100,21 +100,27 @@ jay_compute_liveness(jay_function *f)
/* Propagate block->live_in[] to the live_out[] of predecessors. Since
* phis are split, they are handled naturally without special cases.
*
* The physical control flow graph is a subset of the logical control flow
* graph. So, edges that are in both can use the fast merge, and other
* edges are physical-only and need to merge only UGPRs.
*/
for (enum jay_file file = GPR; file <= UGPR; ++file) {
jay_foreach_predecessor(block, p, file) {
bool progress = false;
jay_foreach_predecessor(block, p, UGPR) {
bool progress = false;
if (jay_cfg_has_edge(*p, block, GPR)) {
progress = u_sparse_bitset_merge(&(*p)->live_out, &block->live_in);
} else {
U_SPARSE_BITSET_FOREACH_SET(&block->live_in, i) {
if ((file == UGPR) == BITSET_TEST(uniform, i)) {
if (BITSET_TEST(uniform, i)) {
progress |= !u_sparse_bitset_test(&(*p)->live_out, i);
u_sparse_bitset_set(&(*p)->live_out, i);
}
}
}
if (progress) {
jay_worklist_push_tail(&worklist, *p);
}
if (progress) {
jay_worklist_push_tail(&worklist, *p);
}
}
}