Repository navigation
Description
To make debugging easier I think it'd be good to remove the nested pass manager used during executable translation... somehow.
Right now, all executables for all targets are translated in a single parent pass (https://github.com/google/iree/blob/master/iree/compiler/Dialect/HAL/Transforms/TranslateExecutables.cpp#L76) which then requires the various targets to initiate their own pass run (https://github.com/google/iree/blob/master/iree/compiler/Dialect/HAL/Target/VMLA/VMLATarget.cpp#L70-L75).
If we instead move the logic for deriving target backends to the transform pipeline setup (https://github.com/google/iree/blob/master/iree/compiler/Dialect/HAL/Transforms/Passes.cpp#L33) we could have the target registration function populate a nested pass manager (nest<IREE::HAL::ExecutableOp>()) with the passes it requires.
This should make getting end-to-end reproducers easier.
Right now the target functions may do a bit of extra prep that we should remove or move to passes (https://github.com/google/iree/blob/master/iree/compiler/Dialect/HAL/Target/VMLA/VMLATarget.cpp#L59-L67) before running their core passes (https://github.com/google/iree/blob/master/iree/compiler/Dialect/HAL/Target/VMLA/VMLATarget.cpp#L71-L72) and finally serializing their contents (https://github.com/google/iree/blob/master/iree/compiler/Dialect/HAL/Target/VMLA/VMLATarget.cpp#L77-L111).
If instead each target had a serialization pass that took the contents and packed them into the flatbuffer then we don't need to run anything outside of the nested pass.
Initial tasks (unblocked):
- Change ExecutableTargetRegistration (maybe to an interface with a populatePasses method to make future work around target specialization easier)
- Move LLVM/VMLA/SPIR-V serialization to their own passes in their respective dialects
- File a bug with upstream because mlir::translateModuleToLLVMIR does the same pass manager nesting - it shouldn't (only impacts llvmjit backend)
- Move RewriteLegacyIO pass into the target pass pipelines (not via
makeLegacyExecutableABI)
Post-handwritten-VulkanSPIRVTarget.cpp-kernels:
- Move backend list logic to HAL/Transforms/Passes.cpp and build nested pass manager
(the logic in VulkanSPIRVTarget.cpp is complex right now with all the special cases/flags, but will be getting simpler soon)
Activity
benvanik commentedon Mar 11, 2020
Mahesh points out that currently the SPIR-V/LLVM backends are using the RewriteLegacyIO pass - that'll also need to be setup in their new pipelines nested on the IREE::HAL::ExecutableSourceOp
(or, depending on when this work is done, may not be needed at all)
benvanik commentedon Apr 8, 2020
Chatting with river/mehdi it sounds like dynamic pass registration will be required to do this right. They've got plans to implement that this quarter, so my hope is to get everything else done except for the unnesting and then that can be done as a simple change when the infra is ready.
benvanik commentedon Apr 23, 2020
Filed upstream issue here: https://bugs.llvm.org/show_bug.cgi?id=45643
Remove IREE usage of the Global Dialect Registry (#3036)
Adopt pipeline-in-a-pass infra
Adopt pipeline-in-a-pass infra (#3741)