fix(cuda): pass the plane index to the 16-bpc PSNR kernel - #1374
Draft
lusoris wants to merge 3 commits into
Draft
Conversation
lusoris
pushed a commit
that referenced
this pull request
Sep 6, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cuda-psnr-16bpc-plane
branch
from
September 7, 2026 06:54
d5fd684 to
4214d4e
Compare
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cuda-psnr-16bpc-plane
branch
from
September 7, 2026 09:15
4214d4e to
b2e8ab6
Compare
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cuda-psnr-16bpc-plane
branch
from
September 7, 2026 09:17
b2e8ab6 to
6b3edc0
Compare
6 tasks
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cuda-psnr-16bpc-plane
branch
from
September 7, 2026 10:18
6b3edc0 to
49ff6de
Compare
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cuda-psnr-16bpc-plane
branch
from
September 7, 2026 12:16
49ff6de to
ec8bf09
Compare
lusoris
pushed a commit
that referenced
this pull request
Sep 7, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cuda-psnr-16bpc-plane
branch
from
September 7, 2026 16:08
ec8bf09 to
ebbd82f
Compare
The host has always passed `plane` as the sixth kernel argument for both bit depths, but calculate_psnr_kernel_16bpc had no parameter for it and read data[0] / stride[0], so every high-bit-depth chroma dispatch measured a chroma-sized top-left window of the LUMA plane. On the Netflix 576x324 pair at 10 bpc CUDA reported psnr_cb = psnr_cr = 34.358981 where the CPU reports 39.255496 / 41.375212; luma and all 8-bit results matched. SYCL and HIP are correct. The psnr parity fixture is made bit-depth generic with non-flat, ref/dist-different chroma above 8 bpc and registered again at 10 bpc (ADR-1215). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lusoris
force-pushed
the
fix/cuda-psnr-16bpc-plane
branch
from
September 7, 2026 16:37
ebbd82f to
b6b8f66
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
CUDA chroma PSNR above 8 bpc was a luma number. Found by the twin-drift sweep (ids 7, 80), confirmed by measurement before touching code.
Netflix 576x324 pair, frame 0:
psnr_ypsnr_cbpsnr_crpsnr_cb == psnr_cr, both luma-like: the chroma dispatches were measuring a chroma-sized top-left window of the luma plane.psnr_cuda_dispatchhas always passedplaneas the sixth kernel argument for both bit depths; the 8-bpc kernel declares it and indexesdata[plane], the 16-bpc kernel was declared without it and hard-coded index 0.cuLaunchKernelsilently ignores the surplus argument, so nothing failed loudly. SYCL and HIP are correct (checked at 10 bpc).Every PSNR parity fixture was 8-bit with flat chroma — both sides sit at the
psnr_maxsentinel, so a wrong-plane chroma read could never show. The fixture is now bit-depth generic (8-bit kept byte-identical, widened above 8 bpc with non-flat, ref/dist-different chroma) and registered again at 10 bpc.test_cuda_psnr_parity3/3,test_cuda_psnr_parity_10bit3/3 on an RTX 4090.Type
fix— bug fixtest— test-only (new gate)sycl/cuda/simd— backend-specific (CUDA)Checklist
make format && make lintis green locally (pre-commit run --filesclean;check-state-md-rowsOK; ADR index in sync).meson test -C build— the touched targets on CUDA, listed above./cross-backend-diffand the worst ULP is ≤ 2 — equivalent done directly: CPU vs CUDA identical to six decimals on all planes at 10 and 12 bpc..c/.h— no new source files.docs/adr/_index_fragments/— in sync.Bug-status hygiene (ADR-0165)
docs/state.mdupdated —T-CUDA-PSNR-16BPC-CHROMA-READS-LUMA-2026-09-07closed.Netflix golden-data gate (ADR-0024)
assertAlmostEqual(...)score in the Netflix golden Python tests.Deep-dive deliverables (ADR-0108)
## Alternatives consideredin ADR-1215.AGENTS.mdinvariant note — added tocore/src/cuda/AGENTS.md.changelog.d/fixed/cuda-psnr-16bpc-plane-argument.md.docs/rebase-notes.md, "ADR-1215 — per-plane CUDA kernels must take the plane index".Reproducer
On
masterthe CUDA line printspsnr_cb=psnr_cr≈ 34.36 against the CPU's 39.26 / 41.38; on this branch they match.Known follow-ups
🤖 Generated with Claude Code