nir,intel/compiler: Use a fixed subgroup size
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 23 Aug 2017 01:57:56 +0000 (18:57 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 7 Nov 2017 18:37:52 +0000 (10:37 -0800)
commitab9220edd69fcb7016e15d4d96186eac524b45a4
tree9814f05cb0ebd2154752d48ea72b48c6ad1a21c0
parenta026458020e947cc5d864cfb5b19660836b2d613
nir,intel/compiler: Use a fixed subgroup size

The GL_ARB_shader_ballot spec says that gl_SubGroupSizeARB is declared
as a uniform.  This means that it cannot change across an invocation
such as a draw call or a compute dispatch.  For compute shaders, we're
ok because we only ever use one dispatch size.  For fragment, however,
the hardware dynamically chooses between SIMD8 and SIMD16 which violates
the spec.  Instead, let's just pick a subgroup size based on the shader
stage.  The fixed size we choose for compute shaders is a bit higher
than strictly needed but there's no real harm in that.  The advantage is
that, if they do anything interesting with the value, NIR will see it as
an immediate and can optimize better.

Acked-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/intel/compiler/brw_fs_nir.cpp
src/intel/compiler/brw_nir.c