-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathpgo
More file actions
executable file
·30 lines (22 loc) · 986 Bytes
/
Copy pathpgo
File metadata and controls
executable file
·30 lines (22 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
ARIA_LIB_DIR="${ARIA_LIB_DIR:-${SELF_DIR}/lib}"
RUST_MIN_STACK=16777216
cargo install cargo-pgo && rustup component add llvm-tools-preview
output=$(cargo pgo build -- --profile pgo 2>&1)
aria_bin=$(printf "%s\n" "$output" | sed -n 's/.* Now run \(.*\/aria\) on your workload.*/\1/p')
# TODO: write a more interesting benchmark workload
RUST_MIN_STACK=${RUST_MIN_STACK} ARIA_LIB_DIR=${ARIA_LIB_DIR} ${aria_bin} ${SELF_DIR}/examples/sieve.aria
cargo pgo optimize build -- --profile pgo
aria_parent=$(dirname "$aria_bin")
json=false
for arg in "$@"; do
if [ "$arg" = "--json" ]; then json=true; break; fi
done
# emit JSON so that automated tools can process the path to the optimized binary
# e.g. path=`jq -r '.output_path' /path/to/json.out`
if [ "$json" = true ]; then
printf '{"output_path":"%s"}\n' "$aria_parent"
else
printf 'Run PGO optimized Aria as ARIA_LIB_DIR="%s" %s\n' "${ARIA_LIB_DIR}" "${aria_bin}"
fi