Skip to content

radv: Implement task shader support (compiler-related commits only)

Timur Kristóf requested to merge Venemo/mesa:radv-task-shader into main

Implement task shader support (but not yet the task/mesh draw commands) for the NV_mesh_shader extension.

What is a Task Shader?

Task shader is an optional stage that can run before a Mesh shader in a graphics pipeline. It's a compute-like stage whose primary output is the number of launched mesh shader workgroups (1 task shader workgroup can launch up to 2^22 mesh shader workgroups), and also has an optional payload output which is up to 16K bytes.

Implementations details

Task shaders on RDNA2 work by submitting two queues in parallel: a compute queue which executes the actual task shader (compiled into a compute shader), and a graphics queue which executes the mesh shader and everything else. It is required that the compute submission is added as a scheduled dependency to the graphics submission.

  • NIR, SPIR-V: a new NIR variable mode nir_var_mem_task_payload is added which can represent the task shader output payload. This is necessary because nir_var_shader_out is limited to 32x vec4 generic outputs, so can't fit the 16K.
  • AC: a few new I/O lowering passes are added:
    • Task shader outputs
    • Mesh shader inputs
    • Emulation of firstTask in Task shaders (not supported natively by the hardware)
  • RADV:
    • Add ability to do the compute submission as a dependency of the graphics submission
    • Compile and execute task shaders

Future work, planned as follow-up

  • Task + Mesh shader draw calls
Edited by Timur Kristóf

Merge request reports

Loading