nak: Fix pre-volta iadd3 panic during compilation

Commit 431a9508a0 added an optimization that inserts a NIR iadd3
instruction, this is not supported in GPUs before volta, thus
when translating NIR into NAK IR the builder would panic.

This commits adds a simple check that disables the optimizations on
pre-volta GPUs.

Fixes: 431a9508a0 ("nak: copy late_algebraic iadd3 rules without the constant restriction")
Signed-off-by: Lorenzo Rossi <snowycoder@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36588>
This commit is contained in:
Lorenzo Rossi 2025-08-05 23:24:47 +02:00 committed by Marge Bot
parent fc8a734849
commit 6383050826

View file

@ -40,8 +40,10 @@ algebraic_lowering = [
(('umax', 'a', 'b'), ('bcsel', ('ult', a, b), b, a), volta),
(('iadd', 'a@64', ('ineg', 'b@64')), ('isub', a, b)),
(('iadd', ('iadd(is_used_once)', 'a(is_not_const)', '#b'), 'c(is_not_const)'), ('iadd3', a, b, c)),
(('iadd', ('iadd(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), '#c'), ('iadd3', a, b, c)),
(('iadd', ('iadd(is_used_once)', 'a(is_not_const)', '#b'), 'c(is_not_const)'),
('iadd3', a, b, c), 'options->has_iadd3'),
(('iadd', ('iadd(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), '#c'),
('iadd3', a, b, c), 'options->has_iadd3'),
(('iadd(is_used_by_non_ldc_nv)', 'a@32', ('ishl', 'b@32', '#s@32')),
('lea_nv', a, b, s), 'nak->sm >= 70'),