Skip to content

Commit

Permalink
Add debug option to dump LLVMCPU/GPU pass pipeline (#10214)
Browse files Browse the repository at this point in the history
This is enabled using the
`--debug-only=iree-llvm-cpu-lowering-pass-pipeline` and `--debug-only=iree-llvm-gpu-lowering-pass-pipeline` flags.
The SPIR-V codegen path has a similar option.
  • Loading branch information
kuhar authored Aug 25, 2022
1 parent acb7355 commit 4f0c5b1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions compiler/src/iree/compiler/Codegen/LLVMCPU/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/Passes.h"

#define DEBUG_TYPE "iree-llvm-cpu-lowering-pass-pipeline"

namespace mlir {
namespace iree_compiler {

Expand Down Expand Up @@ -640,6 +642,12 @@ void buildLLVMCPUCodegenPassPipeline(OpPassManager &passManager) {
passManager.addPass(createLLVMCPULowerExecutableTargetPass());
OpPassManager &nestedModulePM = passManager.nest<ModuleOp>();
addLowerToLLVMPasses(nestedModulePM);

LLVM_DEBUG({
llvm::dbgs() << "Using LLVMCPU pass pipeline:\n";
passManager.printAsTextualPipeline(llvm::dbgs());
llvm::dbgs() << "\n";
});
}

} // namespace iree_compiler
Expand Down
8 changes: 8 additions & 0 deletions compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/Passes.h"

#define DEBUG_TYPE "iree-llvm-gpu-lowering-pass-pipeline"

namespace mlir {
namespace iree_compiler {

Expand Down Expand Up @@ -323,6 +325,12 @@ void buildLLVMGPUTransformPassPipeline(OpPassManager &pm, bool useROCM) {
// - The module contains the final llvm.module ready to be serialized.
//===--------------------------------------------------------------------===//
addLowerToLLVMGPUPasses(nestedModulePM, useROCM);

LLVM_DEBUG({
llvm::dbgs() << "Using LLVMGPU pass pipeline:\n";
pm.printAsTextualPipeline(llvm::dbgs());
llvm::dbgs() << "\n";
});
}

} // namespace iree_compiler
Expand Down

0 comments on commit 4f0c5b1

Please sign in to comment.