fix(cli): make the gpumask test use a positive mask instead of upstream's -1 - #1368
Draft
lusoris wants to merge 3 commits into
Draft
fix(cli): make the gpumask test use a positive mask instead of upstream's -1#1368lusoris wants to merge 3 commits into
lusoris wants to merge 3 commits into
Conversation
lusoris
pushed a commit
that referenced
this pull request
Sep 6, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cli-gpumask-negative-contract
branch
from
September 7, 2026 06:54
782ac3b to
4e46c80
Compare
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cli-gpumask-negative-contract
branch
from
September 7, 2026 09:14
4e46c80 to
c70595c
Compare
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cli-gpumask-negative-contract
branch
2 times, most recently
from
September 7, 2026 10:18
8124b97 to
823c6fb
Compare
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cli-gpumask-negative-contract
branch
from
September 7, 2026 12:16
823c6fb to
7e0d16c
Compare
…am's -1 `test_vmaf_cuda_gpumask` failed on every host that actually has an NVIDIA GPU. The script — inherited verbatim from upstream — documents `--gpumask -1` as "use cpu" and invokes it twice under `set -e`, but the fork's CLI rejects negative values. It looked green in CI only because the script exits 77 (meson SKIP) when `nvidia-smi -L` finds no device, which is every hosted runner. Not a fork regression. Upstream's `-1` works by accident: POSIX strtoul silently converts "-1" to ULONG_MAX without setting errno, and this fork's `parse_unsigned` deliberately rejects a leading '-' before calling strtoul, with an inline comment saying exactly that. The stale side was the script. `gpumask` is documented in libvmaf.h as "any non-zero value disables the GPU feature-extractor selection ... falls back to the CPU implementation", so a positive mask is the correct spelling. Measured on an RTX 4090 over the Netflix 576x324 pair (4 frames): --gpumask 0 = 88.80022305138327, --gpumask 1 = 88.8002154453433, --no_cuda --no_sycl = 88.8002154453433 — a non-zero mask is byte-identical to an explicit CPU run, exactly the intent of the original -1. Also corrects the `--gpumask` row in docs/usage/cli.md, which described a per-op bitmask the option has never been, and records the divergence in docs/rebase-notes.md so a future sync does not revert it. Verified: the script now exits 0 on the GPU workstation where it failed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cli-gpumask-negative-contract
branch
from
September 7, 2026 13:16
7e0d16c to
0488269
Compare
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
Follows #1363 (now merged). Rebased onto
master; supersedes the auto-closed #1365.test_vmaf_cuda_gpumaskfailed on every host that actually has an NVIDIA GPU. The script — inherited verbatim from upstream — documents--gpumask -1as "use cpu" and invokes it twice underset -e, but the fork's CLI rejects negative values:It looked green in CI only because the script exits 77 (meson SKIP) when
nvidia-smi -Lfinds no device — which is every hosted runner. I hit it while running the full suite for #1363.This is not a fork regression. Upstream's
-1works by accident: POSIXstrtoulsilently converts"-1"toULONG_MAXwithout settingerrno, and this fork'sparse_unsigneddeliberately rejects a leading'-'before callingstrtoul, with an inline comment saying exactly that. The hardening is right; the script is the stale side.A positive mask is the documented spelling —
libvmaf.hsays any non-zero value disables the GPU feature-extractor selection ... falls back to the CPU implementation. Measured on an RTX 4090 over the Netflix 576x324 pair, 4 frames:--gpumask 0--gpumask 1--no_cuda --no_sycl--gpumask 1is byte-identical to an explicit CPU run — exactly what the original-1was reaching for.The
--gpumaskrow indocs/usage/cli.mdsaid "Mask out specific GPU ops", describing a per-op bitmask the option has never been. Corrected here.Type
fix— bug fixdocs— documentationtest— test-onlyChecklist
make format && make lintis green locally (pre-commit run --filesclean, includingshfmtandshellcheckon the changed script).meson test -C build— the target this PR fixes,test_vmaf_cuda_gpumask, now exits 0 on the GPU workstation where it previously failed./cross-backend-diff— no SIMD or GPU code changed; this is a shell script plus docs..c/.h— no new source files.--gpumask -1has already been rejected by this fork for as long asparse_unsignedhas been hardened; this PR documents that rather than changing it.docs/adr/_index_fragments/—concat-adr-index.sh --checkis in sync.Bug-status hygiene (ADR-0165)
docs/state.mdupdated in this PR with a row —T-CLI-GPUMASK-NEGATIVE-REJECTED-2026-09-06moved from Open bugs to Recently closed (it was opened by fix(gpu): clamp the ADM contrast-masking far edge and finish the ssimulacra2 FMA unification #1363, which found it).Netflix golden-data gate (ADR-0024)
assertAlmostEqual(...)score in the Netflix golden Python tests.Deep-dive deliverables (ADR-0108)
git show upstream/masterreads and one three-row measurement, all recorded in ADR-1209's Context section; a separate digest would just restate it.## Alternatives consideredin ADR-1209, including why special-casing--gpumaskto accept negatives and why relaxingparse_unsignedglobally were both rejected.AGENTS.mdinvariant note — added tocore/tools/AGENTS.md.changelog.d/fixed/cli-gpumask-negative-contract.md.docs/rebase-notes.md, "ADR-1209 —--gpumaskand upstream's negative-value accident", so a future sync does not revert the two lines back to-1.Reproducer
Needs a host with an NVIDIA GPU — without one the script skips and reports green, which is the whole point.
meson setup build -Denable_cuda=true ninja -C build meson test -C build test_vmaf_cuda_gpumaskOn
masterthis fails at the second invocation withInvalid argument "-1" for option --gpumask; on this branch it exits 0.Known follow-ups
$bitmask. Left alone deliberately: changing help text is a user-visible string change with its own compatibility surface, and the reference table indocs/usage/cli.mdnow carries the accurate contract.🤖 Generated with Claude Code