Repository navigation
Conversation
The collector now prints `imported_from_target`: whether the numpy that `numpy_facts.py` imports lives under the target's directory (the collector's working directory), and benchx.conf.json expects it (`expect`, `on_fail: refuse`). The provider refuses to describe a target that fails it too. The value is computed against each side's own target but is the same on every side, so it can sit in the collector's facts of a `revisions` comparison, where a version cannot: benchx matches those facts, with a digest of the whole output, between the sides. It catches a side that would import a numpy that is not its own build: a provider that reports the build root with one exported PYTHONPATH, or (numpy-spin) a numpy of the same version installed elsewhere, which the version check cannot tell from the build. It emulates the benchmark's import and does not observe the benchmark's process. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ev-br
marked this pull request as draft
November 4, 2026 19:51
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.
Prototyped when working on benchx-dev/benchx#96 : tweak the collectors/providers to be more careful about checking numpy facts.
Claude-written explainer:
The problem. In a revisions comparison, each side must import its own numpy build. Two
layouts went wrong without any warning:
PYTHONPATH is exported, so both sides measure the same build.
outside $BUILD, so the version check passes.
numpy-revisions could not simply print the numpy version from its collector, because
benchx matches collector facts between the two sides, including a digest of the whole
output. A version differs by design, so sides-agree would fail.
The change. The collector now prints a boolean, imported_from_target: does the
imported numpy's file lie under the target directory (the collector's working
directory)? A correct setup gives true on both sides, so sides-agree has nothing to
object to. A wrong one gives false, and the run is refused. Per file, in both
examples:
File: numpy_facts.py
Change: Computes the boolean, prints it in the facts and in the summary that is stored
with each result, and writes a stderr line when it is false. In numpy-revisions it
already put the target first on sys.path, as the worker does, and still does. In
numpy-spin it adds no sys.path entry, so it genuinely tests that PYTHONPATH leads
into the build.
────────────────────────────────────────
File: provider.py
Change: Removes the boolean from how_built, since it is an observation and not a build
fact, and refuses a target where it is false. In numpy-spin the message names the
path numpy was actually imported from.
────────────────────────────────────────
File: benchx.conf.json
Change: Adds "expect": {"imported_from_target": true} to the collector. It keeps
verify: how_built and on_fail: refuse.
────────────────────────────────────────
File: READMEs
Change: A note in numpy-revisions on what the check does and doesn't do, plus two
edited table cells. One sentence in numpy-spin.
What I tested. I used real spin builds of numpy v2.4.0 and v2.4.3, from clean
checkouts of the branch:
CHANGE DETECTED. Both sides stored the same digest.
deliberate v2.30 fails as intended.
exported PYTHONPATH, the run is refused before measuring.
provider refuses it.
Limits
benchmark's real sys.path, so a suite directory shadowing the package would go
unseen.
check always passes there. It only matters for providers that report the build root,
as numpy-spin does.
Small things to know
columns, because I joined my sentence onto the original. It is harmless, and I can
re-wrap and amend if you want.
With the UC-02 branch of benchx the unit prints as bench_matmul
[OPENBLAS_NUM_THREADS=1].