Last updated: 2026-11-17
Vulkan Runtime
KV Dtype
KV-cache storage type for the Vulkan backend, decided once per process from the environment. Shader element indices are always in units of elements (or vec4s), never bytes, so the same dispatch code drives every layout:
f32 4 B/elem (ZINC_KV_F16=0) f16 2 B/elem (default) q8 32 int8 + one f16 scale per 32-element block, padded to 36 bytes (ZINC_KV_Q8=1). Rows are block-aligned because head_dim and kv_dim are multiples of 32, so a vec4 index i lives in block i/8 at uint i%8, and the block's scale is its uint 8.
8 exports shown
enum
Layout
pub const Layout = enum f32, f16, q8 } No public doc comment yet.
function
layout
pub fn layout() Layout No public doc comment yet.
function
f16Enabled
pub fn f16Enabled() bool No public doc comment yet.
function
isQ8
pub fn isQ8() bool No public doc comment yet.
function
bytesPer32Elems
pub fn bytesPer32Elems() u64 Bytes a 32-element block occupies.
Every KV row is a whole number of blocks.
function
rowBytes
pub fn rowBytes(elems: u64) u64 Bytes for `elems` elements of cache; `elems` must be a multiple of 32.
function
elementBytes
pub fn elementBytes() u64 Bytes per element for the two uncompressed layouts.
Callers that can see a q8 cache must size rows with rowBytes() instead.
function
shaderName
pub fn shaderName(comptime base: []const u8) []const u8 Shader variant for the current layout: `base`, `base ++ "_f16kv"`, or `base ++ "_q8kv"`.
Variants that do not exist for a layout are reported as missing pipelines at load time.