Fix a bug in the IbisReblockPass where an erased op was being pushed into
a SmallVector. Delay deletion of ops until runOnOperation finishes.
Fixes#6220.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
This is quite invasive. This converts from the functiontype printer to the moduletype printer.
---------
Co-authored-by: Mike Urbach <mikeurbach@gmail.com>
Change the name of the constexpr `latestFIRVersion` to `exportFIRVersion`
as this is not the "latest" version, but the version that is used when
exporting FIRRTL. This will avoid confusion about what this is.
Make the `exportFIRVersion` the same as the `nextFIRVersion`.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change the gating of new FIRRTL features from 3.2.0 to 3.3.0. Simplify
this through the use of a new `nextFIRVersion`.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add missing handling of the new `!seq.clock` type. This mainly means
introducing additional casts where necessary. Also lower inputs/outputs
before any of the module body, to reduced the number of clock casts that
have to be inserted.
Prepares `sblocks` for scheduling by:
1. Defining an operation `ibis.pipelineheader` that provides place-holders for clk/reset/go/stall.
2. places all operations inside a `pipeline.unscheduled` operation
3. feeds any block arguments that are trivially returned by the sblock, through the pipeline
Having this allows us to run any scheduling we want on the `pipeline.unscheduled` operation, regardless of the surroundings.
I was considering whether to include more of the control logic surrounding the pipeline operation into this PR. However, any performant control logic of the pipeline itself (which eventually need to interact with the ready/valid network that drives the `sblock`) needs information about the scheduled pipeline. Hence, prepare for scheduling, schedule, then create the control network based on scheduling results.
e.g. any MLIR block which contains ops should be moved into ibis `sblocks`. The `ibis.sblock.inline.begin/end` ops are only intended to delimit a scope of operations which has block constraints on them. However, this pass was always intended to also work on non-delimited ops. In the end, the result of the pass should be that the IR consists strictly of terminators (control flow) and `ibis.sblock` ops.
Adds `ibistool` - a tool for driving Ibis lowerings. The tool has two
modes - low-level and high-level Ibis lowering.
Alongside this, introduce a set of Ibis pass pipelines which other users
may load to ensure that they're lowering ibis constructs in the
standard order.
`FirMemLowering` is creating incorrect width mask, when the optional mask input
is missing from the memory access ops. Instead of creating a one bit mask for
the optional mask input, it must be of appropriate mask width as determined by
the `firmem`.
Fixes https://github.com/llvm/circt/issues/6213
There were three breaking changes in LLVM:
1: In the LLVM dialect, NullOp was replaced with a more general ZeroOp. See:
https://github.com/llvm/llvm-project/pull/67183.
2: AffineForOp's getInitOperands was renamed to getInits. See:
https://github.com/llvm/llvm-project/pull/66925.
3: In the SCF dialect, the WhileOp now implements LoopLikeOpInterface, which
now supports multiple loop regions. The getLoopBody member-function was removed
in favour of LoopLike's getLoopRegions. The While Op only has a single region,
so we can replace calls to getLoopBody with getRegion. See:
https://github.com/llvm/llvm-project/pull/66754
As suggested in review to avoid worst-case behavior causing
many repeated walks of same indexing chain (in part or whole).
Pull into small helper class for possible re-use in transforms
or a simple analysis wrapper.
Refactor getFieldFromFromValue to be both simpler and to share code with FieldRefCache's version.
Implement the proper `__hash__` and `__eq__` methods for Object, such that it
can be used in dictionaries. This is required to ensure we use mlir object
reference for equality and hashing, rather than the default methods provided
by python.
Hashable::
"In Python, a "hashable" object is an object that has a hash value that remains
constant throughout its lifetime and can be compared to other objects.
User-defined classes need to implement the `__hash__()` and `__eq__()` methods
to be hashable."
In the OM dialect, we want there to be "reference semantics". In other words,
two objects with identical classes and fields should not be "the same" if they
are created from separate instances in the elaborated object graph that the
Evaluator sees. In addition, due to presence of cyclic dependencies, value
equivalence cannot be determined and reference semantics is required.
Ninja + LLD builds much faster than the default config (make+ld) so use it when they are in PATH. CI would not be affected by this as manylinux seems not to have ninja and lld by default.
Tunneling did not work in case the same port was requested for multiple tunneling purposes (e.g. both reading and writing to an input port of an instance). Will this happen often/ever? probably not. But now it's supported - and i count it as an error, since the logic previously made multiple distinct accesses alias.
PortRef lowering did not work in case input ports were "forwarded" through modules. To support this, these forwarded ports will now create intermediate input ports within a module. By doing so, we allow the lowering patterns to recurse, since the intermediate port now looks like any other input port that is provided as a port reference.
These input ports are then trivially removed by running `ibis-clean-selfdrivers` (which anyways is a prerequisite before running `ibis-convert-containers-to-hw`).
Modify FIRRTL's RemoveUnusedPorts pass to remove ports that have only
"weak" annotations.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change FIRRTLS inter-module dead code elimination (IMDCE) pass to delete
declarations which have "weak" annotations.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Change FIRRTL's inter-module constant propagation (IMCP) pass to remove
things which have constants driven through them and have "weak"
annotations. These annotations are currently limited to Object Model (OM)
annotations of specific types.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Extend `canonicalizeSingleSetConnect` to look through weak annotations
that can be deleted.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Switch from a static method to annotation member functions to determine of
a port with annotations can be deleted by IMDCE.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add member functions to Annotation and AnnotationSet that can be used to
query if a specific Annotation or if all Annotations can be
removed/deleted. There are certain "weak" annotations used by Object
Model which can be safely deleted because their downstream consumers will
_NOT_ error if they no longer exist.
As an aside, the whole notion of a removable annotation is somewhat
tenuous as a compiler could legally drop a removable annotation. The
actual semantics of a removable annotation are best effort.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add the GroupSink pass (basic sinking of operations into groups) to the
firtool pipeline just before LowerGroups.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
Add a new pass, GroupSink/firrtl-group-sink, which will sink operations
that are only used by optional groups into optional groups. This is very
simple at present. This pass uses `mlir::controlFlowSink` to sink ops
into regions. This only works for very simple things in FIRRTL which have
normal SSA dominance, e.g., nodes, constants, or primitive operations.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
This also simplifies the stage enable signals, seeing as the entry enable signal will now always be the last argument of any mlir block inside the pipeline.
Complete shot in the dark to fix some weird failures on Windows CI. These
tests started failing when deduplication was turned on for them. Try to
get them to pass by turning deduplication off.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>