Skip to content

Commit 4308233

Browse files
authored
[InstanceChoice] Move specialize options pass earlier in the firtool pipeline (#7988)
Move the `SpecializeOptionsChoice` pass earlier in the pipeline. This is required since most of the passes cannot handle `InstanceChoiceOp` including the `InstanceGraph` analysis and may result in invalid IR. This ensures that all the `InstanceChoiceOp` are replaced by `InstanceOp` after the specialize pass is run, since partially specified options are still not supported.
1 parent 6b4bea0 commit 4308233

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/Firtool/Firtool.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ LogicalResult firtool::populatePreprocessTransforms(mlir::PassManager &pm,
5555
LogicalResult firtool::populateCHIRRTLToLowFIRRTL(mlir::PassManager &pm,
5656
const FirtoolOptions &opt,
5757
StringRef inputFilename) {
58+
// TODO: Ensure instance graph and other passes can handle instance choice
59+
// then run this pass after all diagnostic passes have run.
60+
pm.addNestedPass<firrtl::CircuitOp>(firrtl::createSpecializeOptionPass(
61+
opt.shouldSelectDefaultInstanceChoice()));
5862
pm.nest<firrtl::CircuitOp>().addPass(firrtl::createLowerSignaturesPass());
5963

6064
pm.nest<firrtl::CircuitOp>().addPass(firrtl::createInjectDUTHierarchyPass());
@@ -131,10 +135,8 @@ LogicalResult firtool::populateCHIRRTLToLowFIRRTL(mlir::PassManager &pm,
131135

132136
pm.addNestedPass<firrtl::CircuitOp>(firrtl::createCheckCombLoopsPass());
133137

134-
// Must run the specialize instance-choice and layers passes after all
135-
// diagnostic passes have run, otherwise it can hide errors.
136-
pm.addNestedPass<firrtl::CircuitOp>(firrtl::createSpecializeOptionPass(
137-
opt.shouldSelectDefaultInstanceChoice()));
138+
// Must run this pass after all diagnostic passes have run, otherwise it can
139+
// hide errors.
138140
pm.addNestedPass<firrtl::CircuitOp>(firrtl::createSpecializeLayersPass());
139141

140142
// Run after inference, layer specialization.

0 commit comments

Comments
 (0)