Skip to content

vulkan : fix unclosed brace in turbo type guard (backend never compiled) - #73

Open
skulze wants to merge 1 commit into
AtomicBot-ai:feature/turboquant-kv-cachefrom
skulze:fix/vulkan-turbo-guard-brace
Open

vulkan : fix unclosed brace in turbo type guard (backend never compiled)#73
skulze wants to merge 1 commit into
AtomicBot-ai:feature/turboquant-kv-cachefrom
skulze:fix/vulkan-turbo-guard-brace

Conversation

@skulze

@skulze skulze commented Aug 13, 2026

Copy link
Copy Markdown

Problem

The Vulkan backend on feature/turboquant-kv-cache does not compile. The turbo-type guard added to ggml_backend_vk_device_supports_op (around line 17603 of ggml-vulkan.cpp) opens a block that is never closed:

if (op->type == GGML_TYPE_TURBO2_0 || ... TURBO4_0) {
    if (op->src[0]->ne[0] % 128 != 0 || op->src[0]->type != GGML_TYPE_F32) {
    return false;
}                     // closes the inner if only
switch (op->type) {   // now nested inside the never-closed turbo guard

Every subsequent function definition in the file is parsed as nested, so a -DGGML_VULKAN=ON build fails with a wall of:

error: a function-definition is not allowed here before '{' token

Fix

Close the guard so it validates the turbo constraint (head_dim divisible by 128, f32 source) and falls through to the existing type switch — which already handles GGML_TYPE_TURBO{2,3,4}_0 — as clearly intended.

Verified

Built with -DGGML_VULKAN=ON -DGGML_NATIVE=ON -DCMAKE_BUILD_TYPE=Release (0 errors) and served Qwen3.6-35B-A3B-UD-Q4_K_XL-MTP on an AMD Radeon AI PRO R9700 (RDNA4/gfx1201, RADV, Mesa 25.2.8) with -ctk turbo3 -ctv turbo3 --spec-type draft-mtp -c 262144. Turbo KV, MTP speculation and 256K context all work; measured 139 t/s decode with -ub 2048.

🤖 Generated with Claude Code

The turbo-type guard in ggml_backend_vk_device_supports_op opened a block
that was never closed: the inner head_dim/f32 check closed itself, but the
outer if did not, so the following type switch and every subsequent
function definition were parsed as nested inside it. Result: the Vulkan
backend failed to build at all ("a function-definition is not allowed
here"), which silently forced HIP-only deployments.

Close the guard so it validates the turbo constraint and falls through to
the type switch as intended. Verified: build-vk-tq compiles clean and
serves Qwen3.6-35B-A3B with -ctk/-ctv turbo3, draft-mtp and 256K context
on RDNA4 (RADV).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@worthant

Copy link
Copy Markdown
Member

feature/turboquant-kv-cache is a legacy branch

latest is master and dev

please check if this issue persist there. I suppose not, because i checked that Vulkan should work there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants