ir3: do not double threadsize when exceeding branchstack limit

We can't support more than compiler->branchstack_size diverging threads
in a wave. Thus, doubling the threadsize is only possible if we don't
exceed the branchstack size limit.

As of blob version 512.490.0 - it doesn't have this heuristics.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9859>
This commit is contained in:
Danylo Piliaiev 2021-03-29 13:55:46 +03:00 committed by Marge Bot
parent c073648d80
commit e7eed45869

View file

@ -112,6 +112,16 @@ should_double_threadsize(struct ir3_shader_variant *v,
unsigned regs_count)
{
const struct ir3_compiler *compiler = v->shader->compiler;
/* We can't support more than compiler->branchstack_size diverging threads
* in a wave. Thus, doubling the threadsize is only possible if we don't
* exceed the branchstack size limit.
*/
if (MIN2(v->branchstack, compiler->threadsize_base * 2) >
compiler->branchstack_size) {
return false;
}
switch (v->type) {
case MESA_SHADER_COMPUTE: {
unsigned threads_per_wg = v->local_size[0] * v->local_size[1] * v->local_size[2];