Repository navigation
feat(hip): the MLX affine products: dot2 tiles, the gfx11 matrix-core GEMM tile, stream and K-parallel tiles - #7
Merged
Merged
Conversation
…, DeltaNet, norms, RoPE, MoE routing and decode plans The kernels a model engine composes, built by hipcc for -Dhip-arch with the caps table's instruction switches and embedded as one code object a source group, launched from Zig: elementwise ops and casts, norms and the merged decode tails, RoPE, the attention walks (flat, planned over a page table with the query heads of a KV head read together, the 64-row prompt tile flat and paged), the DeltaNet recurrence token-serial and chunked, the linear attention's conv and gates, the MoE router, pick and route, argmax and top-k, and a lane round's plan kernels. A typed Ops layer checks shapes; an arena hands out a forward's scratch, and a counting stream measures it without launching. hip-kernel-test checks each against a host or float64 reference, and the merged and paged forms against the forms they replace, bit for bit where they promise it; -Dhip-device-lib names ROCm's bitcode. The sources hold device code only: plain kernels by C name, templates instantiated for the types the launches use.
…it and dense, with tensor-parallel cuts core/quant reads a checkpoint's MLX affine projections (bits 2, 3, 4, 5, 6 and 8, any group) or dense ones, detects the format from the tensors, cuts a projection by output rows, by a rank's whole input groups or into its two K halves, splits an expert stack across ranks, and hands a backend the upload. Every cut keeps the codes and group tables byte for byte: a test quantizes with affine4_host and checks each cut dequantizes to the same bits as the rows and columns it covers, and it fails when a cut is off by one group.
…st, one family of bits at every row count core/registry selects, for a format, op (product, group, routed plan, routed with activation) and path (decode or prompt), the cheapest entry the GPU, the run's switches and the shape allow, by a per-GPU tuning table read at build time (core/tuning), so every rank picks alike. Its family rule checks that one (op, path) keeps one family of entries at every row count from 1 to 256 for each width and group: a row's bits never depend on how many rows share its launch. The rule's test fails when a tuning table lets another family take some rows.
… GEMM tile, stream and K-parallel tiles The MLX affine 2- to 8-bit products a model's projections run, chosen per product by the kernel registry over a per-GPU tuning table (gfx1030's for RDNA2, gfx1100's for RDNA3 to RDNA4): the decode row, column, stream and split tiles, the RDNA2 wide tile, the prefill dot2 GEMM and K-parallel tiles, the gfx11 matrix-core GEMM tile (compiler WMMA builtins, no rocWMMA), routed plans and products sharing x, with the routed gate and up's activation as an epilogue. The tile sources hold device code only; each kernel the Zig launches resolve is instantiated explicitly. hip-kernel-test checks every entry on the served models' shapes and a ragged sweep of every width and group against float64, the entries the registry picks between by rows for equal bytes, and a row's bytes alone and in a round of 2 to 32 rows.
…A header needed From ThinkOffApp's gfx1151 runs on this PR and ashhart#621: Ubuntu's HIP 7.1 keeps its device bitcode in LLVM's clang resource directory, and the kernels build there with -Dhip-device-lib set to it, without rocWMMA's header.
…e fork's hand ports The kernel was written for TensorFold after FLA's chunk_gated_delta_rule; no code came from vLLM or FLA, and the header only came along from the opengfx1030/vllm-rdna ports.
8 tasks done
# Conflicts: # zig/src/core/quant/quant.zig # zig/src/core/root.zig
…nd without a blank line)
…fill tile calls expf)
…refill kernel goes gatedDelta sent 64 rows or any prefill to gdn_prefill.hip (fp16 products, __expf), so a prompt cut on either side of 64 rows was a different sum. Every length now runs the fp32 recurrence. The new test cuts a 200-row prompt at 1, 63, 64, 65 and 136 rows and checks the rows and state equal one call's bits; it fails with the chunked kernel.
…aNet recurrence at every length)
ashhart
pushed a commit
that referenced
this pull request
Nov 28, 2026
…dy shaders for ashhart#1544 Rewrites the omarchy-derived Vulkan compute shaders from the behavior spec, from cast/copy through the gated-delta state machines to the argreduce pair. omarchy_trig.h becomes vulkan_trig.h (single inv_freq helper, Synthena #6), gated_delta_prefill_ash becomes gated_delta_prefill_oracle, accepting both -DASH_QWEN35 and -DORACLE_QWEN35. PRESERVE_F32 requests OpExecutionMode DenormPreserve (f32) via spirv_execution_mode; sdpa_decode_native pins the single-key bit-exact V transport (Synthena #7) and the 7168-key shared bound. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror of ashhart#621 (same branch), to rehearse the review on the fork.
What this changes
The MLX affine 2- to 8-bit products a model's projections run, the second kernels slice tracked in ashhart#491, chosen per product by the registry (ashhart#613) over a per-GPU tuning table:
The tile sources hold device code only; each kernel the launches resolve is instantiated explicitly.
Stacks on ashhart#617 and ashhart#613 (their commits are included here until they land); review the last commit.
Receipt
mainat c37d0a4 (+ build(hip): -Dhip-arch accepts gfx1030 (RDNA2) and gfx1100 (RDNA3) ashhart/TensorFold#607, feat(hip): a caps table from RDNA2 to RDNA4, keyed by exact gfx name ashhart/TensorFold#609, feat(hip): what a model engine needs from the runtime: graphs, device copies, mapped memory, device queries ashhart/TensorFold#611, feat(hip): the model-free kernels on #463's runtime: attention, DeltaNet, norms, RoPE, MoE routing and decode plans ashhart/TensorFold#617, feat(core): weight formats behind one interface, MLX affine 2- to 8-bit and dense, with tensor-parallel cuts ashhart/TensorFold#612, feat(core): a kernel registry that picks a product's tile by tuned cost, one family of bits at every row count ashhart/TensorFold#613), head 6254228. Zig 0.17.0, HIP 7.14.60850 (TheRock), Linux 7.1.7.hip-kernel-test(57 tests, the 42 of feat(hip): the model-free kernels on #463's runtime: attention, DeltaNet, norms, RoPE, MoE routing and decode plans ashhart/TensorFold#617 included), on both GPUs below:hip-kernel-test57/57,hip-gpu-test30/30,hip-affine-test27/27.hip-kernel-test57/57,hip-gpu-test30/30,hip-affine-test27/27.zig build test test-golden -Dcpu=apple_m1134/134 steps; Linuxzig build test32/32 steps, 331/331 tests.zig fmt --checkclean.lean_check.py: 544 problems, the same asmain.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (No engine path; a row's bytes at any row count are checked here.)