Skip to content

refactor(vulkan): T-GPU-DEDUP-19 — vif_vulkan migrated to kernel_template + _add_variant#285

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

refactor(vulkan): T-GPU-DEDUP-19 — vif_vulkan migrated to kernel_template + _add_variant#285
lusoris merged 1 commit intomasterfrom
refactor/vif-vulkan-template

Conversation

@lusoris
Copy link
Copy Markdown
Owner

@lusoris lusoris commented May 2, 2026

Summary

Multi-pipeline-via-variant migration on top of PR #272 (which
adds the vmaf_vulkan_kernel_pipeline_add_variant() helper).

State collapses dsl + pipeline_layout + shader + desc_pool + pipelines[4] to VmafVulkanKernelPipeline pl + VkPipeline scale_variants[3].

  • Scale 0 is the template's base pipeline.
  • Scales 1, 2, 3 are sibling pipelines via _add_variant()
    same layout, shader, DSL, pool, different SCALE
    spec-constant.

New vif_scale_pipeline() accessor maps scale index to the
right VkPipeline handle. close_fex destroys the 3 scale
variants first, then calls
vmaf_vulkan_kernel_pipeline_destroy() on the bundle (same
invariant as ssim_vulkan in T-GPU-DEDUP-7 and psnr_hvs_vulkan in
T-GPU-DEDUP-18).

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
  • Netflix-pair smoke: integer_vif_scale0..3 means 0.364, 0.767, 0.863, 0.916; integer_vif mean 0.446 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) AGENTS.md invariant note: see docs/rebase-notes.md entry 0119 — variants destroyed before bundle (same rule as ssim/psnr_hvs)
  • (4) Reproducer / smoke-test command: see Test plan above
  • (5) CHANGELOG fragment: entry under ### Changed
  • (6) Rebase note: entry 0119

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 2, 2026 12:56
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 vif_vulkan to use the shared Vulkan kernel-template pipeline abstraction and _add_variant() helper, reducing duplicated pipeline-management state while preserving the existing per-scale specialization behavior.

Changes:

  • Replaced manually managed Vulkan pipeline/layout/shader/descriptor-pool state in vif_vulkan.c with VmafVulkanKernelPipeline plus three sibling scale variants.
  • Added a vif_scale_pipeline() accessor and updated descriptor set / pipeline binding sites to use the new template-owned resources.
  • Documented the migration and destruction-order invariant in docs/rebase-notes.md and CHANGELOG.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
libvmaf/src/feature/vulkan/vif_vulkan.c Migrates VIF Vulkan pipeline creation, variant handling, binding, and teardown to the shared kernel-template abstraction.
docs/rebase-notes.md Records the rebase/migration details and the destroy-variants-before-bundle invariant.
CHANGELOG.md Adds a changelog entry describing the Vulkan refactor and expected unchanged numerical behavior.

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

@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/vif-vulkan-template branch from b9d69cd to 3207dff Compare May 2, 2026 13:31
@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 20:06
Multi-pipeline-via-variant migration on top of PR #272.

State collapses dsl + pipeline_layout + shader + desc_pool +
pipelines[4] to VmafVulkanKernelPipeline pl + VkPipeline
scale_variants[3]. Scale 0 (luma) is the template's base
pipeline; scales 1, 2, 3 are sibling pipelines via
_add_variant() — same layout, shader, DSL, pool, different
SCALE spec-constant.

New vif_scale_pipeline() accessor maps scale index to the right
VkPipeline handle. close_fex destroys the 3 scale variants
first, then calls vmaf_vulkan_kernel_pipeline_destroy() on the
bundle (same rule as ssim_vulkan in T-GPU-DEDUP-7 and
psnr_hvs_vulkan in T-GPU-DEDUP-18).

Validated against the Netflix-pair smoke (integer_vif_scale0..3
means 0.364, 0.767, 0.863, 0.916, integer_vif mean 0.446 across
48 frames). 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 0119) 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/vif-vulkan-template branch from 3207dff to 34eb584 Compare May 2, 2026 20:06
@lusoris lusoris merged commit e7005e6 into master May 2, 2026
54 checks passed
@lusoris lusoris deleted the refactor/vif-vulkan-template branch May 2, 2026 20:26
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