Commit Graph
14509 Commits
Author SHA1 Message Date
geohot d57aba6eb3 revert bmnist 2026-08-25 16:36:24 -07:00
geohot 257c0faea3 other cycle issue 2026-08-25 16:33:08 -07:00
geohot ab9ca115c2 codex fixes 2026-08-25 16:28:36 -07:00
geohot 6aaa8bbf0b fixes 2026-08-25 13:36:59 -07:00
geohot f0473e53e5 correct fix 2026-08-25 12:06:06 -07:00
geohot 63f8fe9315 fix indexing 2026-08-25 11:49:11 -07:00
geohot e6af939a23 no const end 2026-08-25 11:07:59 -07:00
geohot d459c92534 a bunch of extra rules 2026-08-24 19:42:42 -07:00
geohot bf1b3c49fc update for prepare 2026-08-24 19:27:37 -07:00
George HotzandGitHub 2a68eb2a98 Merge branch 'master' into rewrite_rangeify2 2026-08-24 19:12:49 -07:00
George HotzandGitHub a5678317c2 split rangeify to prepare.py (#17722) 2026-08-24 19:12:13 -07:00
chenyuandGitHub 1d694dd700 remove more explicitly set dtype [PR] (#17721) 2026-08-24 22:03:22 -04:00
chenyuandGitHub 65ca68567e const cleanups [PR] (#17719) 2026-08-24 21:37:14 -04:00
chenyuandGitHub a7df1a1ace const are weak 3 [pr] (#17695) 2026-08-24 20:32:57 -04:00
geohot 22cd2f35cb simple simplify 2026-08-24 17:26:29 -07:00
RaineandGitHub d9004cff22 use native shifts in Payne Hayek instead of pow2 mul/divs (#17717)
* use native shifts instead of pow2 mul/divs

* wow
2026-08-24 17:11:46 -07:00
geohot b908da6e09 next_buffer_num 2026-08-24 16:12:48 -07:00
geohot 63b9ac1fa0 fix sma 2026-08-24 16:06:55 -07:00
geohot 9cb3419bb9 fix 0 handling 2026-08-24 15:51:00 -07:00
wozeparrotandGitHub 6f87158d77 feat: bump version to 0.14.0 (#17716) v0.14.0 2026-08-24 15:40:15 -07:00
sirhcmandGitHub 021c015eb4 benchmarks: more aggressive timeouts (#17715) 2026-08-24 18:32:36 -04:00
George HotzandGitHub cbb81c90ee Merge branch 'master' into rewrite_rangeify2 2026-08-24 15:20:14 -07:00
sirhcmandGitHub 2e7790f16c benchmarks: cleanup dsp benchmark (#17706) 2026-08-24 18:09:01 -04:00
chenyuandGitHub 8df3dac0ec remove redundant UOp dtype [PR] (#17713) 2026-08-24 18:00:02 -04:00
George HotzandGitHub ed110993d3 mi350p: aqua vanjaram bringup for the raw PCI driver (#17693)
* mi350p: aqua vanjaram bringup for the raw PCI driver

Minimum stable bringup, all root-caused:
- disable ASPM on the PCI path: link L1 across retimers makes GPU reads oscillate to 0xffffffff (no-op on non-sysfs backends)
- probe live AIDs via MMHUB FB_LOCATION; dead ones read 0xffffffff and indirect writes to them corrupt the fabric
- aqua reset semantics: full boot over a live state can kill the fabric, partial boot + reset_mec is the deepest safe reset
- tolerate the HQD dequeue timeout like the kernel (wedged waves can survive RESET_WAVES)

* am/aspm: simplify to GPU-endpoint-only clearing via pci config abstractions

* fix AID derivation for non-dense sdma instance keys + bound the aspm capability walk for 0xff reads
2026-08-24 14:32:16 -07:00
chenyuandGitHub f4cc28824c delete GETTUPLE on UNSHARD rule [PR] (#17711)
not used
2026-08-24 17:25:28 -04:00
George HotzandGitHub 76bf6b7eec llm: add DEBUG=2 for weights loading (#17710)
* llm: add DEBUG=2 for weights loading

* 00
2026-08-24 14:09:34 -07:00
geohot 08fbd25f1a AGENTS: no amend commits 2026-08-24 13:34:42 -07:00
George HotzandGitHub 5aabbb1991 fix Muon weight decay being a no-op (#17709)
* fix Muon weight decay being a no-op

LARS._step computed the post-momentum weight decayed param but only
used it for a dtype cast, so the decay was never applied. Fold the
decay into the update instead, matching torch's param.mul_(1 - lr*wd).

test_muon_wd passed anyway since lr*wd=1e-5 is far below atol, so
also bump the test's weight_decay to 10 to actually exercise it.

* muon: apply weight decay after lr scaling

keeps the decoupled decay independent of the LARS trust ratio r,
matching torch's param.mul_(1 - lr*wd). no behavior change today since
r is always 1.0 on the pre_wd=False path (Muon has tcoef=0).
2026-08-24 13:33:10 -07:00
nimlgenandGitHub 7a887e84b2 am: use gc regs for xgmi (#17707) 2026-08-24 22:42:35 +03:00
chenyuandGitHub 7b21ffac00 PYLITERAL has dtypes.void (#17705)
also deleted Ops.WIAT, it currently does not have entry in dtype_from_uop
2026-08-24 14:37:15 -04:00
sirhcmandGitHub 9b481a4893 dsp: cleanup temp linker script (#17704) 2026-08-24 14:05:00 -04:00
qazalandGitHub 9b0c65688d llama script changes from the speedups branch (#17701) 2026-08-24 21:10:02 +09:00
George HotzandGitHub 7e561fcb97 mergable fast RDNA3 Qwen 3.8 (#17512)
* mergable fast RDNA3 Qwen 3.6

* AMD

* quant 256 multiple

* cleanup cast

* llm kernels: adapt to Ops.BIND removal

Variables are 0-d ALU BUFFERs in the tensor graph and take the ALU PARAM form
inside kernels (UOp.variable(param=True)). Add kernel_var helper for the
conversion, and keep start_pos in bound form at the graph level so function
implicit-input collection and the schedule's binds rename-back line up.

* adaptive prefill chunk sizes for recurrent models + iq4xs model entry

one TinyJit per static prefill chunk size: capture 128 and 32 at warmup,
generate picks the largest that fits the remaining prompt. long prompts
prefill 2x faster (555 tok/s on Qwen3.6-27B IQ4_XS) without pushing short
prompts through token-by-token decode.

* minimize diff: early-return custom attention path, keep master state init

* minimize: master _attention with gated fused-scan swap, kernels/amd only, single chunk size

- GatedDeltaNetBlock._attention keeps master's symbolic-padding structure;
  the recurrent scan is swapped for the fused gated_delta_prefill kernel only
  on RDNA3 with static shapes (fast_scan), everything else uses the old path
- all AMD kernel code lives in tinygrad/llm/kernels/amd.py (drop kernels/__init__.py,
  drop the generic fallback kernel - the old scan covers non-RDNA3)
- single prefill chunk size 32; non-RDNA3 recurrent keeps master's chunk_size=1
- the conv+normalize miscompile doesn't trigger with master's window-buffer conv,
  so the contiguous workaround is dropped

* warmup: single code path for fast and old recurrent

* drop fast_scan/fast_recurrent flags, inline the RDNA3 gate (cached)

* generate: chunk size is always 32, no device gating

static chunks for recurrent models everywhere: the fused kernel path on RDNA3,
the old scan elsewhere (which is also faster chunked than token-by-token)

* warmup: drop redundant _init_state loop (lazy init in the eager step covers it)

* symbolic-length prefill with the custom kernels

the prefill path is fully symbolic again (master's generate, one prefill graph
for every chunk size, no static-tail decode): padded steps are exact no-ops in
the scan (beta=0, alpha=exp(0)=1), flash attention positions queries at
start_pos instead of valid_kv_len-M, and quant linears pad to the chunk bucket

prefill 401 tok: 284 -> 348 tok/s on Qwen3.8-27B IQ4_XS (tail chunks no longer
decode token-by-token), decode unchanged at 45 tok/s

* cli: default qwen3.6:27b to the fast IQ4_XS quant, add qwen3.8:27b

Q4_K_M falls back to slow inline dequant with the custom kernels, IQ4_XS is
the fast path. qwen3.8 quants use unsloth's UD (dynamic) naming

* warmup: back to master's two-liner plus a cache reset

with symbolic prefill, generate([0])'s 1-token chunk captures the symbolic
prefill graph that serves every chunk size, and JIT batching on capture
measurably doesn't matter with the fused kernels (347.7 tok/s either way)

* cli: pin qwen3.8:27b to the pre-UD revision

the UD-IQ4_XS replacement mixes in Q3_K tensors (ggml type 11) the loader
doesn't support; the pinned revision is byte-identical to the known-good file

* warmup: identical to master

the leftover cache is self-consistent: get_start_pos only reuses a full
strict-prefix match, everything else restarts with a state reset

* model: hoist the quantized_attention import to the top level

* hoist the GDN query scale out of the branch, restore master dtype.py

the scale is the same op in both paths, apply it once after the transpose.
the dtype.py diff was a stale pre-SPEC=2 copy, not intentional work

* gated_delta_prefill: don't pass the bound start_pos as a call src

device-less param buffers in call srcs crash hcq2's _get_enqueue_devs. the
var already reaches the graph through the state AFTER chain (conv state
store), same as the flash kernels' valid_end

* llm: half KV cache with custom flash kernels, drop the int8 quantized cache

matches master's new half cache default: no scales, no packing, one less
buffer. the store casts to half explicitly (buffer-only half usage misses
the renderer's half define). 45.5 tok/s decode, 348.7 tok/s prefill —
same as int8

* llm: zero-init the KV cache

the int8 path was accidentally protected from uninitialized memory by its
zero-initialized scale buffer; with a plain half cache the flash prefill
kernel's P*V wmma computes 0*NaN=NaN on masked lanes past the valid region
(manifested as garbage tokens at 32k context where the allocator reuses
dirty VRAM)

* gate that

* llm/kernels/amd: reorganize by kernel family, drop the clutter

sections: shared helpers, quant linear, flash attention, gated delta prefill.
no AxisType.WEAK (default), no ALLOW_DEVICE_USAGE override (unneeded), magic
numbers become names (QUANT_SIZES, Q5_K/Q6_K/IQ4_XS), merged wrapper layers
(flash_attention_causal_cached folded into flash_attention), one _unbind
helper for the bound-var dance

* test: universal recurrent reuse assertion, fix lambda lint

* 1-token chunks have a static shape: they are decode steps

a 1-token chunk routes to the decode graph via the existing dispatch, so
warmup and decode-only workloads never build the big symbolic prefill graph:
CI benchmark command 12m50s -> 5m29s (master: 6m48s), 220 -> 123 compile jobs

also restores the ALLOW_DEVICE_USAGE override in amd_custom_kernels_supported:
Device[] asserts inside @function contexts (ALLOW_DEVICE_USAGE=0), and the
first gate call can happen there depending on test order

* generate: back to plain symbolic binding, the static-1 rule wasn't worth it

* custom kernels: Q4_K support (ggml type 12)

Q4_K is Q5_K without the high-bit array: same d/dmin/scales layout (so
_q5_scales works unchanged), 144-byte blocks, qs at word 4. both the dp4a
decode kernel and the WMMA prefill kernel take a ggml_type branch now.

Qwen3-8B Q4_K_M: decode 16.5 -> 114.8 tok/s, prefill 69 -> 536 tok/s

* raise line count to 26500 (qwen did it)

* benchmark qwen3.8

* little updates
2026-08-23 22:46:35 -07:00
YassineYousfiandGitHub a5ea95d8b8 usb: don't fail async transfers on signal interruption (#17692) 2026-08-23 21:30:00 -07:00
geohot df528499ce Revert "disk cache: thread-local db conn (#17694)"
This reverts commit 11edcc144c.
2026-08-23 21:13:29 -07:00
qazalandGitHub 4ee114b42a llama rope freqs in fp32 (#17698) 2026-08-24 12:49:55 +09:00
geohot 9d0cd0ebcb hotfix: switch benchmark to qwen3.8 2026-08-23 20:34:30 -07:00
YassineYousfiandGitHub 11edcc144c disk cache: thread-local db conn (#17694) 2026-08-23 19:18:47 -07:00
chenyuandGitHub a31aca9e52 don't hardcode dtype.int const in decode_hevc_frame (#17696) 2026-08-23 22:00:41 -04:00
chenyuandGitHub 8b164aefea test update from weak const (#17689) 2026-08-23 17:30:16 -04:00
George HotzandGitHub 477b573807 update llm kv cache to be half (#17690)
* update llm kv cache to be half / chunk_size to always be 32

* just dtype
2026-08-23 14:02:54 -07:00
geohot bb0e99acbf hotfix: skip that nan test on mac 2026-08-23 08:40:46 -07:00
nimlgenandGitHub 93865e2c66 hcq2: sunday housekeeping (#17686)
* hcq2: sunday housekeeping

* x
2026-08-23 17:20:40 +03:00
George HotzandGitHub 5b60a09ab0 some fixes for the AMD emulator (#17684)
* some fixes for the AMD emulator

* simpler

* revert

* min
2026-08-22 22:48:07 -07:00
chenyuandGitHub b0a1285330 lil decomp cleanup [PR] (#17682) 2026-08-22 18:11:14 -04:00
nimlgenandGitHub a2e64e16aa hcq2: early usb (#17683)
* hcq2: usb interface and submit

* x

* x

* x

* x

* r

* x
2026-08-23 00:22:39 +03:00
chenyuandGitHub a9069c177a make decomp pass SPEC=2 [PR] (#17681) 2026-08-22 08:01:15 -04:00
chenyuandGitHub 8950942e75 remove explicit dtype for NOOP and decomp [PR] (#17678) 2026-08-21 22:27:36 -04:00
chenyuandGitHub 356f665377 test update for weak const (#17675) 2026-08-21 21:50:29 -04:00