Skip to content

fix(metal): complete dispatch table 7->17 + coverage-audit test + doc/parity claims (RC audit) - #986

Merged
lusoris merged 1 commit into
masterfrom
fix/metal-dispatch-completeness
Jun 20, 2026
Merged

lusoris merged 1 commit into
masterfrom
fix/metal-dispatch-completeness

Conversation

@lusoris

@lusoris lusoris commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

RC audit fix (Metal completeness). The Metal dispatch table recognised only
7 of 17 registered Metal extractors, the coverage-audit test was stale + would
assert-fail once the table was completed, and several docs/changelog claims
contradicted the shipped code.

  • core/src/metal/dispatch_strategy.c: g_metal_features[] extended 7 → 17
    extractors (added the 10 missing registry names + every provided_features
    key, copied 1:1 from each .mm; restored float_ms_ssim_metal). 111 entries,
    no dups/extras.
  • core/test/test_metal_kernel_coverage_audit.c: basenames + EXPECTED_KERNEL_COUNT
    8 → 17; replaced the now-real phantom names (esp. ssimulacra2_metal, which
    would have assert-failed) with genuinely-nonexistent names; fixed false
    "no Metal kernel yet" comments.
  • Docs: docs/backends/metal/index.md + docs/backends/index.md "8 kernels" →
    17 wired/registered/parity-tested, removed the "future ports" paragraph;
    rewrote core/src/feature/metal/AGENTS.md invariants (the 9 wired files are
    not dead).
  • Parity claim corrected: SpEED (speed_chroma/temporal) has no Metal twin —
    scoped the false "9/9 every twin" claim (changelog.d/.../metal-standalone-metrics.md,
    docs/state.md) to "standalone sweep complete; SpEED remains a known Metal gap".
  • Deleted the false float_psnr_metal enable_chroma changelog claim (the code
    registers {{0}}, no chroma) + the rendered CHANGELOG lines.

⚠️ Needs macOS CI: the .mm/.metal + the enable_metal-gated
dispatch_strategy.c/coverage-audit test cannot compile on Linux. Verified here
by gcc -fsyntax-only on the extracted table, clang-format --Werror, and a
cross-consistency check (17 names, 111 keys, 5 phantoms absent). CPU-only build
green (1219/1219).

Reproducer / smoke test

meson setup core/build-cpu core -Denable_cuda=false -Denable_sycl=false && ninja -C core/build-cpu  # 1219/1219
# macOS lane: meson setup -Denable_metal=true … && meson test test_metal_kernel_coverage_audit test_metal_smoke

Deep-dive deliverables (ADR-0108)

  • Research digest — no digest needed: a dispatch-table completion + test/doc reconciliation against the already-shipped kernels.
  • Decision matrix — no alternatives: the table must list every registered Metal extractor.
  • AGENTS.md invariant note — core/src/feature/metal/AGENTS.md (kernel table extended to 17; dropped the dead-files claim).
  • Reproducer / smoke-test command — above.
  • CHANGELOG fragment — changelog.d/fixed/metal-dispatch-table-completeness.md.
  • Rebase note — no rebase impact: dispatch-data + test + docs, no upstream-mirror or patch-consumed surface.

Docs: docs/backends/metal/index.md + docs/backends/index.md updated (user-discoverable backend surface).

The Metal dispatch support table (g_metal_features[] in
core/src/metal/dispatch_strategy.c) recognised only 7 of the 17
registered Metal extractors, so vmaf_metal_dispatch_supports() returned
0 for the other 10 — they silently fell back to CPU even on Apple
Silicon. Enumerate all 17 registered extractors and add every missing
registry name + provided_features key, verified 1:1 against each .mm's
provided_features[] source-of-truth (integer_ssim, float_vif,
integer_vif, float_adm, integer_adm, integer_ciede, integer_psnr_hvs,
integer_cambi, ssimulacra2, plus the float_ms_ssim_metal registry name
and motion3_v2_score / float_ssim_l/c/s keys).

Update the stale, self-contradictory coverage-audit test
(core/test/test_metal_kernel_coverage_audit.c): basenames 8 -> 17,
EXPECTED_KERNEL_COUNT 8 -> 17, and replace the now-shipped phantom names
(vif_metal / adm_metal / ciede2000_metal / ssimulacra2_metal — the last
would assert-fail) with genuinely non-existent names so the
wildcard-regression guard stays honest.

Docs + parity-claim corrections:
- docs/backends/metal/index.md + docs/backends/index.md: 8 -> 17
  wired/registered/parity-tested; drop the 'future ports' paragraph
  that called live VIF/ADM/CIEDE/CAMBI/SSIMULACRA2 kernels future.
- core/src/feature/metal/AGENTS.md: rewrite the 'Rebase-sensitive
  invariants' section so it no longer tells agents the 9 wired files
  are dead/deleted; extend the kernel table to all 17.
- Scope the 'every twin' parity claim (changelog + docs/state.md): the
  SpEED family (speed_chroma / speed_temporal) has CUDA/SYCL/HIP twins
  but no Metal twin — a known gap.
- Remove the float_psnr_metal enable_chroma changelog fragment + the
  rendered CHANGELOG.md lines: float_psnr_metal registers options[] =
  {{0}} (Y-only, no chroma), so the option does not exist.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lusoris
lusoris marked this pull request as ready for review June 20, 2026 07:28
@lusoris
lusoris merged commit c539f6b into master Jun 20, 2026
45 of 46 checks passed
@lusoris
lusoris deleted the fix/metal-dispatch-completeness branch June 20, 2026 07:28
@lusoris lusoris added this to the 1.0.0 — First release milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant