Last updated: 2026-11-17

Vulkan Runtime

Bounded Prefill

All API Sections

Retry scratch allocation before prefill mutates KV state.

A failed whole- prompt allocation must not turn an otherwise usable GPU into serial prefill.

2 exports shown

function

limit

#
pub fn limit(tokens: u32, setting: ?[]const u8) u32

Share Qwen's scratch limit knob without accepting a zero-sized chunk or letting a malformed setting replace the original prompt capacity.

src/compute/bounded_prefill.zig:7

function

fit

#
pub fn fit(context: anytype, tokens: u32, comptime allocate: anytype) !u32

The allocator must release partial allocations on failure.

Only device OOM is retryable; execution, host allocation and shape errors keep their cause.

src/compute/bounded_prefill.zig:15