Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
rav1e pgo stuff
#!/usr/bin/bash
# Replace --target with your own, it seems it's recommended to have it there
# explicitly according to rust's docs
# normal build
cargo build --release --target=x86_64-unknown-linux-gnu
# compile with profile-generate
mkdir -p pgo-profile
RUSTFLAGS="-Cprofile-generate=$PWD/pgo-profile" \
cargo build --release --target=x86_64-unknown-linux-gnu --target-dir pgo
# run encoder on test set, doesn't need to be parallel
parallel -u ./pgo/x86_64-unknown-linux-gnu/release/rav1e --output /dev/null --threads "$(nproc)" ::: ./objective-1-fast/*.y4m
# merge the data
llvm-profdata merge -o "$PWD/pgo-profile/merged.profdata" "$PWD/pgo-profile"
# compile with profile-use
RUSTFLAGS="-Cprofile-use=$PWD/pgo-profile/merged.profdata -Cllvm-args=-pgo-warn-missing-function" \
cargo build --release --target=x86_64-unknown-linux-gnu --target-dir pgo
# final binary avilable at ./pgo/x86_64-unknown-linux-gnu/release/rav1e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment