Skip to content

vulkan: GATED_DELTA_NET silently wrong for raw_gates=1 (ERR ~1.0, 3 cases, 15/15 runs) — supports_op claims a path the shader doesn't implement #237

Description

@bri-prism

Summary

On the Vulkan backend, GATED_DELTA_NET returns essentially garbage for every raw_gates=1 case it claims to support. test-backend-ops reports ERR between 0.90 and 1.00 against the CPU reference (tolerance 1e-7), i.e. the output is uncorrelated with the expected result rather than slightly off. It is silent — no abort, no warning, no fallback.

This is not caused by any open PR: it reproduces on stock prism @ 422590f5d (current HEAD at time of filing).

Environment

Intel(R) Arc(TM) B390 GPU | uma: 1 | fp16: 1 | bf16: 0 | warp size: 32 |
shared memory: 49152 | int dot: 1 | matrix cores: KHR_coopmat

Intel proprietary Windows driver, Windows 11. Build: prism @ 422590f5d, MinGW/ucrt64 g++, Ninja, -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release.

Reproduce

test-backend-ops test -o GATED_DELTA_NET -b Vulkan0

Result

Three cases fail, all head_count=4, head_size=128, raw_gates=1:

GATED_DELTA_NET(type=f32,head_count=4,head_size=128,n_seq_tokens=1, n_seqs=1,v_repeat=1,permuted=0,kda=0,K=1,rows_mode=0,cache_rows=-1,raw_gates=1)
GATED_DELTA_NET(type=f32,head_count=4,head_size=128,n_seq_tokens=1, n_seqs=2,v_repeat=2,permuted=0,kda=0,K=1,rows_mode=0,cache_rows=-1,raw_gates=1)
GATED_DELTA_NET(type=f32,head_count=4,head_size=128,n_seq_tokens=64,n_seqs=1,v_repeat=1,permuted=0,kda=0,K=1,rows_mode=0,cache_rows=-1,raw_gates=1)

ERR over five consecutive runs (the op's test data is unseeded, so the values move; the verdict does not):

case run1 run2 run3 run4 run5
nst=1, ns=1, vr=1 0.897 0.996 0.951 0.954 0.992
nst=1, ns=2, vr=2 0.988 0.986 0.992 0.958 0.984
nst=64, ns=1, vr=1 1.000 1.000 1.000 1.000 1.000

15/15 failures — fully reproducible.

What isolates it to raw_gates

Within the same runs, on the same device and build:

cases OK FAIL
raw_gates=0 45 36 0
raw_gates=1 4 0 3 (+1 reported not supported)

Every raw_gates=0 case passes. No raw_gates=1 case has ever passed. The fourth (K=2, rows_mode=1) is correctly declined by supports_op.

The SYCL backend on the same machine and same commit is the useful control — it declines all four:

GATED_DELTA_NET(...raw_gates=1): not supported [SYCL0]   x4

So SYCL says "I don't implement this" and is correct to; Vulkan says "I implement this" and then computes the wrong answer. The bug is the combination — supports_op advertising raw_gates=1 support that the shader does not actually deliver.

Why it matters

A wrong-but-silent result is worse than an abort here: anything running a gated-delta-net model down the Vulkan path with raw gates gets corrupted state with no diagnostic. Given the tolerance is 1e-7 and the observed error is ~1.0, this is not a precision/accumulation issue — the code path looks functionally wrong rather than imprecise.

Two acceptable fixes, in preference order: make the shader correct for raw_gates=1, or have supports_op decline it (as SYCL does) until it is, which converts silent corruption into a clean CPU fallback.

Related

PR #187 adds a fourth failing case on top of these three (n_seqs=2, v_repeat=1, ERR ~0.92, 4/4 runs) — reported separately at #187 (comment 5765014167). That is a distinct regression; the three above are independent of it and present on stock prism.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions