Skip to content

WIP: NIR: Add a general pass framework

Faith Ekstrand requested to merge gfxstrand/mesa:review/nir-pass into main

This MR is the revitalization of a very old series of mine from 2015:

https://patchwork.freedesktop.org/series/251/

The idea is to add a general pass-running framework for NIR to help sort out some of the metadata issues and reduce boilerplate. Bringing this back was largely inspired by the positive feedback from !1319 (merged).

Why do we want a pass managing framework? A number of reasons:

  1. Remove redundancy. Right now, every NIR pass has a pile of boilerplate which authors of new passes just copy+paste every time.
  2. Passes need to stop doing their own metadata management. We've had a number of issues with passes not doing metadata management correctly and if the pass runner handles it, we're less likely to get it wrong.
  3. Allow for a future in which passes can declare certain clean-ups such as constant folding or copy-prop required after that pass is run.
  4. Allow for a smart runner that can run multiple passes at once to improve caching. The most obvious application of this would be to run constant-folding or copy-prop along side a pass that very sloppily emits piles of builder code.
Edited by Jordan Justen

Merge request reports