llvm / llvm/circt

[Arc] Split storage into two pointers

Open
#9,748 0 comments 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

We are now starting to track global state such as the current simulation time in the model storage. When we allocate storage sub-regions with `%y = arc.alloc_storage %x`, we still want `arc.current_time %x` and `arc.current_time %y` to load the same time variable at the beginning of simulation storage, even if the states the alloc storage op creates a contiguous block of memory for any states hanging off of it, which can be located anywhere within the simulation. Once we start supporting `llhd.global_signal`s, we'll have even more things that appear at the beginning of model storage that any sub-storages still need access to.

To fix this, let's change the lowering of `!arc.storage` and the associated ops to produce two `!llvm.ptr`s instead of one: one global pointer that points to the beginning of the model's simulation storage and that isn't affected by sub-storage allocation and projection; and one pointer that is modified by `arc.alloc_storage`/`arc.storage.get` to point to subregions of simulation memory.

A bit later we'll also want to make the layout of this state explicit in dedicated struct definition ops, such that we can use such an op to describe the layout of the global model storage, including the time variable and any global signals, too.

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 tracing the lowering of !arc.storage and its associated operations, especially arc.alloc_storage and arc.storage.get. Determine where the single storage pointer is produced and updated. Done means the lowering exposes separate global and subregion pointers, with allocation and projection changing only the subregion pointer while global state remains accessible.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.