Versions in this module Expand all Collapse all v0 v0.5.0 Nov 5, 2026 v0.4.0 Nov 4, 2026 Changes in this version type Config + Arch string + Bias bool + RopeNeox bool + TiedOutput bool v0.3.1 Nov 4, 2026 v0.3.0 Nov 4, 2026 Changes in this version + const MaxBatch + var DecodeBatch = 8 + var NoFused bool + var PrefillBatch = 64 + var TPR = 8 type GPU + Skip map[string]bool v0.2.0 Nov 3, 2026 Changes in this version type CPU + F16KV bool v0.1.0 Nov 3, 2026 Changes in this version + const ChunkSize + const PieceSize + const PrefillChunk + func Argmax(l []float32) int32 + func F16ToF32(h uint16) float32 + func F32ToF16(f float32) uint16 + func RoundF16(f float32) float32 + func Shaders(wg int) map[string]string + type CPU struct + Cfg Config + ExactGGML bool + LastX []float32 + MaxLayers int + func LoadCPU(f *gguf.File, r io.ReaderAt, maxCtx int) (*CPU, error) + func (m *CPU) Forward(tok int32) []float32 + func (m *CPU) Pos() int + func (m *CPU) Reset() + type Config struct + Ctx int + Embd int + Eps float32 + FF int + HeadDim int + Heads int + KVHeads int + Layers int + RopeBase float32 + Vocab int + func ConfigFrom(f *gguf.File) (Config, error) + type GPU struct + Cfg Config + Layers int + Stats Stats + func NewGPU(dev *webgpu.Device, lim Limits, f *gguf.File, r io.ReaderAt, ctx int) (*GPU, error) + func (g *GPU) Generate(prompt []int32, n int, eos int32, emit func(int32) bool) (Timing, error) + func (g *GPU) MemoryUsed() uint64 + func (g *GPU) Peek(name string, n int) ([]float32, error) + func (g *GPU) PrefillLogits(prompt []int32) ([]float32, error) + type Limits struct + MaxBindingSize uint64 + MaxBufferSize uint64 + MaxInvocationsPerWorkgroup uint32 + MaxStorageBuffers uint32 + MaxWorkgroupStorage uint32 + MaxWorkgroupsPerDimension uint32 + MemoryBudget uint64 + func DefaultLimits() Limits + func (l Limits) WorkgroupSize() int + type Stats struct + Dispatches int + Submits int + Tokens int + type Timing struct + Decode time.Duration + Dispatches int + Generated int + Prefill time.Duration + PromptTokens int + Record time.Duration + Submit time.Duration + Submits int + type Tokenizer struct + AddBOS bool + BOS int32 + EOS int32 + func NewTokenizer(f *gguf.File) (*Tokenizer, error) + func (t *Tokenizer) Decode(ids []int32) string + func (t *Tokenizer) Encode(text string) []int32 + func (t *Tokenizer) Piece(id int32) []byte + func (t *Tokenizer) VocabSize() int