nir: Clean up metadata handling

In my quest to improve NIR function handling, metadata started getting in the way. In particular, the way we only call nir_metadata_preserve() if the pass makes ensuring that progress makes it difficult to verify that metadata dirtying is happening properly. This series approaches this problem as follows:

  1. A couple misc. NIR fixes
  2. Make nir_metadata_preserve take the pass' progress Boolean as a parameter so the pass calls it every time regardless of progress.
  3. Fix up a bunch of passes which weren't calling nir_metadata_preserve() properly.
  4. Change NIR_PASS() and NIR_PASS_V() to require that nir_metadata_preserve() is always called by the pass.
  5. Fix a bunch of passes I found during the refactor in 2. which were doing their dirty tracking either wrong or at too coarse a granularity.
  6. Add infrastructure to NIR_PASS() and NIR_PASS_V() to verify that, if a pass reports no progress, it does not modify the nir shader in any way. This is done by cloning before and then serializing the before and after shaders and comparing the serialized version.

Note to all NIR-based driver owners

This MR is likely to cause your driver to start assert failing if you have internal driver passes which are not updating metadata correctly. I've tried to fix things up as best as I can but without the ability to run those drivers, stuff is liable to break. Please provide patches to your drivers which I'll add to the series.

Edited by Alyssa Rosenzweig

Merge request reports