Skip to content

refactor(vulkan): T-GPU-DEDUP-7 — migrate motion + ssim to kernel_template#272

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

refactor(vulkan): T-GPU-DEDUP-7 — migrate motion + ssim to kernel_template#272
lusoris merged 1 commit intomasterfrom
refactor/vulkan-template-add-variant

Conversation

@lusoris
Copy link
Copy Markdown
Owner

@lusoris lusoris commented May 2, 2026

Summary

  • Vulkan kernel template — multi-pipeline support. Extended
    libvmaf/src/vulkan/kernel_template.h with
    vmaf_vulkan_kernel_pipeline_add_variant() so kernels that need
    multiple VkPipelines sharing a layout / shader / DSL /
    descriptor pool (different spec-constant) can express that
    without re-implementing the boilerplate.
  • Migrated motion_vulkan.c. State collapses
    VkPipeline pipelines[2] (kept "for SYCL parity" but
    functionally identical because COMPUTE_SAD goes through push
    constants, not spec-constants) to a single
    VmafVulkanKernelPipeline pl. create_pipelines / close_fex
    shrink to template-driven create + destroy.
  • Migrated ssim_vulkan.c. State becomes
    VmafVulkanKernelPipeline pl + VkPipeline pipeline_vert. Pass 0
    (horizontal) is the template's base pipeline; pass 1 (vertical)
    is created via _add_variant().

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: vmaf --backend vulkan --feature float_ssim on src01_hrc00/01_576x324.yuv → mean 0.863, 48 frames (matches pre-migration)
  • pre-commit run --files <touched> clean
  • clang-tidy -p build-vulkan — net −1 warnings vs master (one fewer than baseline; no new issues introduced)

Six deep-dive deliverables (ADR-0108)

  • (1) Research digest: no digest needed: routine refactor
  • (2) Decision matrix: no alternatives: only-one-way fix (the dormant pipelines[2] collapse and _add_variant() shape were the obvious extensions of the existing template)
  • (3) AGENTS.md invariant note: the rebase-sensitive invariants live in docs/rebase-notes.md entry 0106
  • (4) Reproducer / smoke-test command: see Test plan above
  • (5) CHANGELOG fragment: entry under ### Changed
  • (6) Rebase note: entry 0106

Touched files lint-clean (CLAUDE.md §12 r12)

Touched-file clang-tidy on motion_vulkan.c + ssim_vulkan.c
shows -1 net warnings vs master (one fewer pre-existing, no new).
All remaining diagnostics are pre-existing items already tracked
under T7-5.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 2, 2026 10:47
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

This PR refactors Vulkan feature-extractor pipeline setup by extending the Vulkan kernel template with a “pipeline variant” helper and migrating the Vulkan motion + SSIM extractors to use the shared template-owned pipeline bundle.

Changes:

  • Add vmaf_vulkan_kernel_pipeline_add_variant() to create additional compute pipelines that reuse the base pipeline’s layout + shader (variant differs via spec constants).
  • Migrate motion_vulkan.c to a single template-owned VmafVulkanKernelPipeline (removing the dormant 2-pipeline state).
  • Migrate ssim_vulkan.c to a template-owned base pipeline (pass=0) plus a sibling variant pipeline for pass=1.

Reviewed changes

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

Show a summary per file
File Description
libvmaf/src/vulkan/kernel_template.h Adds the “add variant pipeline” helper to support multi-pipeline kernels sharing the same bundle resources.
libvmaf/src/feature/vulkan/motion_vulkan.c Switches motion to use the kernel template bundle and collapses to one pipeline.
libvmaf/src/feature/vulkan/ssim_vulkan.c Switches SSIM to use the kernel template bundle and creates a second pipeline via the new variant helper.
docs/rebase-notes.md Adds rebase note entry documenting the refactor and invariants.
CHANGELOG.md Adds an Unreleased “Changed” entry describing the migration and new helper.

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

