Run the revision comparison on the host, without Docker - #64
Merged
Conversation
A container on macOS is a Linux virtual machine and the Apple GPU is not
passed into it, so the benchmark image cannot measure one: there is no
counterpart to the NVIDIA Container Toolkit, and the image registers the
NVIDIA ICD in any case. Building the image for linux/arm64 would change the
CPU architecture and nothing else.
prepare-native.sh does on the host what the src and build stages of the
Dockerfile do inside the image - it resolves both revisions, exports each one
with git archive, runs make in it, and leaves the layout run-benchmark.sh
expects - so the same runner serves both paths. It reads the local repository
by default, since the commits are usually already there and an export keeps
the working tree out of the build.
Three things kept the runner from working outside the image: /opt/bench was
hardcoded, macOS ships bash 3.2 where `local -A` and ${slot^^} do not exist,
and the OpenCL check relies on clinfo, which macOS does not have. A Darwin
host without clinfo is now treated as having one platform, leaving the real
check to profanity2's own device enumeration.
Nothing here is macOS-only: the same two commands compare two revisions on
any host with a working OpenCL runtime.
Co-authored-by: Cursor <cursoragent@cursor.com>
The two revisions come out even on an Apple GPU - medians 252.6 against 252.0 MH/s - so the roughly 9% that pull request 57 gains on an RTX 3060 does not carry over to Metal's OpenCL. The runner flags the run as noise, and on the reported spread it is right: a cold first run for A and a high third run for B stretch it to 44% and 58%. The medians are robust to both, and the last three pairs, measured once the machine had settled, sit between 236 and 253 MH/s for either revision. That resolves a regression of about 5% or larger and nothing finer, which is enough for what the run was for. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The benchmark image cannot measure an Apple GPU: a container on macOS is a Linux virtual machine, the GPU is not passed into it, and the image registers the NVIDIA ICD anyway. Rebuilding it for
linux/arm64would change the CPU architecture and nothing else.This adds a native path alongside the Docker one, using the same runner for both:
bench/prepare-native.sh(new) does on the host what thesrcandbuildstages ofbench/Dockerfiledo inside the image: resolves both revisions, exports each withgit archive, runsmake, and lays outa/,b/, the.ref/.shalabels andtimer.state. It reads the local repository by default, so a commit you already have needs no network, and--repo <url>clones for a fork or for pull request refs that were never fetched. The workdir is named after the two commits, so rerunning the same pair skips the compilation.bench/run-benchmark.shbecomes portable. Three things blocked it outside the image:/opt/benchwas hardcoded (nowBENCH_ROOT, same default), macOS ships bash 3.2 wherelocal -Aand${slot^^}do not exist, and the OpenCL check needsclinfo, which macOS does not have (a Darwin host without it now counts as one platform, leaving the real check to profanity2's own device enumeration).bench-logs/M4Max.mac.logrecords the first native run.Nothing here is macOS-only - the same two commands work on any host with an OpenCL runtime, without building an image.
What the run says
The two revisions come out even on an Apple GPU, medians 252.6 against 252.0 MH/s, so the roughly 9% that #57 gains on an RTX 3060 does not carry over to Metal's OpenCL. The runner flags the run as noise and on the reported spread it is right - a cold first run for A and a high third run for B stretch it to 44% and 58% - but the medians are robust to both, and the last three pairs sit between 236 and 253 MH/s for either revision. That resolves a regression of about 5% or larger and nothing finer, which is what the run was for.
Test plan
bench/prepare-native.sh 9011bcd pr57-headbuilds both revisions and prints the workdircache-opencl.255.4276261784vs...23368600),timer.state = samebash -nunder bash 3.2 and runs end to end there, checked against stub binaries with known speedsApple M4 Max, 40 compute units,-w 64accepted with nolocal work size abandonedbench-logs/M4Max.mac.logpr/<n>without fetched refsROOTstill defaults to/opt/bench, but not re-run on an NVIDIA host in this branchMade with Cursor