mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-02 05:43:12 +00:00
Profile-guided optimization script (#321)
This commit is contained in:
parent
806641d13f
commit
7a8e12b8f4
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
/target
|
||||
Cargo.lock
|
||||
/tmp
|
||||
pgo-data.profdata
|
||||
|
||||
31
pgo-profile.sh
Executable file
31
pgo-profile.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -rf tmp/pgo
|
||||
|
||||
if !(rustup help >/dev/null); then
|
||||
echo "Rustup not found; ensure rustup is on PATH" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if !(rustup component add llvm-tools-preview); then
|
||||
echo "Could not install llvm-tools-preview" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TOOLCHAIN_BASE=$(dirname $(dirname $(rustup which cargo)))
|
||||
TOOLCHAIN_NAME=$(basename $TOOLCHAIN_BASE)
|
||||
TARGET_TRIPLE=${TOOLCHAIN_NAME#*"-"} # e.g. nightly-x86_64-apple-darwin -> x86_64-apple-darwin
|
||||
PROFDATA_PATH=$TOOLCHAIN_BASE/lib/rustlib/$TARGET_TRIPLE/bin/llvm-profdata
|
||||
|
||||
if !(RUSTFLAGS="$RUSTFLAGS -Cprofile-generate=$(pwd)/tmp/pgo/data -Ctarget-cpu=native" cargo test --target-dir tmp/pgo/target --release test_recursive_recursive_verifier -- --ignored); then
|
||||
echo "Build failed" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if !($PROFDATA_PATH merge -o pgo-data.profdata tmp/pgo/data); then
|
||||
echo "Could not create .profdata file" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf tmp/pgo
|
||||
|
||||
echo '.profdata file successfully created. Add "-Cprofile-use=$(pwd)/pgo-data.profdata" to RUSTFLAGS to use it.' 1>&2
|
||||
Loading…
x
Reference in New Issue
Block a user