Last updated: 2026-11-17

Inference Runtime

GPU Prefill Policy

All API Sections

Correctness defaults for backend inference acceleration.

Extra activation quantization is separate from a GGUF's weight format. Keep paths that change qualified continuations behind an explicit override.

8 exports 2 methods src/gpu/prefill_policy.zig

8 exports shown

function

vulkanDenseQ8PrefillCompatible

#
pub fn vulkanDenseQ8PrefillCompatible(config: ModelConfig, push_descriptors: bool, q8_gemm: bool) bool

No public doc comment yet.

src/gpu/prefill_policy.zig:21

function

vulkanQ8RowDecodeDefault

#
pub fn vulkanQ8RowDecodeDefault(config: ModelConfig, matrix_count: usize, all_q8: bool) bool

Three-round mixed-quantization controls found a 4.6% Gemma MoE regression despite bit-identical outputs.

Keep the row-decode default on the all-Q8 dense graph that improved by 30%; explicit experiments may use other graphs.

src/gpu/prefill_policy.zig:28

struct

Q8RowDecodeDemand

#
pub const Q8RowDecodeDemand = struct

Memory Layout

Size: 16 bytes (alignment: 8)

Offset Size Align Field Type
0 8 8 matrix_count usize
8 1 1 all_q8 bool

Classify the actual loaded matrices, including a tied embedding/LM head.

One-dimensional norm scales do not change the matrix quantization policy.

src/gpu/prefill_policy.zig:34

Methods

2

method

Q8RowDecodeDemand.includeTensor

#
pub fn includeTensor(self: *Q8RowDecodeDemand, tensor: TensorInfo) void

No public doc comment yet.

src/gpu/prefill_policy.zig:38

method

Q8RowDecodeDemand.qualified

#
pub fn qualified(self: Q8RowDecodeDemand, config: ModelConfig) bool

No public doc comment yet.

src/gpu/prefill_policy.zig:44

function

vulkanDenseQ8PrefillDefault

#
pub fn vulkanDenseQ8PrefillDefault(config: ModelConfig, intel: bool, push_descriptors: bool, q8_gemm: bool, types: []const GGMLType) bool

Limit the qualified Intel default to a complete Q8 graph: LM head plus seven attention/FFN projections.

Mixed quantizations retain their existing defaults; a missing projection cannot silently establish eligibility.

src/gpu/prefill_policy.zig:104

function

intelBatchedPrefillChunkDefault

#
pub fn intelBatchedPrefillChunkDefault(gemma_moe: bool, dense_q8: bool, gemma_limit: u32) u32

Intel Q8 GEMM has no serial-shader column limit.

A bounded 384-token batch avoids repeated graph submissions; the matched starter diagnostic improved medium/long prefill by 53%/87% over the 96-token control. Gemma's independent tuning override must not silently change this Q8 bound.

src/gpu/prefill_policy.zig:115

function

intelGemmaGegluPrefillEnabled

#
pub fn intelGemmaGegluPrefillEnabled(config: ModelConfig, intel_xe2: bool, push_descriptors: bool, setting: ?[]const u8) bool

Retile only the measured dense Gemma 4 31B graph on Intel Xe2.

The new kernels retain the existing F16 weight staging and F32 accumulation; this gate does not enable activation quantization, MoE shortcuts or a different backend.

src/gpu/prefill_policy.zig:123

function

vulkanMtpRequested

#
pub fn vulkanMtpRequested(eligible: bool, intel: bool, override: ?[]const u8) bool

Carrying a NextN block establishes model compatibility, not verifier correctness.

Intel Qwen 3.8 MTP changes qualified greedy choices, while ordinary decode matches the native reference. R9700 controls match with MTP both on and off; preserve that default and keep Intel speculation explicit.

src/gpu/prefill_policy.zig:232

function

vulkanActivationQuantDefault

#
pub fn vulkanActivationQuantDefault(config: ModelConfig) bool

Dense Gemma's Q8 activation prefill changes the copper continuation after a long prefix.

F32-activation batched prefill retains the reference choice.

src/gpu/prefill_policy.zig:259