llvm / llvm/circt

[arcilator] Add functionality to the arcilator runtime library

Open
#8,484 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Arc
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

There are a bunch of features we might want to support for arcilator simulations that are a pain to implement in MLIR / LLVM IR directly and should preferably made available by a runtime library. Off the top of my head, this could include:

  • Advanced formatted printing (arbitrary width integers, binary formatting, padding, X/Z values)
  • Everything involving the file system
  • Parsing memory initialization files
  • Managing dynamic buffers and containers
  • PRNG algorithms and seeding for reproducible random initialization
  • Multi-threading (enqueue a series of simulation runs and dispatch them to a thread pool)

We also want these features to be available in JITed runs, so we need to make sure the compiled functions are visible to the execution engine. Depending on the host platform this can get a little messy. The arc-jit-env library (#8483) was an attempt to compile the current header-only implementation in arcilator-runtime.h to a shared library.

I've also experimented with a Rust implementation of a runtime library. Admittedly, more out of personal curiosity rather than for technical reasons. Having the Rust Standard Library and cargo available to pull in crates like num_bigint certainly is nice to get things done quickly. On the other hand we inevitably have to do a fair amount of unsafe pointer ping-pong between the IR model and the runtime, potentially defeating the whole memory safety aspect of Rust. If we were to go for a Rust implementation we'd also have to figure out to what extent we want to isolate it from the rest. Should we keep the sources in-tree or in a separate project? Should it be integrated in the CMake build process?

But first of all, we need a lowering pipeline that can make use of such a library. 😅

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the current header-only arcilator-runtime.h implementation and the arc-jit-env library work in issue #8483. First determine the lowering pipeline needed for generated simulations to call a runtime library, then assess which proposed features and host-platform visibility requirements are in scope. Done requires an agreed runtime design and an integrated lowering and JIT path.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, rust
Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.