aco/isel: added test-case for iterative cf visitor
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

isel.cf.deep_traversal is a new ACO test that verifies
that the iterative nir cf visitor allows arbitrary depth.
A depth of 10000 would cause a stack overflow on x86-64 linux
(4096 kB stack) for the old recursive code. This test
is by default not enabled.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40364>
This commit is contained in:
Olle Lögdahl 2026-04-06 14:15:26 +02:00 committed by Marge Bot
parent aa49d69ea0
commit c69da756d1

View file

@ -234,6 +234,38 @@ BEGIN_TEST(isel.s_bfe_mask_bits)
pbld.print_ir(VK_SHADER_STAGE_COMPUTE_BIT, "ACO IR", true);
END_TEST
/**
* Test that deeply nested control flow doesn't crash the compiler.
* Each level checks if a divergent value is greater than the depth level.
*/
#if 0
BEGIN_TEST(isel.cf.deep_traversal)
if (!setup_nir_cs(GFX11))
return;
nir_def *input = nir_unit_test_divergent_input(nb, 1, 32, .base = 0);
auto depth = 10000;
for (int i = 0; i < depth; i++) {
nir_def *threshold = nir_imm_int(nb, i);
nir_def *cond = nir_ilt(nb, threshold, input);
nir_push_if(nb, cond);
}
nir_def *val = nir_imm_int(nb, 0);
nir_unit_test_output(nb, val, .base = 2);
for (int i = 0; i < depth; i++) {
nir_pop_if(nb, NULL);
}
finish_isel_test();
//>> s_endpgm
END_TEST
#endif
/**
* loop {
* if (uniform) {