Skip to content

radv: Lower VS inputs in NIR.

Timur Kristóf requested to merge Venemo/mesa:radv_lower_vs_input into main

This MR implements vertex shader input loads in NIR, thereby removing ACO's dependency on RADV VS input details. As a result, we can also delete a bunch of code from ACO and RADV/LLVM.

  • A new NIR intrinsic load_typed_buffer_amd is introduced for handling loads with vertex format
  • Implement the new intrinsic on both backends, including several fixes to the old load_buffer_amd in LLVM so that it now is able to handle the requirements of VS input loads
  • VS load_input intrinsics are lowered to load_buffer_amd / load_typed_buffer_amd with no loss of functionality


  • Due to the state of the RADV/LLVM CI, I only checked that dEQP-VK.pipeline.monolithic.vertex_input.* pass on RADV/LLVM.

Future work:

  • Discuss whether we want to bring back clauses based on vtx_binding
  • Further investigation of our vertex fetch alignment issues
  • Get rid of overwrite_vs_arguments_amd because all uses vertex ID and instance ID are now explicit in NIR

Fossil DB stats on GFX11:

Stats changes are minimal and mostly due to:

  • Better code generation for input loads which turn into zero
  • More s_waitcnt instructions, due to different scheduling, with more clauses (due to lack of vtx_binding)
  • Zero constant is moved up (because of CSE)
  • "RA lottery"

Fossil stats included in the relevant commit messages.

Edited by Timur Kristóf

Merge request reports