nir: Collect if shader uses cross-invocation or indirect I/O.

The following new fields are added to tess shader info:

* `tcs_cross_invocation_inputs_read`
* `tcs_cross_invocation_outputs_read`

These are I/O masks that are a subset of inputs_read and outputs_read
and they contain which per-vertex inputs and outputs are read
cross-invocation.

Additionall, the following new fields are added to shader_info:

* `inputs_read_indirectly`
* `outputs_accessed_indirectly`
* `patch_inputs_read_indirectly`
* `patch_outputs_accessed_indirectly`

These new fields can be used for optimizing TCS in a back-end compiler.
If you can be sure that the TCS doesn't use cross-invocation inputs
or outputs, you can choose a different strategy for storing VS and TCS
outputs. However, such optimizations might need to be disabled when
the inputs/outputs are accessed indirectly due to backend limitations,
so this information is also collected.

Example: RADV currently has to store all VS and TCS outputs in LDS, but
for shaders when only inputs and/or outputs belonging to the current
invocation ID are used, it could skip storing these in LDS entirely.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4165>
This commit is contained in:
Timur Kristóf
2020-03-13 10:14:37 +01:00
committed by Marge Bot
parent e7d733fdab
commit f1dd81ae10
2 changed files with 110 additions and 13 deletions

View File

@@ -134,6 +134,15 @@ typedef struct shader_info {
/* Which patch outputs are read */
uint32_t patch_outputs_read;
/* Which inputs are read indirectly (subset of inputs_read) */
uint64_t inputs_read_indirectly;
/* Which outputs are read or written indirectly */
uint64_t outputs_accessed_indirectly;
/* Which patch inputs are read indirectly (subset of patch_inputs_read) */
uint64_t patch_inputs_read_indirectly;
/* Which patch outputs are read or written indirectly */
uint64_t patch_outputs_accessed_indirectly;
/** Bitfield of which textures are used */
uint32_t textures_used;
@@ -321,6 +330,16 @@ typedef struct shader_info {
uint8_t tcs_vertices_out;
enum gl_tess_spacing spacing:2;
/* Bit mask of TCS per-vertex inputs (VS outputs) that are used
* with a vertex index that is NOT the invocation id
*/
uint64_t tcs_cross_invocation_inputs_read;
/* Bit mask of TCS per-vertex outputs that are used
* with a vertex index that is NOT the invocation id
*/
uint64_t tcs_cross_invocation_outputs_read;
/** Is the vertex order counterclockwise? */
bool ccw:1;
bool point_mode:1;