llvm / circt

Circuit IR Compilers and Tools
https://circt.org
Other
1.67k stars 298 forks source link

Construct firtool Pass Pipeline from Annotations #910

Closed seldridge closed 1 year ago

seldridge commented 3 years ago

The Scala FIRRTL Compiler (SFC) uses a special annotation, firrtl.stage.RunFirrtlTransformAnnotation to add a custom transform to the SFC compile pipeline.

As things like #909 land, it would be cool if a firtool user didn't have to explicitly request --inline-stuff and could instead rely on either inline annotations or the input annotation file to control this. This would help provide tighter integration with Chisel.

Concretely, if you see a firrtl.stage.RunFirrtlTransfomAnnotation("firrtl.passes.InlineInstances"), the #909 inliner should get scheduled.

(The whole structure of the SFC is "just a bag of transforms". When you want a "Verilog Compiler", this is really a request to "find a linearization of transforms that make up a Verilog Compiler that doesn't violate dependencies, resolving any invalidations along the way." The RunFirrtlTransformAnnotation is a way of appending to the list of transforms in this sub-problem.)

lattner commented 3 years ago

We can support this in some simple cases, but I suspect this is one of the areas we'll intentionally diverge. We can't support the full generality of what SFC supports (because we have different passes, intentionally)

seldridge commented 1 year ago

I think we've solidly moved away from this approach. The pass pipeline is now almost entirely fixed and will handle all annotations that should exist. E.g., inlining is always run and is a no-op if no inline annotations exist.