Log which patterns are triggered in opt_algebraic
nir_opt_algebraic.py
is a mess. It's huge. It's only semi-organized. There are likely a ton of redundant patterns. !3786 (merged) identified literally redundant patterns, but I'm sure that there are also practically redundant patterns. That is, a sequence of general patterns makes another more specific pattern redundant because the general patterns accomplish in a couple steps what the specific pattern does in a single step. See also the patterns removed in 5544b2cb.
Properly detecting this is a difficult problem. Some tools could help us detect some cases. One tool that I've had in the back of my mind for a long time is for the algebraic optimization passes to somehow log which patterns are triggered. We could then collect that coverage data across a shader-db, vkpipeline-db, or CI run. This coverage data could then be used to either help remove redundant patterns or drive the development of new test cases. When adding new patterns to nir_opt_algebraic
, it would be useful to compare before and after coverage.