Commit Graph

29 Commits

Author SHA1 Message Date
Vito Gamberini 11d61f80a5
[CMake] Implement add_circt_tool() (#5821)
- Adds/renames the associated CMake variables:
   * CIRCT_BUILD_TOOLS
   * CIRCT_INCLUDE_TOOLS
   * CIRCT_TOOLS_INSTALL_DIR

- Actually uses the CIRCT_INCLUDE_TOOLS variable now
2023-08-10 18:37:45 -05:00
Marco Balboni e8ec7d73e3
[LLVM] Bump to e105141 (#5414)
* Ensure the ControlFlow dialect is registered in the context where needed and linked against (not sure where exactly this stems from)
* LLVM IR cttz and ctlz intrinsics moved from undef to poison and take an attribute instead of value now: https://reviews.llvm.org/D151692
* Function inliner extension is a promised interface: https://reviews.llvm.org/D120368
* New replaceOp added to Rewriter: https://reviews.llvm.org/D152814

---------

Co-authored-by: Martin Erhart <maerhart@outlook.com>
2023-06-21 13:20:27 +02:00
Aditya Naik cc4073dc98
LLVM bump to latest master (c81f14e5898c) (#4881) 2023-03-28 02:24:59 -07:00
Will Dietz e92e10f34e
[LLHD] Install llhd-sim utility (when enabled). (#4464)
We already build+install its libraries, include tool too.
2022-12-19 16:22:26 -06:00
Schuyler Eldridge c676bc9173
[tools] Change tools to use CIRCT-specific bug msg
Change all existing CIRCT tools to use a CIRCT-specific bug report
message.  Previously a crash would tell people to file a bug on LLVM
which isn't correct.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2022-11-12 18:10:54 -05:00
John Demme fdeaf90894
[CMake] Reduce number of deps (#3569)
Cull unnecessary dependences. Reduces the number of files which need to
be compiled for check-circt by ~20%. Compiles and links fine on my machine,
but we've had linking issues in the past, so this may be bumpy.
2022-07-20 17:37:24 -07:00
Will Dietz 61e5d42e6b
circt-reduce,firtool,llhd-sim: cleanup --help output, put options in category (#2979)
* circt-reduce: cleanup --help output, put options in category

Hides unrelated options from LLVM+co, and makes it easier
to find the most relevant options at glance.

When building CIRCT against LLVM built as shared libraries
(as preferred by many Linux distributions) this greatly
reduces the number of options printed.

* firtool: cleanup --help output, put options in category

Hides unrelated options from LLVM+co, and makes it easier
to find the most relevant options at glance.

When building CIRCT against LLVM built as shared libraries
(as preferred by many Linux distributions) this greatly
reduces the number of options printed.

* llhd-sim: group llhd-sim options in --help output

Hides unrelated options from LLVM+co, and makes it easier
to find the most relevant options at glance.

When building CIRCT against LLVM built as shared libraries
(as preferred by many Linux distributions) this greatly
reduces the number of options printed.

Even for the statically linked version more commonly used
with CIRCT, the help output is significantly reduced.

* llhd-sim: touchup optimizationLevel cl::opt to be static (NFCI)

* test/llhd-sim: Add commandline test

* circt-reduce: check categories in help test

* firtool: check categories in help test

* firtool: add new option to mainCategory too
2022-05-03 16:02:57 -05:00
huanghuang 7168841105
[LLHD] Refactor enum class and move header file locations. (#2805)
Refactor `enum TraceMode` to `enum class TraceMode` to enrich
  the readability. And move header files to avoid re-declare like
  enum TraceFormat.
2022-03-28 09:47:45 +08:00
Fabian Schuiki 246d4fdd34
Bump LLVM to 61814586 (#2758) 2022-03-14 14:13:45 +01:00
Andrew Lenharth bb21827888
Bump LLVM to 761bc83af4ee70c6c5156f73ed88947a5d9f013f
Bump LLVM to 761bc83af4ee70c6c5156f73ed88947a5d9f013f
2022-02-16 23:32:32 -06:00
Chris Lattner 910ee76fbd [include/circt/Conversion] Flatten out a level of directories, NFC.
Move singleton headers like circt/Conversion/LLHDToLLVM/LLHDToLLVM.h
up to circt/Conversion/LLHDToLLVM.h since that is the only thing in that
directory.
2021-10-04 16:29:31 -07:00
Martin Erhart 8b5f5e216b
[LLHD] Use integer, array and struct types from HW dialect (#1669)
* [LLHD] Use integer, array and struct types from HW dialect

* Simplify HWDialect declaration
2021-08-30 23:02:16 +02:00
Martin Erhart f5055566f4
[LLHD] Use comb dialects ops where possible (#1649)
* [LLHD] Use comb dialects ops where possible

* Clang-format

* Remove redundant code

* Remove unused includes, add tests, remove redundant code
2021-08-28 08:39:06 +02:00
John Demme 21485874c8
[llvm] Update submodule to latest (#1589)
Co-authored-by: Andrew Lenharth <andrew@lenharth.org>
Co-authored-by: Fabian Schuiki <fabian@schuiki.ch>
Co-authored-by: Andrew Young <youngar17@gmail.com>
2021-08-18 19:37:43 -07:00
Andrew Young 65c72e5856
Disable llhd-sim tests when the executable is not built (#1425) 2021-07-14 18:42:45 -04:00
mikeurbach 880eb40530
Update LLVM to 4dfddf715b94857998601aa79c25e4f327d44dfa. (#972)
This includes a couple breaking changes:
* AttrDef has a new argument for attribure traits.
* Several includes we depended on appear to have been moved to forward
declarations, so add the explicit includes we needed.
2021-04-28 14:51:27 -06:00
mikeurbach cce113ea55
[LLHD] Add option to specify shared libs to load in llhd-sim (#789)
This adds a -shared-libs option to llhd-sim that is analogous to the
same option for mlir-cpu-runner. If specified, those libraries are
passed to the ExecutionEngine to dynamically load and link.
2021-03-19 08:10:36 -06:00
mikeurbach ed6c6421a4
Update LLVM to c68b560be381e831fd72c6b8b8909427e4e2ff36. (#749)
Some changes in this bump:

* OpBuilderDag -> OpBuilder: github.com/llvm/llvm-project/commit/32c49c7
* Changes to Type getChecked and verification: github.com/llvm/llvm-project/commit/06e25d5
* Changes to Value internals, with minor public breakage: github.com/llvm/llvm-project/commit/3dfa861
* Changes to LLVM translation: github.com/llvm/llvm-project/commit/19db802
* .getAttrs() -> ->getAttrs(): 
* Adding llvm_unreachable after covered switch statements with returns
* Separating diagnostics tests from FileCheck tests
2021-03-11 12:05:16 -07:00
mikeurbach 015ea05523
Update LLVM to c68d2895a1f4019b387c69d1e5eec31b0eb5e7b0 (#685)
* Need to include a new header in LLHD sim for LLVM translations
* Need to explicitly register the LLVM translations
2021-02-26 10:31:28 -07:00
Andrew Young 3ffcacc89a Use global pass generation for all conversion passes
This combines all conversion passes into a single Passes.td similar to
MLIR.  For some conversions, the passes were not specified using ODS.
These passes have been converted to use ODS which means they will show
up in generated documentation.  Conversion passes have also been moved
out of dialect namespaces, it is normal for them to live under the CIRCT
namespace.
2021-02-05 13:51:25 -08:00
John Demme 18b04b2780
Windows builds (#374)
* Adding Windows build and test workflow

* ubuntu -> windows

* cmake paths

* Adding build parallelism

* Builds locally

* A large portion of the tests fail on Windows

* Remove release build

* Debug takes up waayyy too much space!

* Run in Release mode

* Add '-j 1' to disable parallelism

* Build LLVM separately

* Fixing build workflow

* Finally working!

* Update buildAndTestWindows.yml

Only cache object dirs

* Update buildAndTestWindows.yml

Fixing formatting issue

* Remove pre-build job
2021-01-12 21:35:12 -08:00
Shivam Gupta d98d2a1364
Rename library from libMLIRfoo to libCIRCTfoo (#357)
* change library name from libMLIRCAPIRTL to libCIRCTCAPIRTL

* change library name from liblibMLIRLLHDTransforms to libCIRCTLLHDTransforms

* change library name from liblibMLIRRTLToLLHD to libCIRCTRTLToLLHD

* rename library from liblibMLIRLLHDToLLVM to libCIRCTLLHDToLLVM

* rename library from libMLIRFIRRTLToLLHD to libCIRCTFIRRTLToLLHD

* rename library from libMLIRFIRRTLToRTL to libCIRCTFIRRTLToRTL

* rename library from libMLIRHandshakeToFIRRTL to libCIRCTHandshakeToFIRRTL

* rename library from libMLIRStandardToHandshake to libCIRCTStandardToHandshake

* rename library from libMLIRStandardToStaticLogic to libCIRCTStandardToStaticLogic

* rename library from libMLIRRTL to libCIRCTRTL

* rename library from libMLIRSV to libCIRCTSV

* rename library from libMLIRESI to libCIRCTESI

* rename library from libMLIRFIRRTL to libCIRCTFIRRTL

* rename library from libMLIRLLHD to libCIRCTLLHD

* rename library from libMLIRHandshakeOps to libCIRCTHandshakeOps

* rename library from libMLIRStaticLogicOps to libCIRCTStaticLogicOps

* alphabetically rearrange LIBS in CMakeLists.txt
2020-12-24 23:16:37 +05:30
Shivam Gupta 9f34d3742b
Add missing LLVM license info to file headers (#352)
* add LLVM license info to files header

* Add LLVM license info to files header

* Add LLVM license info to files header

* Add LLVM license info to file headers

* Revert "Add LLVM license info to files header"

This reverts commit 22869676ad.

* Add LLVM license info to file headers

* run git-clang-format

* add missing file descriptions

* run git clang-format

* Add LLVM license info to file headers

* Add LLVM license info to files header
2020-12-24 23:11:01 +05:30
Simon Rodoni ef14ef11aa [llhd-sim] A first set of performance considerations (#290)
* Gather current instance once; store lookup pointers

* Enable codegen optimization flag

* Reflect optimizations also when dumping LLVM IR

* Avoid copying slots multiple times per slot

* Use SmallVector in Slot and event queue

* Store JIT function pointers into instances' structs

* Avoid unnecessary Slot copying

* Simplify Slot structure

* Lookup instances through integer indexes

* Reuse slots, never sort queue

* Split slot change data to a seprate vector

* Reuse changes buffers instead of clearing them

* Pass APInt buffers by const reference

* Use const ref where no changes are needed

* Defer change APInt allocation as far as possible

* Directly pass changes to queue

* Track top slot and unused slots; avoid redundant queue iteration

* Pass the correct ArrayRef sizes when initializing APInts

* refactor cycle counter name;

* Fix unexpected trace entries and possible instance executions

Multiple drives to the same signals could erroneously trigger trace entries to be printed, and, in the worst case, unexpected instances to wakeup. This should fix the issue by processing one signal at a time, instead of one change at a time, triggering wakeups and trace entries only if the final result for the event represents a change.

* Sort top changes and process all changes for the same signal at once

* Map signal indexes to change indexes; switch to normal sort()

* Rebase fixes

* Make awkward for loop a while

* Adjust comments; remove comment artifacts

* Refactor variable names

* Remove unused includes

* Use existing signal reference instead of redundant vector access

* Remove unused and unimplemented method

* Add method to search instances by name

* Remove unnecessary includes

* Refactor Slot internal structures names

* Adjust comments

* Move dummy event insertion into simulate method

* Remove unused width annotation

* Comment artifact

* Use SmallVector<T, 0> for instances, signals, sensitivity lists

* Refactor variable name

* Refactor redundant code

* Remove unused constructor

* Comment

* Use llvm::sort

* Use empty() as check; use pop_back_val() to pop

* Make failure an assertion
2020-12-09 10:43:22 -05:00
Simon Rodoni 6d81ab46eb
[llhd-sim] Move trace generation to a dedicated class (#229)
* Add trace format interface

This adds a new class that makes it easier to add new dump formats (includes a couple of variations of the trace format used so far) to the simulator. This fully moves trace generation to the new itnerface, which also fixes:
* The signals within a time-step are properly sorted by their paths.
* Signals of arrays and tuples generate one trace entry for each of their element, instead of being printed as ints.

* Fix make_pair

* Parse mlir files through a SourceMgr

This changes how the mlir source files are parsed, making it more similar to what is done in MLIROptMain. This also enables piping a module into llhd-sim directly, which was previously not possible.

* Add option to stop simulation at a real-time step.

* Use sort vector + erase-unique  for wakeupQueue

* Add named-only trace format

This introduces a new merged trace format that filters out default-named signals with name 'sig[0-9]*'. This is useful to compare the trace against converted vcd traces of the top-level signals.

* Remove unused variable

* Adapt signal name filtering for named-only trace

* Update completition message

* Rebase fixes

* clang-format

* Debug artifact

* Merge redundant change push code

* Fix typo

* Fix root instance map key

* Remove unnecessary map entry

* Refactor redundant code

* Simplify if statement; comments

* Define traced signals only once on initialization

* Don't trace structured signal elements that do not change, for all formats

* Refactor sort in a private function

* Add boilerplate headers

* Ensure nothing is printed when there is no change

* Add formats test

* Minor adjustments/comments

* Simplify `lastValue` map key

* Adjust formats descriptions

* clang-tidy

* Skip clang-tidy header-guard check

* Comment typo

Co-authored-by: Fabian Schuiki <fabian@schuiki.ch>

Co-authored-by: Fabian Schuiki <fabian@schuiki.ch>
2020-11-11 13:50:23 +01:00
mikeurbach ae14a4b0d6
Update to MLIR d14cfe10341681 (#102)
* Update to MLIR d14cfe10341681

This MLIR commit includes a small fix for ODS custom directives.

We also need some minor updates to work with the latest MLIR:

1. Fully qualified `cppNamespace` for dialects using that
2. Update custom ODS builders to remove the `Builder` and
   `OperationState` parameters, which are automatically inserted

* Move LLHD dialect into CIRCT namespace

This aligns LLHD with the other dialects. In some cases, a new
`using namespace mlir;` is added to ease the transition.

* Put generated Handshake and StaticLogic ops under ::circt namespace

This aligns with the other ODS generate operations, which use
a `cppNamespace` rooted under `::circt`.

* Use full `circt::llhd` namespace where it used to be `mlir::llhd`
2020-09-27 12:39:27 -06:00
mikeurbach e3b4ba5642 Remove global dialect registry
This removes uses of the deprecated global dialect registry and
registers dialects explicitly in a DialectRegistry or MLIRContext.
2020-09-23 23:39:08 -06:00
mikeurbach 2ce50b87da
Update LLVM to 1d3d9b9cd808ef37f3dacd3ada81bff1353cd24b (#78)
This picks up some enhancements to ODS, as well as a few changes:

* Dialect registration is being updated. For now, the global dialect
  registry is enabled for backwards compatibility while we update
  the dialect registry mechanisms
* Kinds are removed from Types and Attributes. This is a mostly
  mechanical change to use isa and TypeSwitch
* Generated passes are registered differently. The approach here is
  to define the registerPasses function in an anonymous namespace
  and call it from within the existing static helpers.
* Upstream LLVM dialect has updated how types are printed, and the
  LLHDToLLVM tests are updated accordingly
2020-09-11 17:20:56 -07:00
maerhart 8a82a81806
Merge LLHD project into CIRCT (#14)
* Merge LLHD project into CIRCT

* Split LLHDOps.td into multiple smaller files

* move LLHDToLLVM init definition and prune includes

* Format tablegen files with 2 space indent, 80 col width; move out trait helper function

* Move implementation logic from LLHDOps.h to cpp file

* Empty lines for breathing space; nicer operation separators

* Move simulator to Dialect/LLHD/Simulator

* move `State.h` and `signal-runtime-wrappers.h` to lib directory

* pass ModuleOp by value

* make getters const, return ModuleOp by value

* Use isa, cast, dyn_cast appropriately

* wrap struct in anon namespace; make helpers static

* [cmake] Fold into LINK_LIBS

* fix for loops

* replace floating point with `divideCeil`

* prune redundant includes

* make llhd-sim helpers static

* remove StandardToLLVM pass registration

* move verilog printer to cpp file, add global function as public API

* Move transformation pass base classes and registration to lib, add file header boilerplate

* Few improvements

* Return diagnostics directly
* isa instead of kindof
* Improve walks
* etc.

* add 'using namespace llvm;' again

* Always pass a location when creating new ops

* Improve cmake files

  * remove unnecessary `LLVMSupport` links.
  * add `PUBLIC` where missing.
  * move LLVMCore under `LINK_COMPONENTS`.

* Add file headers and improve simulator comments

* Some LLHDToLLVM improvements

* Fix walks.
* Use `std::array` instead of `SmallVector` when resize is not needed.
* Fix a potential sefgault by passing an ArrayRef with no data owner.
* Remove some unnecessary steps.
* Remove some unnecessary const strings.

* Add new LowerToLLVMOptions argument

The new argument was added in 10643c9ad85bf072816bd271239281ec50a52e31.

* Add missing file header boilerplate and newline

* Improve for-loop

* use static instead of anonymous namespace for functions

* fit to 80 columns, cast instead of dyn_cast

* Changes for LLVM update

* use llvm format instead of std::stringstream and iomanip

Co-authored-by: rodonisi <simon@rodoni.ch>
2020-07-02 11:04:33 -07:00