Skip to content

Correct Vulkan pipeline selection for oversized buffer bindings - #1183

Merged
0xShug0 merged 2 commits into
mainfrom
perf/vulkan-kernel-optimizations
Nov 3, 2026
Merged

0xShug0 merged 2 commits into
mainfrom
perf/vulkan-kernel-optimizations

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Oversized Vulkan buffer bindings could reach generic dispatch with a normal indexing pipeline, even when the device supported 64-bit indexing. Long inputs could therefore fail or execute without the required addressing mode.

Select the existing 64-bit indexing pipeline only when a bound descriptor exceeds maxStorageBufferRange. Compile that variant on first use and reuse the existing pipeline cache. Bindings within the limit retain their original pipeline, shader, and dispatch. Selection examines only descriptor metadata; it adds no tensor scans, staging buffers, GPU dispatches, or GPU synchronization.

This requires both build headers and a driver supporting VK_EXT_shader_64bit_indexing. Older builds and devices retain their existing restrictions. The build documentation explains this requirement.

The branch also includes Vulkan implementations of the existing compact Mamba scan and causal-convolution operators, runtime wiring, and shared Vulkan/Metal operator-test coverage.

Validation:

  • Debug CLI and GGML operator-test builds passed with current Vulkan headers; C++17 syntax checking with older headers also passed.
  • 51 ordinary CONCAT/PAD cases passed against the CPU reference.
  • Six oversized CPU-reference cases passed: a 4 GiB output, an input above 4 GiB, strided input spans above 4 GiB, zero padding, and circular padding.
  • A previously failing 60-second, 24 kHz enhancement workload completed without resampling, chunking, or backend fallback. Output cosine similarity against the CUDA reference was 0.999999974.
  • Short output remained byte-identical to the pre-change Vulkan output. A short → long → short sequence in one session preserved both short outputs and matched the standalone long output.

Large-buffer stress cases were run manually; they are not added to default CI.

@0xShug0 0xShug0 added the ggml label Nov 3, 2026
@0xShug0
0xShug0 merged commit 7006a2c into main Nov 3, 2026
9 of 10 checks passed
@0xShug0
0xShug0 deleted the perf/vulkan-kernel-optimizations branch November 3, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant