Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -21,6 +21,7 @@
- Added `BlockNumber::saturating_sub()` ([#2660](https://github.com/0xMiden/protocol/issues/2660)).
- [BREAKING] Added cycle counts to notes returned by `NoteConsumptionInfo` and removed public fields from related types ([#2772](https://github.com/0xMiden/miden-base/issues/2772)).
- Automatically enable `concurrent` feature in `miden-tx` for `std` context ([#2791](https://github.com/0xMiden/protocol/pull/2791)).
- Added transaction trace snapshot generation for miden-vm synthetic benchmarks ([#2794](https://github.com/0xMiden/protocol/pull/2794)).

### Fixes

Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions bin/bench-transaction/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ path = "src/time_counting_benchmarks/prove.rs"

[dependencies]
# Workspace dependencies
miden-core = { workspace = true }
miden-processor = { features = ["concurrent"], workspace = true }
miden-protocol = { features = ["testing"], workspace = true }
miden-standards = { workspace = true }
miden-testing = { workspace = true }
Expand Down
40 changes: 39 additions & 1 deletion bin/bench-transaction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,44 @@ cargo run --bin bench-transaction --features concurrent
cargo bench --bin bench-transaction --bench time_counting_benchmarks --features concurrent
```

## Generating trace snapshots for miden-vm's synthetic benchmark

A separate bin target, `tx-trace-snapshot`, executes the same representative transaction contexts through the VM in order to build a real `ExecutionTrace`, then it reads per-component trace lengths from `TraceLenSummary`, and writes JSON snapshots consumed by miden-vm's `miden-synthetic-tx-kernel` bench.

```bash
cargo run --release -p bench-transaction --bin tx-trace-snapshot
```

Output: one JSON per scenario under `bin/bench-transaction/snapshots/`:

- `consume-single-p2id.json`
- `consume-two-p2id.json`

These files are captured against whichever miden-processor version this workspace currently pins. To feed them into `miden-vm`, copy over the same-named files in the consumer's snapshot directory:

```bash
cp bin/bench-transaction/snapshots/*.json \
../miden-vm/benches/synthetic-tx-kernel/snapshots/
```

then:

```bash
cargo bench -p miden-synthetic-tx-kernel
```

The snapshot contract is documented in
`miden-vm/benches/synthetic-tx-kernel/README.md` and
`miden-vm/benches/synthetic-tx-kernel/src/snapshot.rs` (two tiers: `trace.*` hard-target totals, `shape.*` advisory per-chiplet breakdown).

The consumer's hard match is based on padded trace brackets, not exact raw row equality:
`padded_core_side = max(64, next_pow2(max(core_rows, range_rows)))` and
`padded_chiplets = max(64, next_pow2(chiplets_rows))`. The raw per-chiplet `shape.*` values help
the synthetic workload stay representative, but they are advisory profiling metadata rather than
the primary proof-cost contract.

The schema is maintained manually; there is no shared schema crate. The `schema_version` field is cross-checked at load time, and the consumer's loader rejects unknown versions. When changing the schema, bump both sides together.

## License

This project is [MIT licensed](../../LICENSE).
This project is [MIT licensed](../../LICENSE).
18 changes: 18 additions & 0 deletions bin/bench-transaction/snapshots/consume-single-p2id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"schema_version": "0",
"source": "protocol/bench-transaction:consume-single-p2id",
"timestamp": "unix-1776687994",
"miden_vm_version": "0.22",
"trace": {
"core_rows": 77699,
"chiplets_rows": 123129,
"range_rows": 20203
},
"shape": {
"hasher_rows": 120352,
"bitwise_rows": 416,
"memory_rows": 2297,
"kernel_rom_rows": 63,
"ace_rows": 0
}
}
18 changes: 18 additions & 0 deletions bin/bench-transaction/snapshots/consume-two-p2id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"schema_version": "0",
"source": "protocol/bench-transaction:consume-two-p2id",
"timestamp": "unix-1776687994",
"miden_vm_version": "0.22",
"trace": {
"core_rows": 80522,
"chiplets_rows": 141260,
"range_rows": 20121
},
"shape": {
"hasher_rows": 138208,
"bitwise_rows": 592,
"memory_rows": 2392,
"kernel_rom_rows": 67,
"ace_rows": 0
}
}
Loading
Loading