diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml
index c7afb638c3f..a5509aebf40 100644
--- a/.github/workflows/codspeed.yml
+++ b/.github/workflows/codspeed.yml
@@ -4,6 +4,11 @@ on:
schedule:
- cron: "17 2 * * *"
workflow_dispatch:
+ inputs:
+ runner_probe:
+ description: Check Macro Runner availability without building or benchmarking
+ type: boolean
+ default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -16,9 +21,20 @@ env:
permissions: {}
jobs:
+ runner-probe:
+ name: Probe CodSpeed runner
+ if: github.event_name == 'workflow_dispatch' && inputs.runner_probe
+ runs-on: codspeed-macro-arm64-graviton-ubuntu-22-04
+ timeout-minutes: 2
+ steps:
+ - name: Verify the ARM64 runner is available
+ run: test "$(uname -m)" = aarch64
+
codspeed:
name: CodSpeed
- runs-on: ubuntu-latest
+ if: inputs.runner_probe != true
+ timeout-minutes: 60
+ runs-on: codspeed-macro-arm64-graviton-ubuntu-22-04
outputs:
run-id: ${{ steps.benchmarks.outputs.run-id }}
permissions:
@@ -39,19 +55,20 @@ jobs:
tool: cargo-codspeed@5.0.1
- name: Build compile-time benchmarks
- run: cargo codspeed build --locked -p celox --bench compilation
+ run: cargo codspeed build --locked --measurement-mode walltime -p celox --bench compilation
- name: Run compile-time benchmarks
id: benchmarks
+ timeout-minutes: 15
uses: CodSpeedHQ/action@v5
with:
- mode: simulation
- run: cargo codspeed run -p celox
+ mode: walltime
+ run: cargo codspeed run --measurement-mode walltime -p celox --bench compilation
report:
name: Report CodSpeed
needs: codspeed
- if: always() && (github.ref_name == 'master' || github.ref_name == 'develop')
+ if: always() && inputs.runner_probe != true && (github.ref_name == 'master' || github.ref_name == 'develop')
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9477d10ea5b..4a0f4e9c930 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -120,6 +120,12 @@ interpreter, native and Cranelift backends in both two-state and four-state mode
wide-value latch checks, and a small sorter compilation smoke test.
The 257/512-bit per-bit graph cases and sorter sizes 4/8/16/32 are measured by
`benches/compilation.rs` in the existing daily/manual CodSpeed workflow.
+Compilation benchmarks use CodSpeed walltime measurement on its ARM64 Graviton
+Macro Runner: CPU simulation made
+a single 512-bit case take tens of minutes. The benchmark step has a 15-minute
+timeout and the complete job a 60-minute limit; a timeout is reported as failure.
+The organization runner group must allow this public repository to use CodSpeed
+Macro Runners. Simulation and walltime measurements have separate baselines.
Nested-write benchmarks reuse the same semantic assertions as the small tests.
Scaling cases use one iteration without per-case warmups or adaptive sampling;
a small counter warms process-global analyzer state before measurement.
@@ -130,8 +136,8 @@ CodSpeed reporting workflow.
Build and run them with the same CodSpeed harness as CI:
```sh
-cargo codspeed build --locked -p celox --bench compilation
-cargo codspeed run -p celox
+cargo codspeed build --locked --measurement-mode walltime -p celox --bench compilation
+cargo codspeed run --measurement-mode walltime -p celox --bench compilation
```
## Finish validation
diff --git a/crates/celox-design/src/lib.rs b/crates/celox-design/src/lib.rs
index 5e45cf13916..37d54007118 100644
--- a/crates/celox-design/src/lib.rs
+++ b/crates/celox-design/src/lib.rs
@@ -291,6 +291,9 @@ pub enum ProcessStatus {
/// A synchronous host operation. The delay slot holds its family and
/// local site index; the same process resumes after the host responds.
HostRequest,
+ /// A program kernel called `$exit` (IEEE 1800-2023 24.7): it and every
+ /// other kernel of its program instance ([`ProcessSlots::program`]) end.
+ Exit,
}
impl ProcessStatus {
@@ -308,6 +311,7 @@ impl ProcessStatus {
Self::Yield => 8,
Self::Stop => 9,
Self::HostRequest => 10,
+ Self::Exit => 11,
}
}
@@ -323,6 +327,7 @@ impl ProcessStatus {
8 => Some(Self::Yield),
9 => Some(Self::Stop),
10 => Some(Self::HostRequest),
+ 11 => Some(Self::Exit),
_ => None,
}
}
@@ -465,6 +470,12 @@ pub struct ProcessSlots {
/// Every delay the kernel suspends for is a constant of at least one
/// time unit.
pub const_delays: bool,
+ /// For an `initial` procedure of a program instance (IEEE 1800-2023
+ /// 24.3), the status slot of that instance's first such kernel, which
+ /// every kernel of the instance names: the kernel runs in the reactive
+ /// region set (24.3.1), and `$exit` and the end of the instance's
+ /// kernels act on them together (24.7). `None` for design code.
+ pub program: Option,
pub resume: A,
pub status: A,
pub delay: A,
@@ -476,6 +487,7 @@ impl ProcessSlots {
is_initializer: self.is_initializer,
requires_timed_simulation: self.requires_timed_simulation,
const_delays: self.const_delays,
+ program: self.program.map(&mut map),
resume: map(self.resume),
status: map(self.status),
delay: map(self.delay),
@@ -1058,6 +1070,9 @@ pub struct SchedulerSchema {
/// The event signals a host periodic clock may drive inside the
/// scheduler's slots, in the order of its clock slots.
pub clocks: Vec,
+ /// Per process kernel, the event signals it writes, as indices into
+ /// [`Self::events`]; empty for a kernel the scheduler does not run.
+ pub kernel_events: Vec>,
}
impl SchedulerSchema {
@@ -1069,6 +1084,7 @@ impl SchedulerSchema {
fallback: self.fallback,
events: self.events.into_iter().map(&mut map).collect(),
clocks: self.clocks.into_iter().map(map).collect(),
+ kernel_events: self.kernel_events,
}
}
}
@@ -1791,6 +1807,7 @@ mod tests {
ProcessStatus::from_code(10),
Some(ProcessStatus::HostRequest)
);
+ assert_eq!(ProcessStatus::from_code(11), Some(ProcessStatus::Exit));
}
#[test]
diff --git a/crates/celox-frontend-core/src/process.rs b/crates/celox-frontend-core/src/process.rs
index 1931a26203b..b141ad8d532 100644
--- a/crates/celox-frontend-core/src/process.rs
+++ b/crates/celox-frontend-core/src/process.rs
@@ -368,6 +368,13 @@ impl ProcessKernelBuilder {
self.end(ProcessStatus::Finish);
}
+ /// End the kernel and the other kernels of its program instance
+ /// (`$exit`, IEEE 1800-2023 24.7). No block is open afterwards.
+ pub fn exit(&mut self) {
+ self.wait_site = None;
+ self.end(ProcessStatus::Exit);
+ }
+
/// Complete the kernel. If a block is still open, the process ends there.
pub fn build(mut self) -> ExecutionUnit {
if self.builder.has_open_block() {
diff --git a/crates/celox-frontend-core/src/sdk.rs b/crates/celox-frontend-core/src/sdk.rs
index f74172ab2a4..18232d0b2a4 100644
--- a/crates/celox-frontend-core/src/sdk.rs
+++ b/crates/celox-frontend-core/src/sdk.rs
@@ -1732,6 +1732,7 @@ fn lower_processes(
is_initializer: false,
requires_timed_simulation: false,
const_delays: false,
+ program: None,
resume: lowering
.hidden
.declare(name("resume"), PROCESS_RESUME_WIDTH, false),
diff --git a/crates/celox-frontend-core/src/symbolic/assembly.rs b/crates/celox-frontend-core/src/symbolic/assembly.rs
index 7682ec5627d..aab80fca1fd 100644
--- a/crates/celox-frontend-core/src/symbolic/assembly.rs
+++ b/crates/celox-frontend-core/src/symbolic/assembly.rs
@@ -2072,6 +2072,7 @@ pub fn schedule_symbolic_rtl_reporting_loops(
fallback: Vec::new(),
events: Vec::new(),
clocks: Vec::new(),
+ kernel_events: Vec::new(),
});
// The runtime reads counters, the signals waits watch and staged
// nonblocking values directly; no unit loads a wait's signal.
diff --git a/crates/celox-frontend-sv/src/lowering.rs b/crates/celox-frontend-sv/src/lowering.rs
index 8cf8c077ad4..fa7ee3be2e1 100644
--- a/crates/celox-frontend-sv/src/lowering.rs
+++ b/crates/celox-frontend-sv/src/lowering.rs
@@ -4537,6 +4537,7 @@ fn lower_initial_processes(
is_initializer: process.is_initializer(),
requires_timed_simulation: process.is_scheduled_edge(),
const_delays: false,
+ program: None,
resume: declare("resume", PROCESS_RESUME_WIDTH),
status: declare("status", PROCESS_STATUS_WIDTH),
delay: declare("delay", PROCESS_DELAY_WIDTH),
diff --git a/crates/celox-runtime/src/schedule.rs b/crates/celox-runtime/src/schedule.rs
index b9a0e39311b..85be69ad6e6 100644
--- a/crates/celox-runtime/src/schedule.rs
+++ b/crates/celox-runtime/src/schedule.rs
@@ -21,6 +21,8 @@ pub struct ResolvedSchedule {
pub(crate) signal_to_id: FxHashMap,
pub(crate) signal_index_by_id: Vec,
pub(crate) processes: Vec,
+ /// The kernels of program instances, in declaration order.
+ pub(crate) program_processes: Vec,
/// Counted signals and the domains their counters trigger.
pub(crate) counted: Vec,
pub(crate) counted_by_offset: FxHashMap,
@@ -77,6 +79,10 @@ pub(crate) struct SchedulerRefs {
/// The event id and signal of each host clock the scheduler may run,
/// in the order of its clock slots.
pub(crate) clocks: Vec<(usize, SignalRef)>,
+ /// Per process kernel, the bits of `levels` of the events it writes.
+ pub(crate) kernel_events: Vec,
+ /// Per clock slot, the bit of `levels` of its event.
+ pub(crate) clock_events: Vec,
pub(crate) clock_next: SignalRef,
pub(crate) clock_period: SignalRef,
pub(crate) clock_value: SignalRef,
@@ -190,6 +196,7 @@ impl ResolvedSchedule {
.iter()
.map(|process| ProcessRefs {
is_initializer: process.slots.is_initializer,
+ program: process.slots.program.as_ref().map(resolve),
resume: resolve(&process.slots.resume),
starts_with_event_wait: process.slots.requires_timed_simulation,
status: resolve(&process.slots.status),
@@ -299,6 +306,12 @@ impl ResolvedSchedule {
event_info,
signal_to_id,
signal_index_by_id,
+ program_processes: processes
+ .iter()
+ .enumerate()
+ .filter(|(_, process)| process.program.is_some())
+ .map(|(index, _)| index)
+ .collect(),
processes,
counted,
counted_by_offset,
@@ -365,6 +378,24 @@ impl ResolvedSchedule {
.iter()
.map(|event| backend.resolve_event_opt(event).map(|event| event.id()))
.collect::