Commit Graph

7251 Commits

Author SHA1 Message Date
Mike Urbach 6b1f86c360
[Python] Remove CI options that only applied to MacOS universal. (#6169)
We were having problems with the universal MacOS wheels, so we
reverted back to just building the x86 wheels. But this still fails,
because these options are telling cibuildwheel to build for the
universal architecture on MacOS, which is not enabled.
2023-09-21 17:16:18 -06:00
John Demme 84221b7e3e [ESI] Fix path to capnp schema
The test this affected only passed because I had a leftover file in my
build dir. (And it doesn't run in CI.)
2023-09-21 23:01:34 +00:00
John Demme 235dd22c21
[MSFT] Remove DiscoverAppIDs pass (#6175)
Replaced this with AppIDIndex API. Also cleans up a few mothballs.
2023-09-21 15:37:03 -07:00
Fabian Schuiki c38e15a4f8
[HW] Allow for quoted struct field names (#6174)
Change `parseKeyword` to `parseKeywordOrString` in `StructType`, such
that struct field names that aren't valid keywords in MLIR can still be
used. They now print as quoted strings instead of crashing any MLIR tool
trying to read the type back in.
2023-09-21 15:30:37 -07:00
John Demme ab58b28515
[MSFT] Rip out MSFTModule et. al. (#6161)
Closes #6109.
2023-09-21 14:55:41 -07:00
John Demme f3bd4d2f05 [Ibis] Put PathDirection enum in Ibis namespace
Accidently omitted the namespace.
2023-09-21 21:50:36 +00:00
John Demme 6d41b669ee [PyCDE] Fixing a PyCDE integration test
All the PyCDE tests are passing again
2023-09-21 21:32:50 +00:00
Will Dietz 32c1db21d4
[FIRRTL] Add Double property type. (#6167)
Double-precision floating point type.

Add attribute, constant op, and parse + emit support.

Only support what we understand as floatingpoint in lexer for now, which includes exponent notation.

Add support to LowerClasses.
2023-09-21 16:22:54 -05:00
John Demme ff1f72d328
[MSFT] Finally move away from GlobalRefOp (#6168)
Switch to HierPathOp. Closes #5183.
2023-09-21 13:17:24 -07:00
Hideto Ueno 960195fbf4
[HW] Fix ModuleType::getInputType to return InOutType for InOut port (#6162)
`ModuleType::getInputTypes` returns inout types for inout ports but `getInputType` doesn't wrap with inout. This is inconsistent and python API `module_type.input_types` returns a wrong type for this.
2023-09-21 19:47:29 +09:00
Morten Borup Petersen 77630d57ec
[Ibis] Add `ibis.method.df` operation (#6163)
Ibis dataflow methods share the same interface as an `ibis.method` but without imperative CFG-based control flow. Instead, this method implements a graph region, and control flow is expected to be defined by dataflow operations.
2023-09-21 11:06:10 +02:00
Morten Borup Petersen e6989c81eb [NFC][Ibis] Remove unused variable 2023-09-21 08:41:55 +00:00
Morten Borup Petersen 60db6832b4
[CFToHandshake] Refactor towards genericness (#6156)
A couple of minor refactors - more will come - to allow for using `CFToHandshake` on things other than just `func.func` as the source operation and `handshake.func` as the target operation.
2023-09-21 10:24:50 +02:00
Morten Borup Petersen 75c00d78d8
[NFC][ExportVerilog] Move location emission functions to class (#6154)
Way to many interleaved functions for them to be free functions - refactor as a class.
2023-09-21 09:51:09 +02:00
Morten Borup Petersen b2c56896bb
[HW] Align instance_like_impl verification with `getReferencedModule` (#6155)
Previously, `instance_like_impl::verifyReferencedModule` and `instance_like_impl::getReferencedModule` had different semantics for where the referenced module is located;

`getReferencedModule` uses the nearest `ModuleOp` as the target symbol table, whereas `verifyReferencedModule` uses the nearest symbol table. As a result, `verifyReferencedModule` fails if the `hw.instance` op is nested within another symbol table operation.

e.g. the following would fail:
```mlir
module {
  hw.module.extern @Foo()
  ibis.container @C { // could be any SymbolTable-defining op. Use builtin.module for simplicity.
    %this = ibis.this @C
      hw.instance "foo" @Foo() -> ()
  }
}
```
2023-09-21 09:46:58 +02:00
John Demme f52624565c
[PyCDE] Switch over to new AppIDIndex (#6160) 2023-09-20 19:34:50 -07:00
John Demme 0510ad8caa [MSFT] AppIDIndex add methods for querying paths
- `getChildAppIDsOf` to inquire about all of the AppIDs contained by a
module.
- `getAppIDPathAttr` to get the path to an AppID from a moduled.
2023-09-21 02:29:20 +00:00
John Demme a7aa8c8d87 [MSFT] Moving to hw::HWModuleLike to fix a crash in PyCDE
Now that PyCDE is producing HWModules, we can't assume things are
MSFTModules anymore.
2023-09-21 01:54:24 +00:00
John Demme ff545e963b [PyCDE] Fixing a few more tests
More i1 -> Clock fixes
2023-09-21 01:52:22 +00:00
John Demme e50b6dc532 [PyCDE] Switch over to new !seq.clock type
This change broke pycde to all hell, but it's something I've been
meaning to do for a long time.
2023-09-20 21:49:40 +00:00
John Demme a9f55cab80
[MSFT] Make AppID discovery an index rather than a pass (#6152)
Discovering AppIDs used to be a pass and only worked on `msft.module`s. Since we're removing them, make AppID discovery an API which creates dynamic instances from AppIDs. Since it'll primarily be used from PyCDE, expose to Python. Test through Python.

Will remove the discover appid pass in a subsequent PR. Progress on #6109.
2023-09-20 13:17:43 -07:00
Lenny Truong d417432291
[CI] Hotfix macosx python wheel (#6158) 2023-09-20 12:47:43 -06:00
Fabian Schuiki ca41d322d5
[ExportVerilog] Remove useless assert from NameCollector (#6147)
The `NameCollector` is only used to compute declaration word and type
string length such that we can format declarations nicely. Currently it
also asserts a weird invariant that `PrepareForEmission` must uphold,
but then it never actually relies on that invariant. And for some reason
the `NameCollector` also collects names in else branches of `IfOp`s, but
not in then branches.

Push `NameCollector` more into the best-effort cosmetics direction it's
already going by removing that assert and not visiting else branches.
Either we visit both branches of an if, or none at all. And since if
blocks introduce a separate scope with a separate place for decls, the
visition is not necessary. (It would just potentially add whitespace to
the if's surrounding scope's decl stack, to account for decls that are
actually emitted within the if scope.)

This also uncovered one instance of `maxDeclNameWidth - x` that was left
unguarded by `if (x < maxDeclNameWidth)`. Fix this.

This change doesn't affect the output, but makes ExportVerilog less
brittle by not enforcing invariants that it actually doesn't care about.
2023-09-20 11:24:42 -07:00
Robert Young 36d2656679
[FIRRTL][IMDCE] Mark all objects as alive (#6157) 2023-09-20 12:13:29 -04:00
Prithayan Barua 7556e97987
[ExportVerilog] Add verilog debug locations to output MLIR (#6092)
Use the PrettyPrinter CallbackToken API, to record print events and store the
 verilog output locations for each operation. Record the print begin and end
 location of each op. This has a side-effect of updating the IR, location
 attribute of the op is updated to include the verilog location range. `FusedLoc`
 is used to record the location ranges and each op can correspond to multiple
verilog locations.
This feature is disabled by default under an emission flag `emitVerilogLocations`.
2023-09-20 07:26:33 -07:00
Morten Borup Petersen 03eb57d28f Make `--maximize-ssa` run on all regions
... instead of restricting it to just `func.func`s.
2023-09-20 11:39:18 +00:00
Morten Borup Petersen 339b5fef9c
[ExportVerilog] Support CallSiteLoc and NameLoc emission (#6131)
Adds suppport for CallSiteLoc and NameLoc locations in export verilog.
I tried to do this without refactoring the whole location printing infra too much, although some refactoring was due.
Location printing has been modified such that:
1. There is a top-level dispatch function which dispatches `Location` printing to location type-specific print functions
2. No more passing around of `std::string`s. Instead, location emitter functions take a `llvm::raw_string_ostream`.
3. `FileLineColLoc` locations are still uniqued and printed in a sorted manner, as before. However, any adjacent locations not of the `FileLineColLoc` will be printed without any custom uniquing (apart from `Attribute` uniquing).

Location printing is still inline, i.e. without newlines. I can easily imagine that this can become a bit unwieldy for complex stack traces. However, deciding how to split locations to multiple lines seems like a separate issue.
2023-09-20 10:57:27 +02:00
Morten Borup Petersen fd141e17b6 [HW] Fix `cast` in HWInstanceGraph
Too strong of an assumption - changed to `dyn_cast` because we cannot assume that _all_ nodes are HWModuleLike - there may be cases where hw.module's are mixed with other ops that implement the `igraph::ModuleOpInterface`.
2023-09-20 08:22:30 +00:00
Morten Borup Petersen 6b9b69a94f
[NFC][Handshake] Adjust handshake interface defs and file locs (#6150) 2023-09-20 09:18:56 +02:00
Morten Borup Petersen 8d7abdd5f3
[Ibis] Allow multiple return values for `ibis.method` (#6151)
The prior motivation for a single return value was to enforce... well, exactly that. However, this is nothing but a pain, requiring the user to tupel/struct-ify return values at a high level. This is a trivial transformation that can be done down the line. Allowing multiple return values, however, allows this op to play much more nicely with other passes and code that expects function-like operations (and terminators of said ops) to -generally speaking - accept multiple return values.
2023-09-20 09:18:06 +02:00
John Demme 6132720b3a [MSFT] Implicit InnerRefAttr printer crashes on null attributes
Printers should *never* crash since they are used when printing asm
which doesn't verify.
2023-09-19 23:52:03 +00:00
John Demme 28d8983203 [HW] InnerRefAttr printer crashes on null attributes
Printers should *never* crash since they are used when printing asm
which doesn't verify.
2023-09-19 23:48:16 +00:00
Prithayan Barua 10da65bf1d
[OM] Python bindings for om integer (#6042)
Implement the python bindings for the `om.integer` attribute. Add support to
 create `om::IntegerAttr` from `mlir::IntegerAttr`. Also ensure all tests use
 `om::IntegerAttr` instead of `mlir::IntegerAttr`.
2023-09-19 13:41:46 -07:00
Hideto Ueno 8129d5de50
[HW][Python] Add name getters for ModuleType (#6149)
`argNames` and `resultNames` attributes were removed from HWModule (https://github.com/llvm/circt/pull/6095) in the presence of ModuleType but downstream python tools are relying these attributes for name look up. However currently there is no CAPI/Python API for ModuleType to query names of ports so this PR adds CAPI and bindings respectively in the same way to port types.
2023-09-20 00:45:01 +09:00
Morten Borup Petersen 6480820d96
[Ibis] Add `ibis.sblock` inlining operations and passes (#6145)
Inlines `ibis.sblock` operations, by creating MLIR blocks and `cf` operations, while adding annotations to the parent operation about `sblock`-specific attributes.
2023-09-19 12:45:13 +02:00
Sprite 7fdad47176 [Firtool] Move the remaining pass additions into lib 2023-09-19 17:45:43 +08:00
lonely eagle 89f824677d
[scf-to-calyx] Support for function call (#5965) 2023-09-18 19:24:16 -06:00
Will Dietz 05d84c1659 Add SymbolTable.h to InstanceGraphInterface.h fix build breakage.
Broken in da1802f907 .
2023-09-18 16:17:56 -05:00
Nandor Licker da1802f907 [HW][NFC] Provide default implementations to HW instance accessors 2023-09-18 10:09:25 -07:00
Will Dietz 1018fa292a
[FIRRTL][FIRParser] Add AnyRef cast as-needed for agg prop expr's. (#6135)
This already is supported for propassign (object -> anyref),
allow in List/Map expressions as well.

These types continue to be invariant w.r.t their type parameters
once created, add test that propassign rejects.
2023-09-18 09:13:52 -05:00
Nandor Licker 437ab6ac99
[Seq] Lower clock types nested within aggregates (#6138)
Fixes #6136
2023-09-18 17:00:00 +03:00
Nandor Licker 0fc8656168
[Seq] Switch all seq ops to use seq.clock (#6139) 2023-09-18 16:38:32 +03:00
Nandor Licker 83c10b809e
[Seq] Convert `seq.clock_gate` to use the clock type exclusively (#6134)
This PR restricts the clock gate op to solely use the clock type.

Uses in other dialects, especially Pipeline, were adjusted.

To maintain canonicalization behaviour, a clock constant op along with an attribute is also introduced to represent constant clocks and to fold ops to them.
2023-09-18 12:36:04 +03:00
Morten Borup Petersen 83abbfc0f4
[Handshake] Allow handshake ops to be used outside of a `handshake.func` (#6132)
... by requiring that handshake ops are nested within an operation that inherits the `FineGrainedDataflowRegionOpInterface`.
This is somewhat of a half-way solution, seeing as there isn't support for `HasParent` with an interface upstream. I've raised the issue and suggested a fix here https://github.com/llvm/llvm-project/pull/66196 but we'll see how long that takes to resolve.

Until then, added a `HasParentInterface` which does the same thing, albeit with a cryptic error message about which interface the parent op lacked (note: the whole issue here is that there isn't any name literal being generated for op interfaces).

I'll be monitoring the upstream stuff, and changing this over until then. For now, the motivation for adding this into circt is to unblock me in using handshake outside of a `handshake.func` while still having a restriction on where handshake ops can be used - i.e. i don't want to completely lift the `HasParent` restriction - users should still explicitly opt-into the fact that "using handshake => handshake ops is in a fine-grained dataflow region".
2023-09-18 10:42:02 +02:00
Fabian Schuiki 5f5ea8fc41
[Arc] Allow top-level logic in LowerState; detect clock edges (#6142)
Make the `LowerState` pass allow operations to remain in the top-level
`arc.model` op after state lowering. This is necessary for lowering the
model op into an `eval` function in the future. Make use of this new
flexibility by inserting logic into the model that detects edges on the
clocks of the `arc.clock_tree` ops. The clock trees no longer trigger on
the clock itself, but are given an "enable" signal that indicates
whether a clock edge has been observed.

In the future, we'll want to schedule the ops in the `arc.model` and
lower it to a separate `eval` function, instead of throwing it away. In
doing so the user will no longer have to manually call clock functions,
but can call a singular `eval` function instead. A centralized function
that performs model execution will also allow us to properly simulate
clock edges occurring at the same time -- something which is impossible
today.

Together with the `arc.clock_domain` op, this `eval` function will make
the entire clock detection and grouping a performance optimization
instead of a required transformation. Theoretically, even if we did not
separate state with the same clock into dedicated clock functions, we'll
still be able to generate an `eval` function, with all logic inlined.
This will ultimately make the Arc dialect more robust and the transforms
more composable.
2023-09-17 11:57:05 -07:00
Martin Erhart d87474fef7
[Arc] Add LowerVectorizations pass (#6141)
Adds a pass to lower  operations. Currently, only lowering the boundary and inlining the op body is supported. Lowering of the body will be added in a separate commit since that is a bit more complex.
2023-09-17 19:49:23 +02:00
Fabian Schuiki e2eb7c66b0
[Arc] Improve performance of state update legalization (#6137)
Rewrite the access analysis used in the `LegalizeStateUpdate` pass.

This pass is a known performance bottleneck in arcilator and causes poor
scaling to larger state spaces: on the `boom-small` benchmark in
`circt/arc-tests`, the analysis runs for >130s, which accounts for >95%
of the overall arcilator runtime.

This PR replaces the MLIR dataflow framework implementation of the
analysis with a custom one. The analysis requires only very sparse
traversal of the operations, which is a lot easier to implement with a
custom graph of nodes. On `boom-small` the new implementation takes
<200ms to complete.
2023-09-16 12:52:09 -07:00
Martin Erhart 089850fc53 [Arc] Include pass base only where needed
Currently, all the pass base classes are included in all files
implementing one specific pass. This aims to reduce the amount of
unnecessarily included code.
2023-09-16 17:56:04 +02:00
Nandor Licker a2f2aac4d2 [NFC] Whitespace fix 2023-09-15 22:22:59 -07:00
Fabian Schuiki 91e2e1e4a5
[arcilator] Register OM dialect 2023-09-15 14:24:48 -07:00