nir/lower_subgroups: Lower ballot intrinsics to the specified bit size
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 23 Aug 2017 01:44:51 +0000 (18:44 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 7 Nov 2017 18:37:52 +0000 (10:37 -0800)
commita026458020e947cc5d864cfb5b19660836b2d613
treed6714e0bde4f342c64239d75631a446e71dea98e
parent8c2bf020fd649957597d074cf2390d6de029ddd0
nir/lower_subgroups: Lower ballot intrinsics to the specified bit size

Ballot intrinsics return a bitfield of subgroups.  In GLSL and some
SPIR-V extensions, they return a uint64_t.  In SPV_KHR_shader_ballot,
they return a uvec4.  Also, some back-ends would rather pass around
32-bit values because it's easier than messing with 64-bit all the time.
To solve this mess, we make nir_lower_subgroups take a new parameter
called ballot_bit_size and it lowers whichever thing it gets in from the
source language (uint64_t or uvec4) to a scalar with the specified
number of bits.  This replaces a chunk of the old lowering code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_subgroups.c
src/compiler/nir/nir_opt_intrinsics.c
src/intel/compiler/brw_compiler.c
src/intel/compiler/brw_nir.c