Commit Graph
8 Commits
Author SHA1 Message Date
Niko1221 9e3ad2778f Accelerate Unsloth quants and NVFP4 across Metal, SYCL, and HIP RDNA2-4
Add first-class Unsloth quant (Q2_K, Q3_K, Q4_K, Q5_K, Q6_K, Q8_0, IQ4_XS, IQ3_XXS) and NVFP4 (type 40) support and optimizations across Apple Silicon Metal, Intel Arc SYCL, and AMD RDNA2/3/3.5/4 HIP backends:

- Metal (engine/metal/): Add T_IQ3_XXS, T_Q2_K, T_Q3_K, T_Q8_0, and T_NVFP4 across quant, units (incl. STRATA_METAL_F16), mma, dense_mm, gemv, gemvu, gr (BF16+F32 inject), moe, moeu, and moe_mm (v1/v2/v3/v4/v6 ragged tiles + halved-load W8 for IQ4_XS/IQ4_NL), plus host dispatch (window.cpp, prompt_chain.inc, moe_tiles.h, ref_quant) and parity suites.
- SYCL (engine/sycl/): Add full NVFP4 (40) decode/dequant/combine with exact s_gate/s_up/s_down tail scales in all branches, hoisted Split<TY>/KqSplit<TY> across all Unsloth/NVFP4 types, opt-in SYCL EXP_MODE=8 with had_block==0 guard, SG16 XMX SLM decoders for Q4_K/Q5_K/Q6_K/IQ4_XS/NVFP4, and expanded parity suites.
- HIP (engine/include/strata/kernels/hip_unsloth_*.hpp, engine/src/kernels/hip/): Add clean-room RDNA2/3/3.5/4 Wave32 DP4A + hoisted HipSplit<TY> + fused EXP_MODE=8 (had_block==0 guard, 65535-safe grid striding, exact NVFP4 tail scales) and unified gfx11/gfx12 Wave32 WMMA FP16/BF16/INT8 + fused dequant-to-LDS prefill kernels with standalone 5-arch verification harness.
2026-11-22 19:51:03 +01:00
Niko1221 062b6ec729 sycl: persistent SSD spill (PR #6538), GENI/cvec bounds checks (#6493), and DEVICE_LOST guard (#6445) 2026-11-22 13:12:35 +01:00
Niko1221 f44ed40b8d sycl: Battlemage grouped routed-expert prefill and weight reuse (PR #6567) 2026-11-22 13:06:10 +01:00
Niko1221 e7391915eb sycl: Xe3 Panther Lake unified memory pool, telemetry, and BMG kernel routing (PR #6453, #6454, #6455) 2026-11-22 13:05:21 +01:00
Niko1221 928aa3d161 SYCL: STRATA_VERIFY_NO_HOST=1 alone also turns the device-built plan on (#6250, #4698)
With STRATA_VERIFY_NO_HOST=1 the host never answers a layer's doorbell. A layer with an expert outside VRAM is then planned only by the
device-built plan (STRATA_VERIFY_DEVICE_PLAN=1); without it the GPU waits for a plan nobody makes. strata-sycl.sh sets both, but an engine started
without that wrapper (the packaged component, a source run) with only NO_HOST=1, which docs/INTEL.md says an xe card needs, ended the first window
with "the GPU stopped waiting for the plan for its GPU share (flag A) ... the CPU took 0 ms" (#6250, Arc Pro B70, two quants, 73 waits ran out),
or wrote "!!!" from the first token (#4698). The engine now sets STRATA_VERIFY_DEVICE_PLAN=1 when NO_HOST is on and DEVICE_PLAN is not set at all, and
says so in one line; a DEVICE_PLAN the caller set, 0 included, is kept. A stage with every expert in VRAM has no device plan by itself
(device_plan_ = !all_resident_ && ...), so nothing changes there.

Test verify_env_test (host only, 8 cases). Not reproduced end to end: no xe card here, and the Arc A750 is i915.
2026-11-19 11:07:06 +01:00
Niko1221 e8701bbdd3 SYCL DFlash2: gather the draft head from the planes when the output head is a planar Q6_K (#5286)
With STRATA_Q6_PLANAR (default on) a Q6_K output head is stored as 16-byte-aligned planes. The DFlash2 drafter gathered its draft vocabulary
as GGUF rows out of that buffer, so the draft head was garbage and every draft was rejected (accepted 0 of N, decode 11-12 tok/s against 50-70
with MTP). The MTP drafter already gathers from the planes (native_q6_k_planar_gather); the DFlash2 bind now does the same, through
Dflash2Drafter::gather_draft_head. When the planar copy does not fit, bind fails with a message (the serve layer falls back to MTP) instead of
building a garbage head. The destructor takes a planar draft head out of the planar registry.

Test dflash2_head_test (Arc A750): a random Q6_K head as planes, 1500 gathered rows, logits bitwise equal to the same rows of the whole head;
a Q8_0 head gathered as rows byte for byte. --legacy (the row gather of a planar head) differs in 4500 of 4500 outputs and fails, registered
WILL_FAIL.
2026-11-19 10:39:54 +01:00
Niko1221 1d295787b3 engine: WIN32_LEAN_AND_MEAN before every <windows.h> include that does not define it (a Windows CUDA build blocker: small is #define small char from rpcndr.h)
engine/src/program/generate.cpp has `const int64_t small = old_rule();` (and two more). Without WIN32_LEAN_AND_MEAN, <windows.h> pulls in <rpc.h> / <rpcndr.h>, which
define `small`. In 0.2.15 the first <windows.h> of that translation unit came through gguf_reader.hpp, which defines the lean macro; now conversation_spill.hpp (line 38)
and platform/commit.hpp (line 18) reach it first and define only NOMINMAX. Each include below now gets, next to NOMINMAX, the guarded
`#ifndef WIN32_LEAN_AND_MEAN / #define WIN32_LEAN_AND_MEAN / #endif` (inside the same `#if defined(_WIN32)` block, so a Linux build never sees it): include/strata/core/
conversation_spill.hpp, include/strata/platform/commit.hpp; src/core/{conversation_memory, conversation_memory_test, device_main, pinned.cu, pinned_alias_test,
pinned_shared_win_test, verify}; src/program/generate.cpp; sycl/include/{dpct/device, dpct/kernel, dpct/memory, strata/runtime_files}.hpp, sycl/src/core/{copy_queue, pinned.dp}.cpp,
sycl/src/program/generate.cpp; tests/platform/io_priority_test.cpp (18 includes; the other 25 sites already define it earlier in their file). None of these files uses an API the
lean macro leaves out (winsock, shell, RPC / OLE, multimedia): checked by grep. Not covered: the SYCL Windows build also takes dpct/bindless_images.hpp (d3d11.h, which
reaches rpcndr.h by itself), and sycl/src/program/generate.cpp has the same `small` name; no Windows SYCL package is built in 0.2.16 (the release assets are Linux SYCL).
2026-11-17 17:40:25 +01:00
Niko1221 4058aa782b Layout move for 0.2.16: the top level becomes app/, engine/, terminal/, docs/, tools/ and .github/
Made by tools/layout/move_0216.py (the commit before this one) on db8e0be9c, the final code head of 0.2.16:
- 75 git mv (renames, so `git log --follow` and blame keep working; packaging/acceptance_matrix.md shows as delete + add because its links
  changed too) and 3 removals: SETUP.bat, UPDATE.bat and update.sh (setup.py --update pulls the code now);
- 1,425 path edits in 307 files: root-relative paths in CI, Docker, .gitignore and the release scripts; Markdown links; Python and
  Node joins from a root that moved with its folder; explicit edits for code that computes a root or names a moved path; tables of
  repository paths inside tests.

engine/ holds what CMake builds (src, include, cmake, metal, sycl, spark, third_party, the C++ tests and benches). app/ is the desktop
app and its host (was apps/). terminal/ is the Terminal in the layout of the installed one (strata.py, setup.py, strata_cli,
strata_control, serve, bin, data, ref, crates, the Python tools and tests). docs/ has the documentation, docs/lang/ the translated
READMEs, docs/history and docs/bench-results. tools/ has the repository's own checks, packaging, docker, research and nix.
tests/core/test_tqp_ref.py is a pytest file and stays with the Python tests (terminal/tests/core/).
AGENTS.md, README.md, LICENSE, setup.sh and START-HERE.bat stay at the root.

No behaviour change: the same command lines, the same sources. For this head a replay of the script gave the same numbers and the path
scan (tools/layout/checks/path_scan.py) reports no hit; the suites and the builds run on this commit next.
2026-11-17 13:19:21 +01:00