Profile-powered synthetic tx benchmarks (2/2)#2638
Draft
huitseeker wants to merge 24 commits intonextfrom
Draft
Conversation
c58b396 to
ee37d43
Compare
Add comprehensive validation and documentation to synthetic-tx-kernel profile types based on code review feedback: - Enhanced InstructionMix::validate() to check individual values are within [0.0, 1.0] range before checking sum - Added doc comments clarifying expected formats for version fields (semver) and timestamp (ISO 8601) - Documented expected HashMap key values for phases and operations - Added unit tests covering validation, serde roundtrips, and edge cases (empty maps, zero cycles) Also fixed minor clippy warnings in validator.rs: - Added Default impl for ProfileValidator - Used abs_diff() instead of manual subtraction All 8 new tests pass and clippy is clean.
The PhaseProfile.operations field is defined as BTreeMap<String, u64>, but the test code was using HashMap::new(). This caused compilation errors when running tests. Fix by using BTreeMap consistently throughout.
- Fix profile loading to use CARGO_MANIFEST_DIR for crate-relative paths - Remove unused CoreLibrary imports from benchmark files - Fix duplicate CoreLibrary instantiation by creating one instance and reusing - Add smoke test before benchmarking to validate generated code executes - Make MASM output conditional on MASM_WRITE env var - Replace symlink profiles/latest.json with regular file for Windows compatibility - Improve error messages with file paths in error context - Fix clippy warnings (default_constructed_unit_structs, unused_variables) - Update README to remove symlink instructions
…intermediate vars
- Fix version validation to support both "1.0" and "1.0.0" formats (profile.rs doc comment says "major.minor.patch" format) - Replace manual Default impl with #[derive(Default)] on ProfileValidator - Add test for "1.0.0" version format and short "1.0" format
- Fix smoke test to use .expect() instead of .unwrap() for better error messages - Remove unused _total_cycles_expected variable - Change bench_program to take Program by reference to avoid unnecessary cloning - Add MASM_WRITE environment variable documentation - Improve error handling in latest_profile() - Add comprehensive tolerance boundary tests for instruction mix validation - Add test for infinity handling in profile diff serialization - Move INSTRUCTION_MIX_TOLERANCE to associated constant - Add explanatory comment for BTreeMap usage - Remove redundant derive attributes from ProfileValidator
- Remove invalid use.miden::core::sys imports (not valid in simple programs) - Remove exec.sys::truncate_stack calls (not needed without stdlib imports) - Replace deprecated mem_storew/mem_loadw with mem_storew_be/mem_loadw_be - Fix memory alignment (use address 0 instead of 1) - Add actual operation implementations for component benchmarks
Implemented real Falcon512 verification in the component benchmark (with proper core library/advice inputs) and added compile-only generator tests that assemble all component benchmarks, including a verify-opcode check. Also recorded a roborev comment for job 23. Changes: - Emit `exec.falcon512poseidon2::verify` in the Falcon component benchmark and wire the bench to run it with real signature/advice inputs. - Add generator tests that assemble all component benchmarks and assert the Falcon verify opcode is emitted.
Generate executable Miden assembly from VM profiles with realistic instruction mixes. Key changes: - Enhanced assembly generator with operation-specific code generation - Added generate_hperm_block, generate_hmerge_block, generate_falcon_verify_block, generate_load_store_block, generate_arithmetic_block, generate_control_flow_block - Falcon512 verification simulated with cycle-equivalent nested loops - All operations are stack-balanced to prevent overflow - Added OperationDetails struct matching miden-base profile format - Component benchmarks use direct assembly with proper stack inputs - All 30 tests pass, both benchmark suites run successfully
Use writeln! macro instead of push_str + format! for cleaner code: - Add std::fmt::Write import for writeln! support - Simplify generate_kernel() with writeln! macro - Simplify generate_component_benchmark() with writeln! macro - Simplify push_single_repeat_block() with writeln! macro - Simplify push_nested_repeat_block() with writeln! macro
948bf30 to
509096a
Compare
509096a to
2fd3bd8
Compare
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.
Companion PR of 0xMiden/protocol#2391
This branch adds a synthetic transaction kernel benchmark so miden-vm can be tested without pulling in the full protocol, as discussed in issue #2256. It introduces a new benchmark crate with generators, validators, and bench targets that consume the VM profile snapshot exported by miden-base, which is treated as the only real workload benchmark. This keeps miden-vm performance testing representative while staying decoupled from protocol dependencies.
Workflow across repos:
benches/synthetic-tx-kernel/profilesin miden-vm.