-
Notifications
You must be signed in to change notification settings - Fork 122
[PGO] collect cycle data #3442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[PGO] collect cycle data #3442
Conversation
| #[test] | ||
| fn guest_execution_data() { | ||
| let mut stdin = StdIn::default(); | ||
| stdin.write(&GUEST_ITER); | ||
| let execution_data = execution_data_from_guest(GUEST, GuestOptions::default(), stdin.clone()); | ||
| println!("Execution data: {execution_data:#?}"); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to make this a part of our CLI if we run these frequently.
| pub fn execution_data_from_guest( | ||
| guest: &str, | ||
| guest_opts: GuestOptions, | ||
| inputs: StdIn, | ||
| ) -> Vec<Cycle> { | ||
| let OriginalCompiledProgram { exe, vm_config, .. } = compile_openvm(guest, guest_opts).unwrap(); | ||
| let program = Prog::from(&exe.program); | ||
|
|
||
| // Set app configuration | ||
| let app_fri_params = | ||
| FriParameters::standard_with_100_bits_conjectured_security(DEFAULT_APP_LOG_BLOWUP); | ||
| let app_config = AppConfig::new(app_fri_params, vm_config.clone()); | ||
|
|
||
| // prepare for execute | ||
| let sdk = PowdrExecutionProfileSdkCpu::new(app_config).unwrap(); | ||
|
|
||
| execution_data::<BabyBearOpenVmApcAdapter>(&program, || { | ||
| sdk.execute(exe.clone(), inputs.clone()).unwrap(); | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Top part mostly same as execution_profile_from_guest. Make it a helper.
|
TODO: Make it a JSON like the following as per @georgwiese. |
|
Nice! 🤩 Pushed a few commits to update the JSON format and integrate with my notebook (which I pushed too). E.g., you can run: Then, the notebook looks at the 9th instruction (1-indexed) of this block. It works end-to-end, but I think there is currently a bug, because the value is always zero. I haven't looked into this yet, but noting that it is already the case in the example in the PR description. |
WIP. Read and write data are currently hardcoded to
0because I still need to figure out their length, which depends on a runtime constant. However the idea should remain the same.How this works
cycle-data): [PGO] collect cycle data openvm#48RUST_LOG=trace cargo test --release --package powdr-openvm --lib -- tests::guest_execution_data --exact --show-output.