Commit Graph

7419 Commits

Author SHA1 Message Date
Will Dietz 0b4ba1c926
[FIRRTL][Parser] Update groups version check to 3.2.0. (#6219)
They were added in 3.2.0.
2023-09-29 07:27:48 -05:00
Morten Borup Petersen 86f28c0baf [FSM] Disable FSM variable test #4745 2023-09-29 09:37:00 +00:00
Schuyler Eldridge af2b3e1366
[ibis] Fix reblock use of erased ops (#6222)
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>
2023-09-28 18:19:17 -04:00
Mike Urbach 21a0be8248
[MSFT] Remove Python extensions for non-existant structure ops. (#6221)
The MSFT module and instance ops have been removed; these Python
extensions are dead code.
2023-09-28 15:56:24 -06:00
Andrew Lenharth 164dbaf9cd
[HW] Change printer for modules (#6205)
This is quite invasive.  This converts from the functiontype printer to the moduletype printer.

---------

Co-authored-by: Mike Urbach <mikeurbach@gmail.com>
2023-09-28 16:30:15 -05:00
Zachary Yedidia 39fad38d3a
[Arc] Move LegalizeStateUpdate before StateAlloc (#5830) 2023-09-28 14:28:31 -07:00
Schuyler Eldridge 48a2c30c67
[FIRRTL] latestFIRVersion -> exportFIRVersion, NFC
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>
2023-09-28 13:54:45 -04:00
Schuyler Eldridge d4d71bd4d1
[FIRRTL] Bump FIRRTL version to 3.3.0 for parsing
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>
2023-09-28 13:51:58 -04:00
Fabian Schuiki fe376a8052
[Arc] Improve handling of seq.clock type
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.
2023-09-28 09:12:29 -07:00
Will Dietz 58a8b18ae6
[FIRRTL][LOA][NFCI] Use FieldRefCache. (#6215) 2023-09-28 08:40:49 -05:00
Morten Borup Petersen 0f37de27f2 [Support] Extend TypeConversionPattern to apply to a single op type 2023-09-28 12:52:54 +00:00
Will Dietz 6f24c2c71d [FIRRTL][NFC] suuport -> support typo fix. 2023-09-28 07:27:28 -05:00
Will Dietz 60f24472b5 [FIRRTL][LOA][NFC] Fix stray newline in header comment. 2023-09-28 07:22:02 -05:00
Morten Borup Petersen 7654668842
[Ibis] Add `ibis-prepare-scheduling` pass (#6166)
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.
2023-09-28 13:27:09 +02:00
Morten Borup Petersen 33019c70b2 [Pipeline] Run pipeline scheduling on any `IsolatedFromAbove` region 2023-09-28 11:06:57 +00:00
Morten Borup Petersen a0ce6e73a7
[Ibis] Reblock should also create blocks around non-delimited ops (#6218)
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.
2023-09-28 11:59:03 +02:00
Morten Borup Petersen 303fddeb8b [Ibis] Add CSE before tunneling 2023-09-28 08:43:30 +00:00
Morten Borup Petersen 6b73873825
[Ibis] Add ibistool (#6206)
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.
2023-09-28 10:14:20 +02:00
Prithayan Barua c8ab1e1163
[Seq][FirMemLowering] Create correct width constant for mask (#6214)
`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
2023-09-27 14:31:13 -07:00
Will Dietz 44ec36e3e8
llvm: Small bump to get version that passes tests. (#6211) 2023-09-27 15:12:26 -05:00
Robert Young d64d0cb8a0
Bump LLVM (#6207)
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
2023-09-27 12:15:03 -04:00
Will Dietz c41670afba
[FIRRTL] Simplify getFieldRefFromValue, add+use FieldRefCache. (#6181)
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.
2023-09-27 11:10:53 -05:00
Prithayan Barua b377223148
[ExportVerilog] Fix line out in debug verilog locations (#6210)
Line offset count was incorrectly incremented outside else block, which
 resulted in incorrect line numbers when threading was disabled.
Fixes #6159
2023-09-27 09:00:09 -07:00
Prithayan Barua 6607338e34
[OM][Bindings] Make Python Evaluator Object hashable (#6204)
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.
2023-09-27 08:35:32 -07:00
Will Dietz e15128af61
[FIRRTL][RefSubOp] Add getAccessedField helper method. (#6208)
Similar method exists on our other indexing operations, add this to allow generic reasoning about indexing performed.
2023-09-27 10:08:41 -05:00
Hideto Ueno 71651a8ba1
[Python] Use Ninja and LLD if avaiable when building wheel (#6165)
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.
2023-09-27 22:52:35 +09:00
Morten Borup Petersen ee6c3ee6e6 [Ibis] Add missing argument passing to pass constructor
... oops.
2023-09-27 11:49:39 +00:00
Morten Borup Petersen 72a556df28
[Ibis] Fix issues in Tunneling and PortRef lowering (#6202)
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`).
2023-09-27 12:11:10 +02:00
Schuyler Eldridge 4da6a4d83a
[FIRRTL] Allow more folds of "weak" annotations
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2023-09-26 18:39:17 -04:00
Schuyler Eldridge cc940668e1
[FIRRTL] Remove "weak" annotated ports
Modify FIRRTL's RemoveUnusedPorts pass to remove ports that have only
"weak" annotations.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2023-09-26 18:38:51 -04:00
Schuyler Eldridge 43e143c8ac
[FIRRTL] Remove "weak" annotated in IMDCE
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>
2023-09-26 18:38:26 -04:00
Schuyler Eldridge f773f7bb6f
[FIRRTL] Remove "weak" annotated in IMCP
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>
2023-09-26 18:37:58 -04:00
Schuyler Eldridge 7995c2c15f
[FIRRTL] Canonicalize connects off "weak" annos
Extend `canonicalizeSingleSetConnect` to look through weak annotations
that can be deleted.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2023-09-26 18:37:32 -04:00
Schuyler Eldridge 41dffd36cb
[FIRRTL] Use methods for IMDCE anno deletion, NFC
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>
2023-09-26 16:22:16 -04:00
Schuyler Eldridge 0ff71625c6
[FIRRTL] Add "removable" methods to Annotations
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>
2023-09-26 16:22:15 -04:00
Schuyler Eldridge 16f4f76575
[firtool] Add GroupSink pass to firtool
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>
2023-09-26 15:21:33 -04:00
Schuyler Eldridge 7ea9badefd
[FIRRTL] Add very simple GroupSink pass
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>
2023-09-26 15:21:33 -04:00
John Demme b8df34d064
[ExportVerilog] Format specifiers: hierpath separation character (#6192)
Support format specifiers on Verbatim*Op substitutions. The first one only applies to hierpaths: a separation string.
2023-09-26 09:59:05 -07:00
Morten Borup Petersen 6735dfa983 [Ibis] Also remove reads of writes in clean-selfdrivers 2023-09-26 13:17:41 +00:00
Morten Borup Petersen c401c4c2ae
[Ibis] Fix clean selfdrivers in case of external reads (#6201) 2023-09-26 12:19:46 +02:00
Morten Borup Petersen e948167eee Revert "[Ibis] Fix clean-selfdrivers in cases of external reads"
This reverts commit d068f3068a.
2023-09-26 09:53:29 +00:00
Morten Borup Petersen d068f3068a [Ibis] Fix clean-selfdrivers in cases of external reads 2023-09-26 09:42:02 +00:00
Morten Borup Petersen 551629a8f7 [Ibis] Add missing dependent dialect to `ibis-clean-selfdrivers` 2023-09-26 08:34:37 +00:00
Schuyler Eldridge 0053d59139
[FIRRTL] Test whitespace cleanup, NFC
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2023-09-25 22:33:18 -04:00
Will Dietz 249ae37e88
[FIRRTL][LOA] If no changes made, mark all analyses preserved. (#6187) 2023-09-25 11:46:40 -05:00
blakep-msft 20854d1147
[Ibis] Print offending port name and use count on containers-to-hw error (#6186)
* [Ibis] print offending port name and use count on containers-to-hw error

* format
2023-09-25 08:51:26 -07:00
Morten Borup Petersen 290d917c02
[Pipeline] Remove internal clock, reset,stall signals. (#6196)
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.
2023-09-25 16:25:59 +02:00
Morten Borup Petersen 6f3a00aa7a
[Ibis] Allow tunneling from `hw.module`s (#6195) 2023-09-25 11:23:56 +02:00
Morten Borup Petersen 88b2e69940 [Ibis] fix roundtripping of read/write ops 2023-09-25 08:20:13 +00:00
Schuyler Eldridge fd00bf3f85
[FIRRTL] Disable dedup to avoid Windows failures?
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>
2023-09-22 23:49:35 -04:00