Repository navigation
SYCL on Arc B580: ternary weights and q4_0 KV attention on XMX (Bonsai 2 27B, 128K context in 12 GB) #29643
Replies: 2 comments 4 replies
|
The memory side of "128K in 12 GB with MTP", for anyone trying this on another 12 GB card (estimates; the file sizes are exact):
That's ~9.9 GiB with MTP and everything in q4_0. Real runs sit higher at long context: sudoingX's RTX 4070 12GB sweep measured 9,918 MiB at 131K filled context with a q4_0 cache and no MTP, about 1.1 GiB above that estimate. So with MTP you're around 11 GiB, and the 0.36 GiB from moving the draft KV to q4_0, plus a smaller draft batch, is roughly the difference between fitting and not. That matches what you found. Your long-context number is also close to the bandwidth limit. At 115K of history, one token reads 5.95 GB of weights + ~2.2 GB of q4_0 KV. At the B580's 456 GB/s that caps plain decode at ~56 t/s, so 44 t/s is ~78% of the ceiling, which is about as close as decode usually gets. Per-card context limits for each Bonsai file and KV type are in a page I built: [Link removed by moderator]/ternary-bonsai-2-27b-vram/ |
|
@Torchit1 Is it possible to contribute this feature to llama.cpp SYCL backend? Thank you! |
Uh oh!
There was an error while loading. Please reload this page.
I've been working on the SYCL backend for Intel Arc B580 (Xe2), mostly for PrismML's ternary Bonsai 2 27B, and wanted to share the results and a couple of findings in case they're useful to other SYCL work.
Branch: https://github.com/Torchit1/llama.cpp/tree/arc-b580 (guide: docs/bonsai-arc-b580.md)
What's in it:
intel_sub_group_i8_i4_matrix_mad_k32, which isn't in the public cl_intel_subgroup_matrix_multiply_accumulate list; the raw q4_0 bytes XOR 0x88888888 work as its B operand. It's exact on the B580.Results on a B580 at 128K context: about 90 t/s writing new code, 250-370 t/s on code edits, 42 t/s plain, 44 t/s with 115K tokens of history. Same card, model and flags against the SYCL support in PrismML's fork: prompt reading 207 vs 895 t/s, plain generation 21 vs 42, generation at 32K context 8 vs 36.
All the XMX paths are gated to Xe2 and fall back to the existing kernels elsewhere. One user report from an A770 (Alchemist): it runs on the fallback kernels but needed -b 256 -ub 256 to avoid a Level Zero ERROR_UNKNOWN, which may be worth a look on the mainline side too.
I'd be glad to help upstream any of the general pieces (the q4_0 KV attention in particular) if there's interest.
All reactions