Comment on lines +382 to +383
* spec-constant — `motion_vulkan.c` (compute-SAD on/off for
* first frame vs subsequent), `ssim_vulkan.c` (horizontal vs
Comment on lines +405 to +410
VkComputePipelineCreateInfo cpci = *variant_info;
cpci.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
cpci.stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
cpci.stage.stage = VK_SHADER_STAGE_COMPUTE_BIT;
cpci.stage.module = base->shader;
cpci.layout = base->pipeline_layout;
return 0;
/* Pass 1 (vertical) — same layout/shader/DSL/pool, different
* spec-constant. */
return build_pipeline_for_pass(s, /*pass_id=*/1, &s->pipeline_vert);
Comment on lines 510 to +517
VkDevice dev = s->ctx->device;
vkDeviceWaitIdle(dev);

if (s->desc_pool != VK_NULL_HANDLE)
vkDestroyDescriptorPool(dev, s->desc_pool, NULL);
if (s->pipeline_horiz != VK_NULL_HANDLE)
vkDestroyPipeline(dev, s->pipeline_horiz, NULL);
/* Destroy the sibling variant first; the base pipeline and the
* shared layout/shader/DSL/pool are owned by the template. */
if (s->pipeline_vert != VK_NULL_HANDLE)
vkDestroyPipeline(dev, s->pipeline_vert, NULL);
if (s->shader != VK_NULL_HANDLE)
vkDestroyShaderModule(dev, s->shader, NULL);
if (s->pipeline_layout != VK_NULL_HANDLE)
vkDestroyPipelineLayout(dev, s->pipeline_layout, NULL);
if (s->dsl != VK_NULL_HANDLE)
vkDestroyDescriptorSetLayout(dev, s->dsl, NULL);
vmaf_vulkan_kernel_pipeline_destroy(s->ctx, &s->pl);
Comment thread CHANGELOG.md
Comment on lines +92 to +114
- **Vulkan kernel template — multi-pipeline support + ssim/motion
migration (T-GPU-DEDUP-7).** Extended
[`libvmaf/src/vulkan/kernel_template.h`](libvmaf/src/vulkan/kernel_template.h)
with `vmaf_vulkan_kernel_pipeline_add_variant()` so kernels that
need multiple `VkPipeline`s sharing one layout / shader / DSL /
descriptor pool (different spec-constant) can express that
without re-implementing the boilerplate. Migrated
[`libvmaf/src/feature/vulkan/motion_vulkan.c`](libvmaf/src/feature/vulkan/motion_vulkan.c)
and
[`libvmaf/src/feature/vulkan/ssim_vulkan.c`](libvmaf/src/feature/vulkan/ssim_vulkan.c)
to the template — net duplicated DSL / pipeline layout / shader /
pipeline / descriptor-pool create-and-destroy code removed. As
part of motion's migration, the dormant `pipelines[2]` array
(kept "for SYCL parity" but functionally identical because
COMPUTE_SAD is passed via push constants, not spec-constants) was
collapsed to a single `VkPipeline`. SSIM still owns two pipelines
(horizontal pass=0 / vertical pass=1 differ in spec constant) —
pass=0 is the template's base pipeline; pass=1 is attached via
`_add_variant()`. Validated against the Netflix-pair smoke
(`float_ssim` mean 0.863, 48 frames) + `meson test
test_vulkan_smoke test_vulkan_async_pending_fence
test_vulkan_pic_preallocation` (all green).

@lusoris lusoris force-pushed the refactor/vulkan-template-add-variant branch from 1a7ee8f to 0cad1f3 Compare May 2, 2026 12:38
@lusoris lusoris force-pushed the refactor/vulkan-template-add-variant branch from 0cad1f3 to af40030 Compare May 2, 2026 13:26
lusoris pushed a commit that referenced this pull request May 2, 2026
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 pushed a commit that referenced this pull request May 2, 2026
16-pipeline 2-D [stage][scale] array (4 stages × 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants (every (stage, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle — the (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0121) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
…_template

Twin migration to adm_vulkan (T-GPU-DEDUP-21); same 16-pipeline
2-D [stage][scale] shape (4 stages * 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. The (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0122) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
…_template

Hardest variant case — 7 pipelines across a 2-D [mode][scale]
array (mode 0 compute scales 0-3, mode 1 decimate scales 1-3).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[2][4]
2-D lookup is preserved so the existing [mode][scale] dispatch
path stays clean, but pipelines[0][0] aliases s->pl.pipeline
(template's base) and the other 6 entries are sibling pipelines
via _add_variant().

close_fex destroys the 6 sibling variants (every (mode, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. Same rule
as ssim_vulkan / psnr_hvs_vulkan / vif_vulkan; the (0, 0) skip
is the float_vif-specific invariant (pipeline aliasing).

Validated against the Netflix-pair smoke (vif_scale0..3 means
0.364, 0.767, 0.863, 0.916 across 48 frames; matches
integer_vif bit-identically to 4 decimals). 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 0120) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
…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 marked this pull request as draft May 2, 2026 14:28
@lusoris lusoris marked this pull request as ready for review May 2, 2026 15:00
…plate

Extends libvmaf/src/vulkan/kernel_template.h with
vmaf_vulkan_kernel_pipeline_add_variant() so kernels that need
multiple VkPipelines sharing a layout / shader / DSL / pool
(different spec-constant) can express that without re-implementing
the boilerplate.

motion_vulkan.c: collapses the dormant pipelines[2] array (kept
"for SYCL parity" but functionally identical because COMPUTE_SAD
goes through push constants, not spec-constants) to a single
VmafVulkanKernelPipeline pl. create_pipelines / close_fex shrink
to template-driven create + destroy.

ssim_vulkan.c: state becomes VmafVulkanKernelPipeline pl +
VkPipeline pipeline_vert. Pass 0 (horizontal) is the template's
base pipeline; pass 1 (vertical) is created via _add_variant().
close_fex destroys the variant first, then calls
vmaf_vulkan_kernel_pipeline_destroy().

Validated against the Netflix-pair smoke (float_ssim mean 0.863,
48 frames) + meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green). Numerical contract unchanged — both kernels run
identical shaders + spec-constants + push-constants as before.

CHANGELOG.md + docs/rebase-notes.md (entry 0106) 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/vulkan-template-add-variant branch from af40030 to 2ed2ec8 Compare May 2, 2026 15:00
@lusoris lusoris merged commit 69cc940 into master May 2, 2026
64 of 69 checks passed
@lusoris lusoris deleted the refactor/vulkan-template-add-variant branch May 2, 2026 15:21
lusoris pushed a commit that referenced this pull request May 2, 2026
…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 pushed a commit that referenced this pull request May 2, 2026
…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 added a commit that referenced this pull request May 2, 2026
…template (#284)

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: Lusoris <lusoris@pm.me>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
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 added a commit that referenced this pull request May 2, 2026
…ate (#285)

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: Lusoris <lusoris@pm.me>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
…_template

Hardest variant case — 7 pipelines across a 2-D [mode][scale]
array (mode 0 compute scales 0-3, mode 1 decimate scales 1-3).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[2][4]
2-D lookup is preserved so the existing [mode][scale] dispatch
path stays clean, but pipelines[0][0] aliases s->pl.pipeline
(template's base) and the other 6 entries are sibling pipelines
via _add_variant().

close_fex destroys the 6 sibling variants (every (mode, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. Same rule
as ssim_vulkan / psnr_hvs_vulkan / vif_vulkan; the (0, 0) skip
is the float_vif-specific invariant (pipeline aliasing).

Validated against the Netflix-pair smoke (vif_scale0..3 means
0.364, 0.767, 0.863, 0.916 across 48 frames; matches
integer_vif bit-identically to 4 decimals). 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 0120) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
16-pipeline 2-D [stage][scale] array (4 stages × 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants (every (stage, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle — the (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0121) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
…_template

Twin migration to adm_vulkan (T-GPU-DEDUP-21); same 16-pipeline
2-D [stage][scale] shape (4 stages * 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. The (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0122) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris added a commit that referenced this pull request May 2, 2026
…_template (#286)

Hardest variant case — 7 pipelines across a 2-D [mode][scale]
array (mode 0 compute scales 0-3, mode 1 decimate scales 1-3).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[2][4]
2-D lookup is preserved so the existing [mode][scale] dispatch
path stays clean, but pipelines[0][0] aliases s->pl.pipeline
(template's base) and the other 6 entries are sibling pipelines
via _add_variant().

close_fex destroys the 6 sibling variants (every (mode, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. Same rule
as ssim_vulkan / psnr_hvs_vulkan / vif_vulkan; the (0, 0) skip
is the float_vif-specific invariant (pipeline aliasing).

Validated against the Netflix-pair smoke (vif_scale0..3 means
0.364, 0.767, 0.863, 0.916 across 48 frames; matches
integer_vif bit-identically to 4 decimals). 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 0120) updated per
ADR-0108 deep-dive deliverables.

Co-authored-by: Lusoris <lusoris@pm.me>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
…_template

Twin migration to adm_vulkan (T-GPU-DEDUP-21); same 16-pipeline
2-D [stage][scale] shape (4 stages * 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. The (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0122) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
16-pipeline 2-D [stage][scale] array (4 stages × 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants (every (stage, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle — the (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0121) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
…_template

Twin migration to adm_vulkan (T-GPU-DEDUP-21); same 16-pipeline
2-D [stage][scale] shape (4 stages * 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. The (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0122) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris added a commit that referenced this pull request May 2, 2026
…l_template + _add_variant (#288)

* refactor(vulkan): T-GPU-DEDUP-22 — migrate float_adm_vulkan to kernel_template

Twin migration to adm_vulkan (T-GPU-DEDUP-21); same 16-pipeline
2-D [stage][scale] shape (4 stages * 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle. The (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0122) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(vulkan): kernel_template — raise SSBO binding cap from 8 to 16

float_adm_vulkan (T-GPU-DEDUP-22) binds 9 SSBOs (src + 2× dwt_tmp + 2×
band + 2× csf + accum + dis) and was tripping the template's max-8
guard at init() time, causing every extract() call to fail with
"problem reading pictures" / "problem flushing context".

The new cap of 16 is purely additive: existing consumers (PSNR 3 SSBOs,
moment 4, ciede 3, motion 2, ssim 6, vif 6, etc.) are unaffected.
Vulkan's portability minimum for maxDescriptorSetStorageBuffers is 96
on conformant devices, so 16 is well within the safe range.

Smoke: float_adm Netflix-pair (576×324×48f) now reports adm2 mean
0.934515; smoke tests + lint clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Lusoris <lusoris@pm.me>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris pushed a commit that referenced this pull request May 2, 2026
16-pipeline 2-D [stage][scale] array (4 stages × 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants (every (stage, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle — the (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0121) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lusoris added a commit that referenced this pull request May 2, 2026
…late + _add_variant (#287)

* refactor(vulkan): T-GPU-DEDUP-21 — migrate adm_vulkan to kernel_template

16-pipeline 2-D [stage][scale] array (4 stages × 4 scales).

State collapses dsl + pipeline_layout + shader + desc_pool to
VmafVulkanKernelPipeline pl. The VkPipeline pipelines[4][4] 2-D
lookup is preserved so the per-stage dispatch path stays clean,
but pipelines[0][0] aliases s->pl.pipeline (template's base) and
the other 15 entries are sibling pipelines via _add_variant().

close_fex destroys the 15 sibling variants (every (stage, scale)
except (0, 0)) before calling
vmaf_vulkan_kernel_pipeline_destroy() on the bundle — the (0, 0)
skip is essential because pipelines[0][0] aliases
s->pl.pipeline.

Validated by meson test test_vulkan_smoke
test_vulkan_async_pending_fence test_vulkan_pic_preallocation
(all green) + clean compile. 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 0121) updated per
ADR-0108 deep-dive deliverables.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor(vulkan): T-GPU-DEDUP-21 — remove dead VkDescriptorPool desc_pool field

Stale field left over from pre-template state struct; no longer
referenced after the template owns the pool via s->pl.desc_pool.
Pure dead-code removal.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Lusoris <lusoris@pm.me>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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