unity page scripts: guest GL from the tree under test, --fjit for Muck

muck-page.sh and hk-page.sh defaulted GEX_GL_X64 to the prebuilt
scratch/unity/gl64-new (2026-10-07), which predates the frame-query cache
(85c3bb78) and the async present at swap interval 0 (7605de5c). Page Muck
on a2d4c964 + 6ac92f45 ran at 13.5 presents/s with it and 23.5 with gl64q2
(edger, --fjit + unit); a guest GL built from master is as fast as gl64q2
(21.6 vs 21.5, --fjit, no units). The new guest-gl.sh TREE builds the
tree's own guest GL into TREE/target/guest-gl-x64 and rebuilds it when its
sources change, falling back to gl64q2 (with a warning) where it cannot be
built. GL64= still overrides.

The scripts run the checkout they are in (or TREE=) instead of
~/gex-sandbox/wt/unity, and muck-page.sh passes --fjit itself (FJIT=0 for
without): 13.2 presents/s with it against 10.1 without, same tree and guest GL.
Every Muck page figure since mp23 (2026-10-08) was with --fjit.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_ea9f71488b6e448da93d6c2dabf4879c
This commit is contained in:
velzieandClaude Opus 5.5 committed 2026-10-12 01:46:49 -04:00
1 parent 9253a61538
commit 94a5724417
4 files changed
+67 -9

No files matched your search

