Commit Graph

52 Commits

Author SHA1 Message Date
Jacques Pienaar 7f1c3399e4
Update to new builder format. (#8785)
Basically did

set(CMAKE_CXX_CLANG_TIDY local/clang-tidy -checks=-*,llvm-use-new-mlir-op-builder -fix)

and then fixed cases where temporary OpBuilders were used (as passed in
by reference now).
2025-07-26 04:55:06 -07:00
Martin Erhart a3e86791a1 [ESI][MSFT] Use free variants of isa/cast/dyn_cast
Refer to https://mlir.llvm.org/deprecation/
2024-04-28 16:11:30 +02:00
Fabian Schuiki 1d7ee186c1
[NFC] Homogenize file headers in CAPI/Python bindings
Adjust the header comments in the CAPI and Python bindings files such
that they are more in-line with the rest of CIRCT.
2023-11-29 13:19:38 -08:00
John Demme 1b901c33b8
[NFC][ESI][MSFT] Move AppIDs over to ESI (#6177)
Since AppIDs serve as system identifiers, they classify as a system
construction feature. So they should be in the ESI dialect, which will
be using them shortly.
2023-09-21 18:11:30 -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 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
John Demme e23e94542f [MSFT] Introduce AppIDPathAttr
Represents a full appid path. Just a list of AppIDAttrs components and a
root module. Expose to Python.
2023-09-14 22:43:49 +00:00
Will Dietz 1050a719d2
LLVM bump: move almost entirely to std::optional, fixes (#4470)
* LLVM.h: drop mlir::Optional.

It's an alias for std::optional now, just drop
instead of adding the templated using alias here as well
(which we'd have to remember to drop).

* Convert Optional -> std::optional.

Drop some unnecessary initializations, but keep them for fields for now.

Particularly:
StandardToHandshake.h: keep init for field, for omission in {} initializers.
FSMToSV: similarly keep the current initialization.
2022-12-22 18:57:38 -06:00
Andrew Lenharth 6bc0cd7cbb [NFC] silence some release warnings 2022-09-02 10:24:40 -05:00
John Demme 4e12269350
[PyCDE] Add `Reg` and `Wire` declarations which can be assigned to (#3677)
`Wire` is intended to create backedges. `Reg` is not strictly necessary, but
it should give RTL programmers a warm and fuzzy feeling.
2022-08-08 13:14:06 -07:00
Morten Borup Petersen b078252e67
[MSFT][NFC] Split MSFT passes into separate files (#3683)
Motivation:
1. This file is nearing 2000 LOC. I personally find that having a single file per pass helps in quickly navigating to/between implementations of different passes. Bunching everything into one file makes locating things just a bit harder.
2. This is the style used in the remainder of CIRCT.
3. Uses canonical CMake structure for declaring passes.
2022-08-08 19:41:59 +02:00
John Demme aa5c574d2a
[MSFT] Make `PassCommon` public (#3493)
`PassCommon` contains `getAndSortModules`, which is generally useful. Make it general by implementing `HWModuleLike` and `HWInstanceLike` and targeting those OpInterfaces instead. Involves a bit of ugliness when converting to/from the OpInterfaces to concrete module ops, but hopefully that'll go away as we add more functionality to said OpInterfaces.
2022-07-08 15:53:26 -07:00
John Demme cad8cd5be7
[MSFT] AppID attribute (#3425)
An 'AppID' is intended to make browsing the instance hierarchy easier.
Instead of having to reason about instance names, users can specify an
'AppID' consisting of a (name, index) pair and browse the hierarchy that
way. Said browsing also looks through the instance hierarchy (with
several rules about transparency) to mask implementation details at
various levels of the hierarchy.

This commit adds an `AppID` attribute and exposes it through Python.
2022-06-27 15:05:32 -07:00
John Demme 6349f22583
[PyCDE] [Python] Teach `LocationVector` bindings about 'None' for optional locations (#3165)
Use `None` to indicate that the location is not specified to/from Python. Also updates `PlacementDB` to deal with empty locations.
2022-05-23 15:07:48 -07:00
John Demme e65aba5117
[MSFT] [Python] Expose LocationVector to Python (#3163)
Add support for LocationVectorAttr to PlacementDB. Tests in subsequent
PRs.
2022-05-20 20:20:56 -07:00
John Demme 41bc38e35a
[MSFT] Teach PlacementDB about LocationVectors (#3162)
Add support for LocationVectorAttr to PlacementDB. Tests in subsequent
PRs.
2022-05-20 20:12:45 -07:00
John Demme bbd571b9f1 [PyCDE] Cleanups enabled by new MLIR features
MLIR upstream added:
- Default MlirLocations
- C API and Python functions to move blocks
2022-04-15 19:45:49 -07:00
John Demme c270a5af34
[PyCDE] Infer the result type of a SystolicArray PE (#2844)
To simplify the ownership model, MLIR core python bindings don't support
building a block before the operation. So we build a dummy operation
first, build the block, construct the array, move the block, then delete
the dummy op. The core MLIR C API doesn't have a region editing API, so
we need to add a specialized one in the MSFT C API.
2022-04-04 17:56:46 -07:00
John Demme 1722fde995 [MSFT] Removing unused 'getInstance' calls
This was used to refer to dynamic instances, but this was replaced by
the DynamicInstanceOp paradigm.
2022-04-01 13:41:45 -07:00
John Demme 1041dfdab4
[MSFT] [PyCDE] Make placement DB global rather than rooted (#2804)
Since we are generating only pieces of a design (and FPGA resources are
obviously a property of the entire design), the devdb should be
independent of the 'top' module.

Also, since the devdb is supposed to act as an 'alternative view' of the
IR, load the IR's placements by default.
2022-03-25 16:35:01 -07:00
John Demme 050063d299
[PyCDE] Implement new DynamicInstance operation methodology (#2683) 2022-02-28 13:30:35 -07:00
Andrew Lenharth 2755c0630c [NFC] Move SymCache to its own header 2022-02-24 16:23:32 -06:00
John Demme e2c7151935
[MSFT] [PlacementDB] Refactor around new dynamic instance op (#2637)
- Use the new dynamic instance op and its children to simplify the PlacementDB.
- Switch to new paradigm wherein all placements are done through the device db and get reflected in the IR. So for the life of PlacementDB, it "owns" all the placements.
2022-02-18 21:09:10 -08:00
John Demme 361abefdba
[MSFT] Move physical region to op and rename ops (#2629)
- Rename "PhysicalRegionOp" to "DeclPhysicalRegionOp" to be more
  descriptive of what it does.
- Rename "PhysLocationOp" to be more consistent with asm name.
- Add "PDPhysRegionOp" to eliminate random attribute from globalRef.
- Ditch old ref attribute since it's no longer necessary.
2022-02-14 22:56:24 -08:00
John Demme 0b1c0b15fd
[MSFT] Create PhysLocation operation and use it instead of an attribute on GlobalRef (#2620)
Keep the PhysLocation attribute for the actual physical location. Create
an op to refer to a global ref with the location attribute and the
subpath. Incremental change towards a new approach to dynamic instances.

This PR breaks tcl placement output in the way the integration test and pycde
enters the placements. Will be fixed shortly with the dynamic instance PR.
2022-02-13 15:03:58 -08:00
John Demme 4e79c88a39
[MSFT] [PyCDE] Register the canonicalizer pass (#2594)
Register the canonicalizer pass and add `cleanup` call in PyCDE.
2022-02-07 11:17:55 -08:00
mikeurbach f1f24e6300
[MSFT] Add PlacementDB APIs for removing and moving entities. (#2534)
These complement the main add* APIs for putting entities into the
database and support moving entities around or removing entities
entirely after any initial placements.
2022-01-28 17:31:26 -07:00
mikeurbach 0a0e15c8e6
[MSFT] Add walk order option when walking placements. (#2475)
This allows the user to specify a walk order through the placements'
columns and rows. If specified, the order is used to sort the indices
into the placements' maps. Else, the order is undefined as before.
2022-01-20 15:12:31 -07:00
mikeurbach c9c50d2889
[MSFT] Add optional sub-path to PhysLocationAttr. (#2421)
Previously, a sub-path could be specified by encoding it in the name
of the attribute using a certain scheme. This is brittle and
non-standard. To make this more natural and robust, the sub-path is
added as a field of the attribute definition as a StringRef. It is not
required, in which case an empty StringRef can be used. The attribute
name for placement attributes is no longer used in any logic.
2022-01-05 18:39:54 -07:00
Mike Urbach 13948d32d8 [MSFT] Remove SwitchInstanceAttr and RootedInstancePathAttr.
These attributes and their use cases are now replaced by
hw::GlobalRefOp and hw::InnerRefAttr, respectively.
2021-12-27 13:52:14 -07:00
Mike Urbach a2a058b70e [MSFT] Refactor placement export to use hw::GlobalRefs.
This refactors ExportQuartusTcl to use the hw::GlobalRefs and arrays
of hw::InnerRefAttrs directly. This greatly simplifies the
implementation, and removes the need for SwitchInstanceAttr. That
attribute will be fully removed in a follow up.
2021-12-27 13:51:57 -07:00
mikeurbach bd05d96c11
[PyCDE] Add entry method for PhysicalRegions and their references. (#2174)
This add the necessary Python binding boilerplate to create
PhysicalBounds and PhysicalRegionRef attributes. A new API is added to
System, which inserts a PhysicalRegion. A wrapper class for
PhysicalRegion allows creating a region, adding bounds, and getting a
reference attribute suitable for use with the add_attribute API.
2021-11-15 10:02:34 -08:00
mikeurbach a002a849b3
[MSFT] Re-work ExportQuartusTcl to export into verbatim nodes. (#2077)
This is the preferred way to output design collatoral. Closes
https://github.com/llvm/circt/issues/2068.

The ExportQuartusTcl pass is removed, and the functionality is moved
into LowerMSFTToHW. The pass now populates a SymbolCache of the things
we care about in the export, namely instances. It produces verbatim
ops containing the Tcl, which can then be emitted from ExportVerilog.

The old Python API to run the export is removed in favor of the new
approach. PyCDE now exports both System Verilog and Tcl using the
exportSplitVerilog API to output files into a directory.
2021-11-09 19:25:16 -07:00
John Demme 960e624d7f
[MSFT] [DeviceDB] Teach `walkPlacements` about boundaries (#2000)
`walkPlacements` now takes a bounding rectangle and a primitive type
upon which to filter.
2021-10-15 13:29:53 -07:00
John Demme 07c2778fa7
[MSFT] [DeviceDB] Add bindings to walk functions (#1942) 2021-10-06 21:46:15 -07:00
John Demme 5a4445ec3e [MSFT] [NFC] DeviceDB -> PrimitiveDB, combine all DB code
- Renames DeviceDB to PrimitiveDB.
- Puts both PrimitiveDB and PlacementDB in DeviceDB.h.
- Moves PlacementDB implementation into DeviceDB.cpp.
2021-10-06 14:23:55 -07:00
John Demme d488343996
[MSFT] [DeviceDB] Find nearest free location in column (#1937)
Find the nearest primitive in a column to the desired row. Said primitive should be of a given primitive type, and be unoccupied.
2021-10-06 11:12:01 -07:00
John Demme 12720afe41
[MSFT] Use a DeviceDB to seed a PlacementDB (#1922)
Just checks validity of placements for now.
2021-10-02 17:40:40 -07:00
John Demme ee2a93886c
[MSFT] Adding DeviceDB (#1921)
Created a DeviceDB which doesn't do anything yet. The `devType` to
`primitiveType` change got wrapped up in this change.
2021-10-02 01:28:24 -07:00
John Demme ede291cdd5 [MSFT] Rename `devType` to `primitiveType` on PhysLocation attribute 2021-10-01 23:13:06 -07:00
John Demme daa5dc503e [MSFT] Rename DeviceType enum to PrimitiveType 2021-10-01 22:09:52 -07:00
Parker Mitchell f76fadad6e
[MSFT] Rename DeviceDB to PlacementDB (#1894)
No functional changes. This PR simply renames DeviceDB to PlacementDB within the MSFT dialect. The "DeviceDB" name may be used in a future PR and live alongside the PlacementDB.
2021-10-01 18:24:10 -07:00
John Demme d046e6a7ec
[MSFT] Removing C++ generator code (#1918)
We've switched to Python-based generators. Ping-ponging between IR modifying
C++ and IR modifying Python was a massive mistake for pointer safety reasons.
2021-10-01 16:24:15 -07:00
John Demme 730b157be5
[MSFT] DeviceDB C API and Python bindings (#1717) 2021-09-03 20:12:16 -07:00
John Demme 0066f6dc79
[MSFT] Introduce `RootedInstancePath` and re-factor based on it (#1689)
A RootedInstancePath is just an instance path prepended with the root (aka top) module which the instance path is relative to. If we structure the placements based on this, we no longer have to walk the instance hierarchy while exporting TCL! This patch also removes support for locations not inside of instance switches. That use case required the design be fully elaborated which isn't really done.
2021-09-01 17:41:06 -07:00
John Demme 3ad8be3d88
[MSFT] [Python] Add a function to get an instance (#1613)
Given a root module and an instance path, find the corresponding instance from
the instance hierarchy. Return 'None' if the path wasn't found.
2021-08-20 13:57:35 -07:00
John Demme 43ccc6584e
[MSFT] [Py] Add physical location and switch instance attributes to python module (#1606) 2021-08-18 20:03:07 -07:00
Mike Urbach c9af2e1a44 [Python] Move remaining functionality behind the C-API, NFC.
There were some bits of the ESI and MSFT native pybind11 modules that
directly called into the CIRCT C++ libraries. This moves that
functionality out of the modules and behind the C-API. This proper
layering needs to be enforced before we can implement the upcoming
migration to use the improved upstream Python binding mechanism.

Also, this ensures all of the C-API functions used by the Python
bindings are annotated with MLIR_CAPI_EXPORTED, which will also become
required.
2021-07-27 13:55:15 -06:00
mikeurbach 9dd73b174f
[PyCDE] Include parameters in generator registration and lookup. (#1298)
Previously, different parameterizations of the same module would end
up using the most-recently registered generator and the
parameterization used when it was registered.

This includes the parameterization in the registered mapping, and
looks for that same parameterization when looking up generators. This
is trivially supported since we already store the parameterization as
an attribute on the Operation.

Added a few lines to the polynomial integration test to ensure the
behavior.
2021-06-17 19:59:48 -06:00
John Demme cc3d74cf69
[Py] Design entry language: generators (#1169)
Prototype of "generators". This version runs the generator for each and every op to lower and each time it is called, a new HWModuleOp is created at the top level. To fix this, I plan on unique'ing on the operation's attributes, result types, and operand types. This'll involve some refactoring since as of this PR the HWModuleOp creation and instantiation are both in the same callback.
2021-06-01 15:21:26 -07:00