Skip to content

refactor(vulkan): T-GPU-DEDUP-18 — psnr_hvs_vulkan migrated to kernel_template + _add_variant#284

Merged
lusoris merged 1 commit intomasterfrom
refactor/psnr-hvs-vulkan-template
May 2, 2026
Merged

refactor(vulkan): T-GPU-DEDUP-18 — psnr_hvs_vulkan migrated to kernel_template + _add_variant#284
lusoris merged 1 commit intomasterfrom
refactor/psnr-hvs-vulkan-template

Conversation

@lusoris
Copy link
Copy Markdown
Owner

@lusoris lusoris commented May 2, 2026

Summary

First multi-pipeline-via-variant consumer of the
vmaf_vulkan_kernel_pipeline_add_variant() helper added by
PR #272.

State collapses dsl + pipeline_layout + shader + desc_pool + pipeline[3] to VmafVulkanKernelPipeline pl + VkPipeline pipeline_chroma_u + VkPipeline pipeline_chroma_v.

  • Plane 0 (luma) is the template's base pipeline.
  • Planes 1+2 (chroma U/V) are sibling pipelines via
    _add_variant() — same layout + shader + DSL + pool, different
    plane spec-constant.

New psnr_hvs_plane_pipeline() accessor maps the plane index to
the right VkPipeline handle. close_fex destroys the chroma
U/V variants first, then calls
vmaf_vulkan_kernel_pipeline_destroy() on the bundle.

Base branch

This PR targets refactor/vulkan-template-add-variant (#272), not
master — it depends on the _add_variant() helper. Will retarget
master once #272 lands.

Test plan

  • ninja -C build-vulkan clean
  • meson test test_vulkan_smoke test_vulkan_async_pending_fence test_vulkan_pic_preallocation — all green
  • Netflix-pair smoke: psnr_hvs mean 31.33 (y 30.58 / cb 37.26 / cr 38.20) across 48 frames
  • pre-commit run --files <touched> clean

Six deep-dive deliverables (ADR-0108)

  • (1) Research digest: no digest needed: routine refactor
  • (2) Decision matrix: no alternatives: only-one-way fix (3-pipeline-per-plane shape is exactly what _add_variant() was designed for; cf. ssim_vulkan in PR refactor(vulkan): T-GPU-DEDUP-7 — migrate motion + ssim to kernel_template #272)
  • (3) AGENTS.md invariant note: see docs/rebase-notes.md entry 0118 — variants destroyed before bundle (same rule as ssim)
  • (4) Reproducer / smoke-test command: see Test plan above
  • (5) CHANGELOG fragment: entry under ### Changed
  • (6) Rebase note: entry 0118

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 2, 2026 12:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR refactors the Vulkan psnr_hvs feature extractor to use the shared kernel pipeline template and _add_variant() helper for its per-plane compute pipelines.

Changes:

  • Replaces the manually managed Vulkan pipeline state (dsl, layout, shader, pool, and pipeline[3]) with a VmafVulkanKernelPipeline bundle plus two chroma pipeline variants.
  • Adds helper logic to build per-plane specialization data and map plane indices to the correct pipeline handle at dispatch time.
  • Updates project documentation (CHANGELOG.md, docs/rebase-notes.md) to describe the migration and its lifecycle invariants.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
libvmaf/src/feature/vulkan/psnr_hvs_vulkan.c Refactors pipeline creation/destruction and descriptor/pipeline access to use the shared Vulkan kernel template.
docs/rebase-notes.md Documents the rebase note and destruction-order invariant for the new variant-based pipeline setup.
CHANGELOG.md Records the Vulkan refactor and validation notes in the changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +192 to +194
if (err)
return err;
return build_pipeline_for_plane(s, /*plane=*/2, &s->pipeline_chroma_v);
@lusoris lusoris force-pushed the refactor/vulkan-template-add-variant branch from 0cad1f3 to af40030 Compare May 2, 2026 13:26
@lusoris lusoris force-pushed the refactor/psnr-hvs-vulkan-template branch from 99556d7 to 7c0aee6 Compare May 2, 2026 14:04
@lusoris lusoris marked this pull request as draft May 2, 2026 14:28
@lusoris lusoris force-pushed the refactor/vulkan-template-add-variant branch from af40030 to 2ed2ec8 Compare May 2, 2026 15:00
Base automatically changed from refactor/vulkan-template-add-variant to master May 2, 2026 15:20
@lusoris lusoris marked this pull request as ready for review May 2, 2026 19:43
@lusoris lusoris force-pushed the refactor/psnr-hvs-vulkan-template branch from 7c0aee6 to 2cfb3dd Compare May 2, 2026 19:43
…template

First multi-pipeline-via-variant consumer landed on top of PR #272
(which adds the vmaf_vulkan_kernel_pipeline_add_variant() helper).

State collapses dsl + pipeline_layout + shader + desc_pool +
pipeline[3] to VmafVulkanKernelPipeline pl + VkPipeline
pipeline_chroma_u + VkPipeline pipeline_chroma_v. Plane 0 (luma)
is the template's base pipeline; planes 1+2 (chroma U/V) are
sibling pipelines via _add_variant() — same layout + shader +
DSL + pool, different plane spec-constant.

New psnr_hvs_plane_pipeline() accessor maps plane index to the
right VkPipeline handle. close_fex destroys the chroma U/V
variants first, then calls vmaf_vulkan_kernel_pipeline_destroy()
on the bundle (same rule as ssim_vulkan in T-GPU-DEDUP-7).

Validated against the Netflix-pair smoke (psnr_hvs mean 31.33,
psnr_hvs_y 30.58, psnr_hvs_cb 37.26, psnr_hvs_cr 38.20 across 48
frames) + meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green). Numerical contract unchanged.

Based on refactor/vulkan-template-add-variant (PR #272); will
rebase clean once #272 lands.

CHANGELOG.md + docs/rebase-notes.md (entry 0118) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lusoris lusoris force-pushed the refactor/psnr-hvs-vulkan-template branch from 2cfb3dd to 9be868e Compare May 2, 2026 19:43
@lusoris lusoris merged commit dfb605e into master May 2, 2026
54 checks passed
@lusoris lusoris deleted the refactor/psnr-hvs-vulkan-template branch May 2, 2026 20:06
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.

2 participants