Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Bench scripts take an optional GPU_LOCK prefix instead of a machine path

Nguyen Xuan Anb7c15e3d78d9
diff --git a/bench/native-tracer/compare.sh b/bench/native-tracer/compare.sh
index 5b44c65f..debf71ad 100644
--- a/bench/native-tracer/compare.sh
+++ b/bench/native-tracer/compare.sh
@@ -3,10 +3,11 @@
# gpu-lock job, then scores FLIP between each pair. It needs bench/webgpu-tracer from issue #625 (pull request #629).
# bash bench/native-tracer/compare.sh <output directory>
set -u
+# GPU_LOCK, when set, prefixes each trace, for example a queue that serialises jobs on a shared card.
OUT="${1:?output directory}"
for RUN in 1 2 3; do
- bash ~/.agents/tools/gpu-lock.sh node bench/native-tracer/run.mjs "$OUT" --label "run$RUN" 2>&1 | cut -c1-1500
- bash ~/.agents/tools/gpu-lock.sh node bench/webgpu-tracer/run.mjs "$OUT" webgpu --label "run$RUN" 2>&1 | cut -c1-1500
+ ${GPU_LOCK:-} node bench/native-tracer/run.mjs "$OUT" --label "run$RUN" 2>&1 | cut -c1-1500
+ ${GPU_LOCK:-} node bench/webgpu-tracer/run.mjs "$OUT" webgpu --label "run$RUN" 2>&1 | cut -c1-1500
done
for RUN in 1 2 3; do
echo "flip run$RUN native vs webgpu: $(uv run --no-project --python 3.12 --with flip-evaluator --with pillow --with numpy python -I bench/webgpu-tracer/flip.py "$OUT/webgpu-run$RUN.png" "$OUT/native-run$RUN.png")"
diff --git a/bench/webgpu-tracer/compare.sh b/bench/webgpu-tracer/compare.sh
index 38fbee56..be0bf9dc 100644
--- a/bench/webgpu-tracer/compare.sh
+++ b/bench/webgpu-tracer/compare.sh
@@ -3,10 +3,11 @@
# The first pair runs in fresh Chrome profiles (cold shader caches), the later pairs reuse them (warm).
# bash bench/webgpu-tracer/compare.sh <output directory>
set -u
+# GPU_LOCK, when set, prefixes each trace, for example a queue that serialises jobs on a shared card.
OUT="${1:?output directory}"
rm -rf "$OUT/profile-webgl" "$OUT/profile-webgpu"
for RUN in 1 2 3; do
for VARIANT in webgpu webgl; do
- bash ~/.agents/tools/gpu-lock.sh node bench/webgpu-tracer/run.mjs "$OUT" "$VARIANT" --label "run$RUN" 2>&1 | cut -c1-1500
+ ${GPU_LOCK:-} node bench/webgpu-tracer/run.mjs "$OUT" "$VARIANT" --label "run$RUN" 2>&1 | cut -c1-1500
done
done
diff --git a/bench/webgpu-tracer/run.mjs b/bench/webgpu-tracer/run.mjs
index def8a08a..4d5df8b3 100644
--- a/bench/webgpu-tracer/run.mjs
+++ b/bench/webgpu-tracer/run.mjs
@@ -1,5 +1,5 @@
// One timed trace of the demo room with one backend, in a headless Chrome whose profile persists per backend (so the first
-// run in a fresh profile is the cold compile and later runs are warm). Run it through bash ~/.agents/tools/gpu-lock.sh.
+// run in a fresh profile is the cold compile and later runs are warm). On a shared card, run it through a GPU job queue.
// node bench/webgpu-tracer/run.mjs <output directory> <webgl|webgpu> [--samples 64] [--width 1920] [--height 1080] [--label run1]
// Writes <variant>-<label>.png and <variant>-<label>.json; the profile lives in <output directory>/profile-<variant>.
import { mkdir, readFile, writeFile } from 'node:fs/promises';