+11 -3
View File
@@ -2612,13 +2612,21 @@ rm -rf tests/unity-dotnet/smoke/obj
### Hollow Knight and Muck in the page
Edger only, through the bench lock (`scratch/bench/bench.sh`, `BENCH_TIMEOUT` bounds the run inside
the lock). The scripts are in `tools/unity-dotnet/page`. They expect edger's layout: the worktree is
synced to `~/gex-sandbox/wt/unity`, and the staging is in `~/gex-sandbox/scratch/unity/page`.
the lock). The scripts are in `tools/unity-dotnet/page`. They run the checkout they are in (or
`TREE=`), and the staging is in `~/gex-sandbox/scratch/unity/page`.
- **Guest GL:** the x86-64 guest GL comes from the tree's own sources (`guest-gl.sh TREE`, into
`TREE/target/guest-gl-x64`, rebuilt when `guest/gl` or `crates/gex-gl/src/proto.rs` changes; `GL64=`
overrides). Run `guest-gl.sh` on the build host before syncing the tree to a bench box. The old default,
the prebuilt `scratch/unity/gl64-new` (2026-10-07), lacked the frame-query cache and the async present,
and halved page Muck: 13.5 against 23.5 presents/s on the same tree (edger, 2026-10-11).
- **Function JIT:** `muck-page.sh` passes `--fjit` itself (`FJIT=0` for without; 10.1 against 13.2 presents/s
without it).
- **BCL directory** (`page/muck-bcl-NAME`): copy `muck-bcl`, which holds .NET 10's shared framework
assemblies and the native `libSystem.*` libraries. Then put this build's `OUT/lib/System.Private.CoreLib.dll`
and `OUT/provider/mono.wasm` into the copy. CoreLib must match the build, because 0002 patches GCHandle.
- **Muck:** `BCL=... bash tools/unity-dotnet/page/muck-page.sh NAME MINUTES --fjit`. This needs
- **Muck:** `bash tools/unity-dotnet/page/muck-page.sh NAME MINUTES`. This needs
`muck-files.txt`, the host files from a native `--strace` run.
- **Hollow Knight:**
- Stage it once with `hk-stage.py STRACE_RUN page/hk`. This writes `hk/game` (the 115 files HK opens)
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# guest-gl.sh TREE: print the directory of the x86-64 guest GL (libGL.so.1, libEGL.so.1,
# libGLESv2.so.2) that the page runs of TREE should load, building it if need be.
#
# The guest GL is built from TREE's own sources (guest/gl/build.sh with GEX_CC=gcc) into
# TREE/target/guest-gl-x64, and rebuilt whenever guest/gl or crates/gex-gl/src/proto.rs is
# newer than it. A prebuilt guest GL goes stale silently: muck-page.sh defaulted to
# scratch/unity/gl64-new (2026-10-07), which has neither the frame-query cache nor the async
# present at swap interval 0 (85c3bb78, 7605de5c), and page Muck ran at 13.5 presents/s on
# it against 23.5 with a current build on the same tree (edger, 2026-10-11).
#
# Build it on the build host before syncing the tree to a bench box; a box that cannot build
# it (no gcc, or no third_party/opengl-registry checkout) falls back to GL64_FALLBACK
# (default scratch/unity/gl64q2, which is as fast as a master build: 21.5 vs 21.6) and says so
# on stderr.
set -u
TREE=$(realpath "${1:?guest-gl.sh TREE}")
OUT=$TREE/target/guest-gl-x64
FALLBACK=${GL64_FALLBACK:-$HOME/gex-sandbox/scratch/unity/gl64q2}
stale() {
[ -f "$OUT/libGL.so.1" ] || return 0
[ -n "$(find "$TREE/guest/gl" "$TREE/crates/gex-gl/src/proto.rs" -newer "$OUT/libGL.so.1" \
\( -name '*.c' -o -name '*.h' -o -name '*.inc' -o -name '*.sh' -o -name '*.rs' \) \
-not -path '*/out/*' 2>/dev/null | head -1)" ]
}
if stale; then
if command -v gcc >/dev/null && [ -d "$TREE/third_party/opengl-registry/api" ] \
&& (cd "$TREE" && GEX_CC=gcc sh guest/gl/build.sh "$OUT" >&2); then
echo "guest-gl: built $OUT from $TREE" >&2
elif [ -f "$OUT/libGL.so.1" ]; then
echo "guest-gl: WARNING: $OUT is older than its sources and cannot be rebuilt here; using it" >&2
else
echo "guest-gl: WARNING: no guest GL build in $TREE; using the prebuilt $FALLBACK" >&2
OUT=$FALLBACK
fi
fi
echo "$OUT"
+8 -3
View File
@@ -5,14 +5,19 @@
# the .NET wasm JIT. PAGE_ENV adds guest environment (comma-separated).
set -u
n=$1 m=$2; shift 2
cd ~/gex-sandbox/wt/unity
# TREE: the checkout to run (default: the one this script is in). Its guest GL is built from
# its own sources (guest-gl.sh); GL64= overrides it.
HERE=$(cd "$(dirname "$0")" && pwd)
TREE=$(realpath "${TREE:-$HERE/../../..}")
GL64=${GL64:-$(bash "$HERE/guest-gl.sh" "$TREE")}
cd "$TREE"
P=$HOME/gex-sandbox/scratch/unity/page
mkdir -p $P/tmp $P/shots/$n
rm -f web/public/gex/nt/$n.tar
export PATH=$HOME/toolchains/node/bin:$PATH
TMPDIR=$P/tmp GEX_NT_CHROME_PORT=9531 GEX_NT_VITE_PORT=5391 GEX_WEBGPU_SOFTWARE=0 GEX_GL_X64=${GL64:-$HOME/gex-sandbox/scratch/unity/gl64-new} \
TMPDIR=$P/tmp GEX_NT_CHROME_PORT=9531 GEX_NT_VITE_PORT=5391 GEX_WEBGPU_SOFTWARE=0 GEX_GL_X64=$GL64 \
timeout $((m * 60 + 300)) node tests/games/browser-linux.mjs --name $n --dir $P/hk/game --exe hollow_knight.x86_64 --cwd . \
--libs ${BCL:-$P/muck-bcl} --files $P/hk/files.txt --home $HOME/gex-sandbox/wt/unity/tests/games/seeds/hollow-knight \
--libs ${BCL:-$P/muck-bcl} --files $P/hk/files.txt --home $TREE/tests/games/seeds/hollow-knight \
--mem64 --wasmdlls libmonobdwgc-2.0.so=/gex/libs/0/mono.wasm \
--env GEXMONO_ASSEMBLIES=/gex/libs/0,GEXMONO_WASM_JIT=${JIT:-0}${PAGE_ENV:+,$PAGE_ENV} --size 800x600 --minutes $m --shot $P/shots/$n \
--args "-screen-width 800 -screen-height 600 -screen-fullscreen 0 -logFile -" "$@" > $P/$n.log 2>&1
+11 -3
View File
@@ -1,17 +1,25 @@
#!/bin/bash
# muck-page.sh NAME MINUTES [browser-linux.mjs args]: Muck on the .NET provider in Chromium (edger, real GPU).
# Runs with the function JIT (--fjit; FJIT=0 for without): every Muck page figure since
# 2026-10-08 (mp23 on) is with it, and without it the menu runs at 10.1 against 13.2
# presents/s (edger, 2026-10-11, same tree and guest GL).
set -u
n=$1 m=$2; shift 2
cd ~/gex-sandbox/wt/unity
# TREE: the checkout to run (default: the one this script is in). Its guest GL is built from
# its own sources (guest-gl.sh); GL64= overrides it.
HERE=$(cd "$(dirname "$0")" && pwd)
TREE=$(realpath "${TREE:-$HERE/../../..}")
GL64=${GL64:-$(bash "$HERE/guest-gl.sh" "$TREE")}
cd "$TREE"
P=$HOME/gex-sandbox/scratch/unity/page
mkdir -p $P/tmp $P/shots/$n
rm -f web/public/gex/nt/$n.tar
export PATH=$HOME/toolchains/node/bin:$PATH
TMPDIR=$P/tmp GEX_NT_CHROME_PORT=9531 GEX_NT_VITE_PORT=5391 GEX_WEBGPU_SOFTWARE=0 GEX_GL_X64=${GL64:-$HOME/gex-sandbox/scratch/unity/gl64-new} \
TMPDIR=$P/tmp GEX_NT_CHROME_PORT=9531 GEX_NT_VITE_PORT=5391 GEX_WEBGPU_SOFTWARE=0 GEX_GL_X64=$GL64 \
timeout $((m * 60 + 300)) node tests/games/browser-linux.mjs --name $n --dir $HOME/gex-sandbox/games-linux/Muck --exe Muck.x86_64 --cwd . \
--libs $P/muck-bcl --files $P/muck-files.txt --mem64 --wasmdlls libmonobdwgc-2.0.so=/gex/libs/0/mono.wasm \
--env GEXMONO_ASSEMBLIES=/gex/libs/0${PAGE_ENV:+,$PAGE_ENV} --size 800x600 --minutes $m --shot $P/shots/$n \
--args "-screen-width 800 -screen-height 600 -screen-fullscreen 0 -logFile -" "$@" > $P/$n.log 2>&1
--args "-screen-width 800 -screen-height 600 -screen-fullscreen 0 -logFile -" $([ "${FJIT:-1}" = 0 ] || echo --fjit) "$@" > $P/$n.log 2>&1
rc=$?
# Clean up: the bundle (hundreds of MiB) and Chromium's profile.
rm -f web/public/gex/nt/$n.tar; rm -rf $P/tmp/org.chromium.Chromium.*