ir3/ra: Handle huge merge sets

It can happen that we create an enormous merge set, even larger than the
entire register file, in which case find_best_gap() would loop
infinitely. This seems to be triggered more often with
IR3_SHADER_DEBUG=spillall, since it actually happened with a CTS test.
Just bail out in that case.

Fixes: 0ffcb19b9d ("ir3: Rewrite register allocation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
This commit is contained in:
Connor Abbott
2021-07-23 11:59:34 +02:00
committed by Marge Bot
parent 70c22d3894
commit efb34d6ee6
+6
View File
@@ -965,6 +965,12 @@ static physreg_t
find_best_gap(struct ra_file *file, unsigned file_size, unsigned size,
unsigned align, bool is_source)
{
/* This can happen if we create a very large merge set. Just bail out in that
* case.
*/
if (size > file_size)
return (physreg_t) ~0;
BITSET_WORD *available =
is_source ? file->available_to_evict : file->available;