Skip to content

[spirv] Consolidate command-line option usage - #3674

Merged
antiagainst merged 7 commits into
iree-org:mainfrom
antiagainst:cl-options
Nov 6, 2020
Merged

antiagainst merged 7 commits into
iree-org:mainfrom
antiagainst:cl-options

Conversation

@antiagainst

Copy link
Copy Markdown
Member

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

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 MaheshRavishankar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@antiagainst

Copy link
Copy Markdown
Member Author

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?

@antiagainst
antiagainst merged commit 5656bec into iree-org:main Nov 6, 2020
@antiagainst
antiagainst deleted the cl-options branch November 6, 2020 01:29
This was referenced Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve command-line option usage in CodeGen pipeline

2 participants