Skip to content

Comments

Profile exports for the transaction kernel (1/2)#2391

Draft
huitseeker wants to merge 13 commits intonextfrom
huitseeker/feat/vm-profile-export
Draft

Profile exports for the transaction kernel (1/2)#2391
huitseeker wants to merge 13 commits intonextfrom
huitseeker/feat/vm-profile-export

Conversation

@huitseeker
Copy link
Contributor

@huitseeker huitseeker commented Feb 3, 2026

Companion PR of 0xMiden/miden-vm#2638

This tackles 0xMiden/miden-vm#2256

This branch makes the transaction kernel benchmark the single source of truth for performance, as discussed in issue above. It adds a VM profile export path in bench-transaction, defines the profile schema, and writes a concrete JSON profile from real kernel runs so the workload can be reused outside the protocol stack. The profile includes instruction mix and operation details derived from measured cycles, and tests exercise the write path so ratio extraction keeps working as the kernel evolves.

Workflow across repos:

  • Run the transaction kernel bench in miden-base and export the VM profile JSON.
  • Copy that profile into benches/synthetic-tx-kernel/profiles in miden-vm.
  • Run the synthetic benchmarks in miden-vm against that snapshot.

@huitseeker huitseeker force-pushed the huitseeker/feat/vm-profile-export branch from 9df7700 to 6313753 Compare February 3, 2026 01:55
@mmagician mmagician added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Feb 9, 2026
Add Cargo.lock changes from adding chrono dependency to bench-transaction
for VM profile timestamp functionality.
Replace .unwrap() calls with .expect() in:
- bin/bench-note-checker/benches/benchmarks.rs:25
- bin/bench-transaction/src/time_counting_benchmarks/prove.rs:39, 58, 91, 115
Add the VM profile exported from bench-transaction for use in
miden-vm synthetic benchmarks.
Add detailed operation information to the VM profile for synthetic
benchmark generation. This includes:

- OperationDetails struct with op_type, input_sizes, iterations, cycle_cost
- Profile export populates operation_details based on instruction mix
- Supports falcon512_verify, hperm, hmerge, load_store, arithmetic, control_flow

Fixes for realistic workload generation:
- Apply minimum iteration counts only when total_cycles >= 10000
- Use MIN_MIX_RATIO (0.1%) threshold to avoid floating-point noise
- Only include operations with meaningful mix ratios

Added tests:
- deserialize_profile_without_operation_details: backward compatibility
- deserialize_profile_with_operation_details: forward compatibility
- operation_details_consistent_with_total_cycles: cycle validation
- tiny_workload_no_minimum_inflation: small workload handling

Enables the synthetic-tx-kernel benchmark to generate realistic
workloads matching the instruction mix from real transaction profiles.
Adjusted the instruction-mix handling and minimum-iteration logic to avoid inflating low ratios, and added a write-path test to assert `write_vm_profile` emits real `operation_details`. Changes are localized to `bin/bench-transaction/src/cycle_counting_benchmarks/utils.rs`.

Changes:
- Normalize instruction mix when the sum drifts beyond tolerance to keep cycle budgeting consistent.
- Gate minimum iteration bumps so very small raw counts don’t get inflated.
- Add a `write_vm_profile` serialization test to validate exported `operation_details`.
@huitseeker huitseeker changed the title Profile exports for the transaction kernel Profile exports for the transaction kernel (1/2) Feb 10, 2026
@huitseeker huitseeker force-pushed the huitseeker/feat/vm-profile-export branch from 58746c8 to d48ecf0 Compare February 10, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants