Repository navigation
[spirv] Consolidate command-line option usage - #3674
Conversation
MLIR allows one to declare pass (pipeline) options directly on the pass (pipeline) class. While convenient, it can be problematic when we need to organize the pass into a pipeline into some other bigger pipeline. It ends up that we need to duplicate the same command-line option three times: in the pass itself for testing with the pass directly, in the pass pipeline in order to test via the pass pipeline, and finally in the pass pipeline caller again for constructing the pass pipeline. This commit consolidates the above into one place where we define a single copy of the command-line option and use helper functions to read it wherever it's needed. Fixes iree-org#3640
MaheshRavishankar
left a comment
There was a problem hiding this comment.
Awesome! Thanks Lei, was hoping for something like this (partly the reason SPIRVCodegenOptions exists in the first place).
Just one nit though, instead of many iree-spirv-... flags (which is very LLVM), can we have a single flag with options? iree-spirv-options{...}. One way to make that happen is have a pass that contains these options as a pass-specific options. That pass then makes generates the SPIRVCodegenOptions which can be used wherever necessary. We get the same ergonomics of the pass options in MLIR and still have a single place to put everything.
|
I think eventually most of these options will be gone: vectorization should be default on and workgroup memory should be default on pending the target environment. I think what we have is an intermediate state here. I feel the benefits of trying to future improve to save a few characteristics in the cl invocation is arguable. Also trying to shoehorn these options into Pass specific options is quite unintuitive: it would be quite surprising for me at least that Pass (pipeline) A/B/C's option comes from another Pass D. WDYT? |
MLIR allows one to declare pass (pipeline) options directly on the
pass (pipeline) class. While convenient, it can be problematic when
we need to organize the pass into a pipeline into some other bigger
pipeline. It ends up that we need to duplicate the same command-line
option three times: in the pass itself for testing with the pass
directly, in the pass pipeline in order to test via the pass pipeline,
and finally in the pass pipeline caller again for constructing the
pass pipeline.
This commit consolidates the above into one place where we define
a single copy of the command-line option and use helper functions
to read it wherever it's needed.
Fixes #3640