Skip to content

Commit

Permalink
Move PGO collection to the separate script
Browse files Browse the repository at this point in the history
  • Loading branch information
dvolodin7 committed Mar 8, 2024
1 parent 94977ae commit de53b64
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
8 changes: 2 additions & 6 deletions tools/build/build-many.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,8 @@ do
echo "Setup build dependencies"
pip install -r ./.requirements/build.txt -r ./.requirements/test.txt
# Collect PGO
echo "Building profiling version"
PGO_DATA_DIR="/tmp/pgo-data/$ABI"
RUSTFLAGS="-Cprofile-generate=$PGO_DATA_DIR" python3 -m pip install --editable .
echo "Collecting PGO data"
PYTHONPATH=src/:$PYTHONPATH python3 ./tools/build/collect-pgo.py
$(./tools/build/get-rustup-bin.sh)/llvm-profdata merge -o $PGO_DATA_DIR/merged.profdata $PGO_DATA_DIR
PGO_DATA_DIR=`mktemp -d`
./tools/build/build-pgo.sh
# Build wheel
echo "Building wheel"
RUSTFLAGS="-Cprofile-use=$PGO_DATA_DIR/merged.profdata" python3 -m build --wheel
Expand Down
21 changes: 21 additions & 0 deletions tools/build/build-pgo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
# ------------------------------------------------------------------------
# Build version which collects PGO data
# ------------------------------------------------------------------------
# Copyright (C) 2022-24, Gufo Labs
# ------------------------------------------------------------------------

PGO_DATA_DIR=$1
if [ "$PGO_DATA_DIR" = "" ]; then
echo "PGO data dir must be set"
exit 1
fi

# Collect PGO
echo "Building profiling version"
RUSTFLAGS="-Cprofile-generate=$PGO_DATA_DIR" python3 -m pip install --editable .
echo "Collecting PGO data"
PYTHONPATH=src/:$PYTHONPATH python3 ./tools/build/pgo-runner.py
echo "Merging profdata"
$(./tools/build/get-rustup-bin.sh)/llvm-profdata merge -o $PGO_DATA_DIR/merged.profdata $PGO_DATA_DIR
echo "PGO profile is written into $PGO_DATA_DIR/merged.profdata"
File renamed without changes.
2 changes: 1 addition & 1 deletion tools/docs/update-bench-charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def build_barchart(
bench: Benchmark, data: List[Tuple[str, float]], scale: str
) -> None:
"""
Build bar chart into SVG file.
Build bar chart into PNG file.
Args:
bench: Benchmark description.
Expand Down

0 comments on commit de53b64

Please sign in to comment.