Repository navigation
merge queue: checking #1766 on master (d5a1eff), stacked on #1764 - #1769
Closed
mergify[bot] wants to merge 5 commits into
Closed
mergify[bot] wants to merge 5 commits into
mergify[bot] wants to merge 5 commits into
Conversation
…e time slot
## Summary
IEEE 1800-2023 4.3, 4.5 and 10.4.2 make every change of a variable's value an update event, which schedules the processes sensitive to it, even when a later write in the same time slot restores the old value. Celox compared values only at the end of an evaluation, so it missed these changes in four cases:
| Writer | Reader | Before | Now |
|---|---|---|---|
| process: `a = 1; a = 0;` | `always_comb` (immediate assertion, `$display`) | not run again | runs again |
| process: `a <= 1; a <= 0;` | `always_comb` | not run again | runs again |
| `always_ff`: `a <= 1; a <= 0;` (or blocking) | `@(a)`, `@(posedge a)`, `always_comb` | no event | event |
| the same `always_ff` pulse, in a design without processes | another FF domain clocked by `a` | domain does not fire | fires |
Icarus 13.0 gives the same results on an equivalent design. A glitch between two combinational processes is still allowed, since that ordering is legal.
**Occurrence counters.**
- The SV frontend gives each sensitivity atom of an `always_comb` activation group a counter (`CombObserver::sensitivity_counters`).
- Assembly turns these, and the existing counted signals, into probes (`RuntimeSchema::occurrence_probes`).
- An FF evaluation unit that stores to a probed or counted signal more than once bumps its counter at each store that changes the value.
- Kernel blocking writes and published nonblocking updates bump the counters through `ProbeRefs`, once per counter per write.
- An observer is active when its values or its counters differ from the last snapshot (`RuntimeCombObserver::occurrence_counters`).
**Batch path.** A design with counted signals but no processes now stays on the batch step (`ScheduleModel::timed` is `!processes.is_empty()`). `batch_round` checks the counters after each evaluation and adds their domains to the approved edges. The first version moved such designs to the timed path, which cost 17.8% on the divided-clock design below; this costs 7.0%.
**Observer snapshots.** `comb_activation::ObserverReads` resolves the reads once. A range of a signal of at most 64 bits is read as a `u64` (with its mask plane in four-state), and only wider signals use `BigUint`. Groups are numbered densely, so the activation check is O(observers). The old check read every range as `BigUint`.
## Perf
callgrind instructions inside `SimulationState::step_until`, native backend (cranelift matches). Each design has 64 `always_ff` registers, each writing a default and then overriding it.
| design | base | this PR | change |
|---|---|---|---|
| plain | 115.60M | 115.82M | +0.19% |
| divider: an FF writes a derived clock twice per edge, a second FF counts on it | 155.24M | 166.06M | +7.0% |
| assert: plus 64 `always_comb` immediate assertions | 319.35M | 51.24M | −84% |
- **plain:** the JIT code's cost is identical (9,100,455 in both). The difference comes from inlining in the Rust runtime. A const-generic split and an out-of-line counter check both measured worse (+0.67%, +0.33%).
- **divider:** the counter check that correctness requires. Setting trigger bits from the JIT would remove most of it, but that is a larger change.
- **assert:** the word reads replace `BigUint` snapshots. With `BigUint` counter reads this design was +50%.
## Validation
- New `crates/celox/tests/sv_update_events.rs`: 9 cases on the interpreter, cranelift, native and wasm backends (36 tests). They cover:
- blocking, process-NBA and FF-NBA restores running `always_comb` again;
- assertions reporting again;
- FF NBA and blocking pulses waking `@(a)` and `@(posedge a)`;
- no event when the value is kept;
- exclusive branches as one event;
- an FF pulse firing a domain in a design without processes.
- Cross-checked the expected values against Icarus 13.0.
- `cargo nextest run` on celox, celox-frontend-{core,sv,veryl}, celox-runtime, celox-design, celox-slt, celox-test-suite, celox-vpi and celox-napi with CI's features (`celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus`): 14,020 passed, 330 skipped.
- sv-tests conformance (`conformance/sv-tests/run.py`): unchanged from `expected.tsv`.
- `cargo clippy --workspace --all-targets` with CI's features and `-D warnings`, `cargo fmt --check`.
Not covered:
- Veryl observers get no sensitivity counters.
- Targets with both blocking and nonblocking writers (`NbaStage`) are not instrumented.
- Host writes do not bump counters.
## BREAKING CHANGE
New public fields:
- `celox_slt::CombObserver::sensitivity_counters`
- `celox_design::RuntimeCombObserver::occurrence_counters` (serde default: empty)
- `celox_design::RuntimeSchema::occurrence_probes`
- `celox_design::schedule::ScheduleModel::probes`
`ScheduleModel::timed` no longer counts counted signals.
Change-Id: I3c9de5c5bc7e26c31765c9a6d45a9e04287eabaf
Change-Id: Ieb4eecbfe1dd50186a513da2a12cd3147ad7d428
Casts of divisions and remainders could fail with unknown operand signedness because the internal zero-divisor guard has an untyped unknown arm. Infer the guard's signedness and width from its operation, and avoid inserting guards again when binding an enclosing expression. This also preserves signed arithmetic in four-state lowering instead of creating nested unsigned muxes. Evaluate signing-cast operands in their original type before changing the result sign, so unsigned'(a / b) does not turn a signed division unsigned. Add two shared regressions for mixed signs, parameter divisors, narrowing, nested divisions, signing/type casts, and four-state zero-divisor results. Validation: - Full SV suite: 3952 passed, 20 existing ignored across five backends. - Analyzer unit tests: 791 passed, 3 existing ignored. - Shared suite unit tests: 46 passed, 2 existing ignored. - Icarus: both new cases passed. Verilator: ordinary case passed; the adapter reports the four-state case unsupported due to four-state expectations. - Affected library/harness Clippy (-D warnings), cargo fmt and diff checks pass. - Unchanged Taxi sources with O1/two-state pass 29 cocotb tests across mac_ctrl_rx[8], mac_ctrl_tx[8], and zircon_ip_len_cksum[32], with zero skips. Three other previously cast-blocked configurations now reach existing $size or SERDES array-range blockers. All 52 resolved SV source fingerprints match the original audit; no optimization settings or exclusions changed. Change-Id: I560b79b58966e9083629921a4dbf6563ff5d09f3
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. Nobody needs to act on it.
Mergify opened it for batch waggish-poire-gl828a of the
changesqueue, to test #1766 before it merges intomaster.What this draft tests
Mergify checks that #1766 still passes CI once combined with everything queued ahead of it. CI runs on this draft's code, built in this order:
masteratd5a1effd55b64bThe check is speculative: it assumes the pull requests ahead will merge, so it starts without waiting for them.
✨ Where it stands: closed
Pull request #1764 ahead in the queue was removed (reason:
checks failed).Follow the
changesqueue in the dashboardWhat happens next
Tip
A red check is not necessarily caused by this batch. These checks run on a tip that also carries the commits of the pull request ahead, so a failure here can come from it as much as from #1766. See only this batch's changes.
Queued ahead of this batch
This pull request entered the queue before this batch and is not part of it.
coreMetadata for CI tooling, read by
mergify ci1 scope
coreRequired conditions of queue rule
changesfor mergecheck-success = Queue validationmaster]:check-neutral = @github-actions/Rust Test & NAPI Buildcheck-skipped = @github-actions/Rust Test & NAPI Buildcheck-success = @github-actions/Rust Test & NAPI Buildcheck-success = Conventional Commit titlemaster]:check-success = @github-actions/Lint & Formatcheck-neutral = @github-actions/Lint & Formatcheck-skipped = @github-actions/Lint & Formatmaster]:check-success = @github-actions/NAPI Build (Linux ARM64 GNU)check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)master]:check-success = @github-actions/NAPI Build (Windows)check-neutral = @github-actions/NAPI Build (Windows)check-skipped = @github-actions/NAPI Build (Windows)master]: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/JS Test (Windows)check-neutral = @github-actions/JS Test (Windows)check-skipped = @github-actions/JS Test (Windows)master]:check-success = @github-actions/Conventional Commit titlecheck-neutral = @github-actions/Conventional Commit titlecheck-skipped = @github-actions/Conventional Commit titleRequired 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-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)check-success = @github-actions/NAPI Build (Linux ARM64 GNU)master]:check-skipped = @github-actions/NAPI Build (Windows)check-neutral = @github-actions/NAPI Build (Windows)check-success = @github-actions/NAPI Build (Windows)master]: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-skipped = @github-actions/JS Test (Windows)check-neutral = @github-actions/JS Test (Windows)check-success = @github-actions/JS Test (Windows)master]:check-success = @github-actions/Conventional Commit titlecheck-neutral = @github-actions/Conventional Commit titlecheck-skipped = @github-actions/Conventional Commit title