Repository navigation
merge queue: merged #2695, #2704, #2703: refactor(sv)!: pass the analysis session explicitly instead of sharing it through RefCell (+2 more) - #2712
Closed
mergify[bot] wants to merge 8 commits into
Conversation
…g it through RefCell An analysis kept its caches and what it reported in an AnalysisState that its contexts shared through an Rc, mutated behind RefCells and Cells: the classes and class specializations laid out so far, the class declaration scopes, the progress of nested specializations, the dimension discovery caches, the elaboration memo, the semantic type table, the registry of package class specializations, the call sites, the diagnostics and the inline randomizations. These are now plain fields of a Session that analysis owns and passes as `&mut Session` beside its context. A scope analyzed on its own starts a session; a package class specialization is analyzed in a session that takes over the registry, the types and the call sites and gives them back. Guards that undid state on drop are explicit steps after the work they bracket, and the constraint budget, the counters of unnamed generate blocks and the interface expansion cache are owned values too. What module analyses add to the packages they use (package class specializations, semantic types and call sites) was mutated through the shared `&Packages`. It is now a `Design`, which `Packages::design` starts from and which every analysis of a module of the design takes as `&mut Design`: `ParsedSource::analyze_module` and its siblings take `(&Packages, &mut Design)`, and `Packages::specialized_state_modules` reads the package state from a `Design`. The frontend keeps one `Design` per elaboration. Behavior is unchanged: the analyzer and frontend tests, the SystemVerilog suite and a UVM elaboration (same output, about 11 s and 1.0 GB before and after) agree. Change-Id: I45f5bd5855e3593db29f801e7ecc65846a9adc24
Binary, octal and hex digits were accumulated by shifting the whole value and mask once per digit, so parsing a literal was quadratic in its width. The constant interpreter round-trips wide values through such literals: evaluating the 14,884-bit mask function of Taxi's 64-bit LFSR spent about 30% of its compile time in these shifts. Fill each digit's bits of the value and mask words directly instead; octal digits may straddle a word boundary. An equivalence test checks random digit strings, including unknown and invalid digits, against the shifting parser. Change-Id: Icdda4fd7195824bdd3bfcbad8e02a4c7a518ba70
Taxi's LFSR builds its 122x122-bit mask in `wire mask = lfsr_mask();`, a static zero-argument function that assigns its result bit by bit. The analyzer cannot prove that every call assigns all of it, so the result stays static storage kept between calls (IEEE 1800-2023 13.4.2). That excluded the function from the evaluate-once constant path, and the call made its process count as reading simulation state. The function body was then generated as runtime logic of 1.8M machine instructions, which spent most of the compile in register allocation. Without arguments and without any read of that result, every call performs the same assignments, so the bits no call assigns keep their initial value and each call returns what the first does. Accept such functions for constant evaluation, and do not treat a call that lowers to its constant as reading state. A read of the result, including through an assignment target index, keeps the call. Single-CPU `celox vpi build`: lfsr64 125 s -> 18 s with a peak RSS of 1.7 GiB -> 243 MiB, and phy64 281 s -> 50 s with 2.1 GiB -> 288 MiB. The Taxi cocotb tests of both configurations pass with the same simulated durations as Verilator. Change-Id: I740502a83e35de07efdaf2e88e8dcd12ccee6cd4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is a merge queue draft opened by Mergify. Its pull requests have merged, and nobody needs to act on it.
Mergify opened it for batch grown-fricassee-c3dqmp of the
changesqueue, to test #2695, #2704 and #2703 before they merged intomaster.🎉 What landed
Mergify merged each pull request into
masteron its own, then closed this draft:325abf4f33cfb95a591bfThis draft's code was built in this order:
masterat41d966762e046dQueued ahead of this batch
This pull request entered the queue before this batch and is not part of it.
Metadata for CI tooling, read by
mergify ci1 scope
coreRequired conditions of queue rule
changesfor mergecheck-success = Conventional Commit titlecheck-success = Queue validationcheck-success = Verify workflow lockfilemaster]:check-success = @github-actions/Lint & Formatcheck-neutral = @github-actions/Lint & Formatcheck-skipped = @github-actions/Lint & Formatmaster]:check-success = @github-actions/Rust Test & NAPI Buildcheck-neutral = @github-actions/Rust Test & NAPI Buildcheck-skipped = @github-actions/Rust Test & NAPI Buildmaster]:check-success = @github-actions/JS Test (Ubuntu)check-neutral = @github-actions/JS Test (Ubuntu)check-skipped = @github-actions/JS Test (Ubuntu)master]:check-success = @github-actions/Conventional Commit titlecheck-neutral = @github-actions/Conventional Commit titlecheck-skipped = @github-actions/Conventional Commit titlemaster]:check-success = @github-actions/Queue validationcheck-neutral = @github-actions/Queue validationcheck-skipped = @github-actions/Queue validationmaster]:check-success = @github-actions/Verify workflow lockfilecheck-neutral = @github-actions/Verify workflow lockfilecheck-skipped = @github-actions/Verify workflow lockfileRequired conditions to stay in the queue
-conflict-draft-head ~= ^(integration/|renovate/veryl-crates$|upgrade/veryl-|release-please--branches--master--components--celox$|master$)-head ~= ^renovate/-label = release:holdbase ~= ^(master|develop)$base ~= ^stack/body ~= (?m)^Depends-On:head != release-please--branches--master--components--celoxlabel = merge-readymaster]:check-success = @github-actions/Lint & Formatcheck-neutral = @github-actions/Lint & Formatcheck-skipped = @github-actions/Lint & Formatmaster]:check-success = @github-actions/Rust Test & NAPI Buildcheck-neutral = @github-actions/Rust Test & NAPI Buildcheck-skipped = @github-actions/Rust Test & NAPI Buildmaster]:check-success = @github-actions/JS Test (Ubuntu)check-neutral = @github-actions/JS Test (Ubuntu)check-skipped = @github-actions/JS Test (Ubuntu)master]:check-success = @github-actions/Conventional Commit titlecheck-neutral = @github-actions/Conventional Commit titlecheck-skipped = @github-actions/Conventional Commit titlemaster]:check-skipped = @github-actions/Queue validationcheck-neutral = @github-actions/Queue validationcheck-success = @github-actions/Queue validationmaster]:check-success = @github-actions/Verify workflow lockfilecheck-neutral = @github-actions/Verify workflow lockfilecheck-skipped = @github-actions/Verify workflow lockfile