Skip to content

ptq1_0 Vulkan matvec kernel ~6x slower than tq2_0 at n=1 (195 vs 1080 GFLOPS, RX 6600) #259

Description

@gatrivi

Decode-shaped MUL_MAT (m=4096, n=1, k=14336) measured via test-backend-ops: ptq1_0 = 602 us (195 GFLOPS), tq2_0 = 109 us (1080), q4_0 = 92 us. Root cause in vulkan-shaders/ptq1_0.glsl: trit accessor uses a 3-way branch + serial base-3 recurrence (v=(v*3)&0xFF loop) per weight element, unhidden at n=1. Prefill (n=512) is fine (4.11 TFLOPS), so only matvec path affected. Fix: 256-entry byte→5-trits LUT, same shape as mul_mat_vec_tq2_0.comp. Correctness currently 28/28 OK, so it's purely a perf bug. Real-world impact: Bonsai-2 27B decode 3.3 tok/s, should be ~20.

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