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).
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.
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.
* 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.
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.
`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.
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.
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.
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.
- 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.
- 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.