Browse Source

Update RG99 PGO script and add instructions

Updates the script for compatibility with `UNPACKED_SAVES` and adds an
instructions document.
pull/5692/head
Gleb Mazovetskiy 3 years ago
parent
commit
2d1773f644
  1. 12
      Packaging/OpenDingux/build.sh
  2. 4
      Packaging/OpenDingux/profile-generate.sh
  3. 37
      Packaging/OpenDingux/rg99-pgo.md

12
Packaging/OpenDingux/build.sh

@ -41,7 +41,6 @@ declare BUILD_TYPE=release
main() {
parse_args "$@"
BUILD_DIR="build-${TARGET}"
BUILDROOT_TARGET="$TARGET"
# If a TOOLCHAIN environment variable is set, just use that.
@ -100,6 +99,7 @@ parse_args() {
exit 64
fi
TARGET="${positional[0]}"
BUILD_DIR="build-${TARGET}"
if (( PROFILE_GENERATE )) && (( PROFILE_USE )); then
>&2 echo "Error: at most one of --profile-use and --profile-generate is allowed"
@ -115,9 +115,19 @@ parse_args() {
OPK_EXTRA_FILES=(
Packaging/OpenDingux/profile-generate.sh
test/fixtures/timedemo/WarriorLevel1to2/demo_0.dmo
)
local -a demo_saves=(
test/fixtures/timedemo/WarriorLevel1to2/demo_0_reference_spawn_0.sv
test/fixtures/timedemo/WarriorLevel1to2/spawn_0.sv
)
if [[ $TARGET = rg99 ]]; then
# We use unpacked saves on RG99.
mkdir -p "$BUILD_DIR/demo-saves"
unpack_and_minify_mpq --output-dir "$BUILD_DIR/demo-saves" "${demo_saves[@]}"
OPK_EXTRA_FILES+=("$BUILD_DIR/demo-saves"/*)
else
OPK_EXTRA_FILES+=("${demo_saves[@]}")
fi
fi
if (( PROFILE_USE )); then
CMAKE_CONFIGURE_OPTS+=(

4
Packaging/OpenDingux/profile-generate.sh

@ -3,8 +3,8 @@
set -x
SAVE_DIR="$(mktemp -d)"
ln -s "${PWD}/demo_0_reference_spawn_0.sv" "${SAVE_DIR}/"
ln -s "${PWD}/demo_0_reference_spawn_0_sv" "${SAVE_DIR}/"
ln -s "${PWD}/demo_0.dmo" "${SAVE_DIR}/"
cp "${PWD}/spawn_0.sv" "${SAVE_DIR}/"
cp -r "${PWD}/spawn_0_sv" "${SAVE_DIR}/"
./devilutionx --diablo --spawn --demo 0 --timedemo --save-dir "$SAVE_DIR" --data-dir ~/.local/share/diasurgical/devilution
rm -rf "$SAVE_DIR"

37
Packaging/OpenDingux/rg99-pgo.md

@ -0,0 +1,37 @@
# RG99 profile-guided optimization
The RG99 build must be PGO'd for reasonable performance.
Here are the instructions for producing a PGO'd build.
1. Install <https://github.com/diasurgical/devilutionx-mpq-tools>
2. Build the OPK for profiling data collection:
```sh
TOOLCHAIN=/opt/rs90-toolchain Packaging/OpenDingux/build.sh rg99 --profile-generate
```
3. Copy the OPK to RG99 (`rg99` is 10.1.1.3):
```sh
scp -O build-rg99/devilutionx-rg99.opk rg99:/media/sdcard/apps
```
4. Now, run the OPK. It will run the timedemo instead of the actual game and will take about 1 hour (due to heavy swapping).
5. Copy the profiling data from RG99:
```sh
rm -rf /tmp/devilutionx-profile
scp -r -O rg99:/media/data/local/home/devilutionx-profile /tmp/devilutionx-profile
```
6. Build the OPK use the collected profiling data:
```sh
TOOLCHAIN=/opt/rs90-toolchain Packaging/OpenDingux/build.sh rg99 --profile-use --profile-dir /tmp/devilutionx-profile
```
7. The final package is at `build-rg99/devilutionx-rg99.opk`.
Loading…
Cancel
Save