From da1ffff9a8db53adec4940966c2ecffb8c4ae41d Mon Sep 17 00:00:00 2001 From: Nunze Date: Mon, 19 Oct 2026 13:17:03 +0200 Subject: [PATCH] docker: the test stage can leave entries out (TEST_EXCLUDE, build.sh -E) Without perf_event_open in the build sandbox, tokenizer_perf_test bounds the encoder's linearity by CPU time. Its 500 KB single word reads a ratio of 10 to 12 against the threshold of 9 on a Zen 2 VM with 512 KiB of L2, every run, with the tokenizer unchanged. A ctest -E regex lets such a host build the image without the threshold moving for everyone. Empty by default. docs/DOCKER.md. Co-Authored-By: Claude Opus 5.5 --- Dockerfile | 7 ++++++- docker/build.sh | 4 ++++ docs/DOCKER.md | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a3e09394..14cd05d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -208,6 +208,10 @@ ARG TEST_JOBS= # slower per thread than the one the budgets were set on: a VM on an EPYC 7302 spends 4.6x the # quoted CPU time on tokenizer_test's reference pass. ARG TEST_CPU_BUDGET_SCALE= +# A ctest -E regex of entries to leave out, for a host where a timing assertion does not hold: +# tokenizer_perf_test's one-word ratio reads 10-12 against its 9 on a Zen 2 VM with 512 KiB of L2, +# where the sandbox leaves it CPU time rather than instructions to count. +ARG TEST_EXCLUDE= # Host-only: a build container has no /dev/kfd. The `gpu`-labelled tests (the *_card entries, # r4d_selftest, kbench) run against a card from this stage: # docker buildx build --target build -t radiance-build . && docker run --rm \ @@ -223,7 +227,8 @@ ARG TEST_CPU_BUDGET_SCALE= RUN echo 1000 > /proc/self/oom_score_adj 2>/dev/null || true; \ bash /src/docker/llvm-check.sh /build \ && RAD_TEST_CPU_BUDGET_SCALE="${TEST_CPU_BUDGET_SCALE}" \ - ctest --test-dir /build -LE 'gpu|oot' -j"${TEST_JOBS:-${JOBS:-$(( ($(nproc) + 1) / 2 ))}}" --output-on-failure \ + ctest --test-dir /build -LE 'gpu|oot' ${TEST_EXCLUDE:+-E "${TEST_EXCLUDE}"} \ + -j"${TEST_JOBS:-${JOBS:-$(( ($(nproc) + 1) / 2 ))}}" --output-on-failure \ && touch /build/host-tests-passed # ----------------------------------------------------------------------------------------- rootfs diff --git a/docker/build.sh b/docker/build.sh index 1befd3ca..db5c59fd 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -14,6 +14,7 @@ # docker/build.sh -J 4 fewer tests at a time (default: the compile jobs) # docker/build.sh -B 5 multiply every test's CPU budget, for a host slower per # thread than the one the budgets were set on +# docker/build.sh -E tokenizer_perf_test leave tests matching a regex out of the test stage # docker/build.sh --target build stop at a stage (tagged radiance-), e.g. for the # GPU test suites # @@ -27,6 +28,7 @@ TARGETS=gfx1201 JOBS= TEST_JOBS= BUDGET_SCALE= +TEST_EXCLUDE= STAGE= while [ $# -gt 0 ]; do case "$1" in @@ -36,6 +38,7 @@ while [ $# -gt 0 ]; do -j) shift; JOBS="$1" ;; -J) shift; TEST_JOBS="$1" ;; -B) shift; BUDGET_SCALE="$1" ;; + -E) shift; TEST_EXCLUDE="$1" ;; --target) shift; STAGE="$1" ;; *) echo "docker/build.sh: unknown option $1" >&2; exit 2 ;; esac @@ -53,6 +56,7 @@ else fi CMD="docker buildx build --load --build-arg GPU_TARGETS='$TARGETS' --build-arg JOBS='$JOBS'" CMD="$CMD --build-arg TEST_JOBS='$TEST_JOBS' --build-arg TEST_CPU_BUDGET_SCALE='$BUDGET_SCALE'" +CMD="$CMD --build-arg TEST_EXCLUDE='$TEST_EXCLUDE'" CMD="$CMD --build-arg VERSION='$VERSION' --build-arg REVISION='$SHA' $TAGS -" echo "radiance $VERSION ($SHA) for $TARGETS${HOST:+ on $HOST}${STAGE:+, stage $STAGE}" diff --git a/docs/DOCKER.md b/docs/DOCKER.md index 152dbfbc..9df15ae7 100644 --- a/docs/DOCKER.md +++ b/docs/DOCKER.md @@ -25,6 +25,7 @@ docker/build.sh -s gpu-host # stream the commit over ssh; gpu-host bu docker/build.sh -j 8 # cap compile jobs (a device kernel takes 2-3 GB under hipcc) docker/build.sh -J 4 # tests at a time (default: the compile jobs) docker/build.sh -B 5 # every test's CPU budget times 5, for a host slower per thread +docker/build.sh -E tokenizer_perf_test # leave tests matching a regex out of the test stage docker/build.sh -t 'gfx1200;gfx1201' # GPU architectures to compile kernels for (default gfx1201) docker/build.sh -r # any other commit docker/build.sh --target build # stop at a stage, tagged radiance-