Skip to content

Instantly share code, notes, and snippets.

@1480c1
Created June 9, 2021 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1480c1/5c3201beb464ecb39599a84220f29342 to your computer and use it in GitHub Desktop.
Save 1480c1/5c3201beb464ecb39599a84220f29342 to your computer and use it in GitHub Desktop.
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