nir/lower_subgroups: Properly lower masks when subgroup_size == 0
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 11 Jul 2019 03:20:00 +0000 (22:20 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 24 Jul 2019 17:55:40 +0000 (12:55 -0500)
commit799f0f7b28b90162a4c0a3e697c6d753e7528652
tree3ad35f09f8b7a20f491ea698e65436595d7f7fe4
parent256e6c2d942b011b5b362eaaa2cc4d9871486d0d
nir/lower_subgroups: Properly lower masks when subgroup_size == 0

Instead of building a constant mask (which depends on knowing the
subgroup size), we build an expression.  Because the pass uses the
nir_shader_lower_instructions helper, subgroup lowering will be run on
any newly emitted instructions as well as the previously existing
instructions.  In particular, if the subgroup size is known, the newly
emitted subgroup_size intrinsic will get turned into a constant and a
later constant folding pass will clean it up.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/nir/nir_lower_subgroups.c