Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fa176f9
feat(bench): create synthetic-tx-kernel benchmark crate structure
huitseeker Feb 1, 2026
f30e359
feat(bench): add component and synthetic kernel benchmarks with sampl…
huitseeker Feb 1, 2026
bda04fd
fix(bench): remove unused dependency and fix unstable feature usage
huitseeker Feb 1, 2026
3d97714
refactor(bench): add validation and tests for VM profile types
huitseeker Feb 1, 2026
c5e0462
fix(bench): use BTreeMap instead of HashMap in tests
huitseeker Feb 1, 2026
e98a156
refactor(bench): apply fixes for code quality and robustness
huitseeker Feb 1, 2026
2c4dca5
fix(bench): address issues in synthetic-tx-kernel
huitseeker Feb 1, 2026
f5a4b7b
refactor(bench): simplify code - remove unnecessary constructors and …
huitseeker Feb 1, 2026
70bcafc
fix(bench): address issues for synthetic-tx-kernel
huitseeker Feb 1, 2026
d96c013
refactor(bench): address code review findings for synthetic-tx-kernel
huitseeker Feb 1, 2026
93ab251
fix(bench): correct assembly syntax in synthetic-tx-kernel
huitseeker Feb 2, 2026
9eea6d7
fix: implement real falcon verif
huitseeker Feb 2, 2026
2ecdd5f
feat(bench): implement realistic synthetic transaction kernel benchmarks
huitseeker Feb 2, 2026
fecc9a3
Fix synthetic benchmark stack balance
huitseeker Feb 3, 2026
6a4b170
Fix repeat block edge case and falcon verify smoke test
huitseeker Feb 3, 2026
1a9590c
refactor(bench): simplify string building in synthetic-tx-kernel
huitseeker Feb 3, 2026
87b8403
Update synthetic tx benchmark files
huitseeker Feb 3, 2026
44bb677
Fix synthetic bench CI
huitseeker Feb 3, 2026
aba3019
Add prove benchmark for synthetic kernel
huitseeker Feb 3, 2026
dbb8863
Align synthetic bench trace length
huitseeker Feb 3, 2026
469c28e
Drop unused MastNode imports
huitseeker Feb 3, 2026
1b2b284
Gate MastNode imports on debug assertions
huitseeker Feb 3, 2026
63d3531
fix(bench): force concurrent trace build for synthetic kernel
huitseeker Feb 4, 2026
2fd3bd8
fix(trace): restore build_trace helper for benches
huitseeker Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Added constants support as an immediate value of the repeat statement ([#2548](https://github.com/0xMiden/miden-vm/pull/2548)).
- Add deserialization of the `MastForest` from untrusted sources. Add fuzzing for MastForest deserialization. ([#2590](https://github.com/0xMiden/miden-vm/pull/2590)).
- Added `StackInterface::get_double_word()` method for reading 8 consecutive stack elements ([#2607](https://github.com/0xMiden/miden-vm/pull/2607)).
- Added synthetic transaction kernel benchmarks driven by VM profile snapshots from miden-base ([#2638](https://github.com/0xMiden/miden-vm/pull/2638)).

#### Fixes

Expand Down
93 changes: 89 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"air",
"benches/synthetic-tx-kernel",
"core",
"crates/assembly",
"crates/assembly-syntax",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ build: ## Builds with default parameters

.PHONY: build-no-std
build-no-std: ## Builds without the standard library
$(BUILDDOCS) cargo build --no-default-features --target wasm32-unknown-unknown --workspace
$(BUILDDOCS) cargo build --no-default-features --target wasm32-unknown-unknown --workspace --exclude synthetic-tx-kernel

# --- executable ----------------------------------------------------------------------------------

Expand Down
26 changes: 26 additions & 0 deletions benches/synthetic-tx-kernel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "synthetic-tx-kernel"
version = "0.1.0"
edition = "2021"
license.workspace = true

[dependencies]
miden-vm = { path = "../../miden-vm" }
miden-core = { path = "../../core" }
miden-processor = { path = "../../processor", default-features = false, features = ["concurrent"] }
miden-core-lib = { path = "../../crates/lib/core" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"

[dev-dependencies]
criterion = { version = "0.5", features = ["async_tokio"] }
tokio = { version = "1.0", features = ["rt-multi-thread"] }

[[bench]]
name = "component_benchmarks"
harness = false

[[bench]]
name = "synthetic_kernel"
harness = false
78 changes: 78 additions & 0 deletions benches/synthetic-tx-kernel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Synthetic Transaction Kernel Benchmarks

This crate generates synthetic benchmarks that mirror the transaction kernel from miden-base,
enabling fast feedback for VM developers without requiring the full miden-base dependency.

## Overview

The benchmark system works by:

1. **Profile Export** (in miden-base): The transaction kernel benchmark exports a VM profile
describing its instruction mix, operation counts, and cycle breakdown.

2. **Profile Consumption** (in miden-vm): This crate reads the profile and generates Miden
assembly code that replicates the same workload characteristics.

3. **Benchmark Execution**: Criterion.rs runs the generated benchmarks for statistical rigor.

## Usage

### Running Benchmarks

```bash
# Run component benchmarks (isolated operations)
cargo bench -p synthetic-tx-kernel --bench component_benchmarks

# Run synthetic kernel benchmark (representative workload)
cargo bench -p synthetic-tx-kernel --bench synthetic_kernel
```

### Updating the Profile

When the transaction kernel in miden-base changes:

1. Run benchmarks in miden-base:
```bash
cd /path/to/miden-base
cargo run --bin bench-transaction --features concurrent
```

2. Copy the generated profile to `latest.json`:
```bash
cp bench-tx-vm-profile.json /path/to/miden-vm/benches/synthetic-tx-kernel/profiles/latest.json
```

3. Commit the updated profile in miden-vm.

## Profile Format

Profiles are JSON files with the following structure:

```json
{
"profile_version": "1.0",
"source": "miden-base/bin/bench-transaction",
"timestamp": "2025-01-31T...",
"miden_vm_version": "0.20.0",
"transaction_kernel": {
"total_cycles": 73123,
"phases": { ... },
"instruction_mix": {
"arithmetic": 0.05,
"hashing": 0.45,
"memory": 0.08,
"control_flow": 0.05,
"signature_verify": 0.37
}
}
}
```

## Architecture

- `src/profile.rs`: Profile data structures
- `src/generator.rs`: MASM code generation from profiles
- `src/validator.rs`: Profile validation and comparison
- `benches/component_benchmarks.rs`: Isolated operation benchmarks
- `benches/synthetic_kernel.rs`: Representative workload benchmark
- `profiles/`: Checked-in VM profiles from miden-base
Loading