Commit Graph

8 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 f396653c7c [Arc] Use free variants of isa/cast/dyn_cast
Refer to https://mlir.llvm.org/deprecation/
2024-04-28 15:36:36 +02:00
Martin Erhart 895a818b09
[Arc] Align >=128-bit integers to 16 bytes (#6366)
This is a fix for an issue introduced by llvm-project:a21abc7 via
b895069. The alignment in LLVM was changed from 8 to 16 bytes but in Arc
we still allocated memory according to the old alignment, thus leading
to overlapping memory accesses (a store to a HW memory could modify the
state of a register stored after it in memory).
2023-11-01 17:12:11 +01: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 197c21a595 [NFC][Arc] Add accessors to the state type 2023-09-06 01:53:25 -07:00
Bea Healy 5f97768865
[Arc] Eliminate `AllocateState` `moveBefore`/`isBeforeInBlock` combination (#5481)
As mentioned in the removed TODO, `AllocateState` currently has an expensive combination of `moveBefore` and `isBeforeInBlock` calls. This applies a very similar fix to the one used in `LowerState` to avoid forcing the built in operation ordering to be repeatedly reconstructed.
2023-06-27 11:04:48 +02:00
Martin Erhart 43e69a81c6
[Arc] MemoryReadPortOp: remove enable and clock operand (#5194)
* Remove the optional enable and clock operands from `arc.memory_read_port` making it a combinatorial read port. Latencies can be added using the `arc.state` operation.
* Adjust InferMemories accordingly
* Make `arc.memory_read_port` pure to allow it to be moved into `arc.define` ops. This means the memory value has to be passed via argument. This will be considered to pass the whole memory as a value (like `hw.array`) at this stage of the lowering. The LegalizeStateUpdates pass should make it easy to switch to pointer semantics for memories.
* Remove top-level `sv.macro.decl` ops in StripSV (sorry for this unrelated change, but it's just 4 lines :) )
* Remove the optional stride parameter from the `!arc.memory` type and add a member function to conveniently compute the stride on-demand. Not removing it led to some issues in the lowering to LLVM which would have required bigger changes to AllocateState otherwise.
* Fix a bug in the ClockDomainOp canonicalizer revealed by the change to the regression test required by the removal of the `memory_read_port` operands
* Change the memory read port lowering in LowerState such that it does not reorder read ops anymore, but just converts them and also lowers Arcs that contain reads to functions early on because arcs don't allow ops with memory side effects. Alternatively we could split the arcs and pull the read ops out again.
* Add the memory read/write reordering to LegalizeStateUpdates instead. This is just a temporary implementation and fails on more complex cases, but we need to re-implement this pass anyways as it is very slow (~4 sec on rocket, 100s of sec on largeBoom)
* Add support for `func.call` op lowering in LowerArcToLLVM and lower arcs with LLVM internal linkage such that LLVM can remove those functions when getting inlined to reduce the objfile size to almost a third for rocket.
2023-05-14 09:22:37 +02:00
Fabian Schuiki 10f157f0a3
[Arc] Add state allocation passes (#4730)
Add three passes that implement state allocation. The passes take the
abstract state allocation ops, compute a memory layout for the overall
state of the model, and replace the allocation ops with simple pointer
getter ops that access the allocated piece of memory. The passes operate
as follows:

- `LegalizeStateUpdate` detects read-after-write hazards and introduces
  temporary storage locations that allow the read and write ops to
  occur without infringing on each other.
- `AllocateState` computes the overall memory layout and replaces
  allocation ops with simple accessor ops.
- `PrintStateInfo` emits the memory layout as a JSON file. This allows
  other tools to reason about the exact memory layout of the design.

State update legalization is still lacking proper handling of memory
reads and writes, which are significantly more involved than the simple
scalar registers. Follow-up work.

Co-authored-by: Martin Erhart <maerhart@outlook.com>
Co-authored-by: Zachary Yedidia <zyedidia@gmail.com>
2023-03-28 12:36:21 -07:00