Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
b731206
feat(hip): the model-free kernels on #463's runtime: attention, Delta…
BlivionIaG Oct 10, 2026
67d9479
feat(core): weight formats behind one interface, MLX affine 2- to 8-b…
BlivionIaG Oct 10, 2026
48abd99
feat(core): a kernel registry that picks a product's tile by tuned co…
BlivionIaG Oct 10, 2026
6254228
feat(hip): the MLX affine products: dot2 tiles, the gfx11 matrix-core…
BlivionIaG Oct 10, 2026
9b6b260
docs(hip): the device bitcode of Ubuntu's packaged HIP, and no rocWMM…
BlivionIaG Oct 11, 2026
1152c67
Merge branch 'hip-kernels-ops' into hip-kernels-affine
BlivionIaG Oct 11, 2026
df83c6f
Merge branch 'hip-kernels-ops' into hip-kernels-affine
BlivionIaG Oct 11, 2026
5d05894
chore(hip): gdn_prefill.hip drops the vLLM SPDX lines it kept from th…
BlivionIaG Oct 11, 2026
a579284
Merge branch 'hip-kernels-affine' into fam-new
BlivionIaG Oct 11, 2026
e6c11fb
feat(qwen3_5): the GPU backends' checkpoint loader, on the host
BlivionIaG Oct 10, 2026
eb9bd0f
fix(qwen3_5): un-center an MTP head shipped zero-centered
BlivionIaG Oct 11, 2026
4c231bf
feat(qwen3_5): the HIP config refuses what the kernels do not compute…
BlivionIaG Oct 11, 2026
02c1dd6
Merge remote-tracking branch 'upstream/main' into fam-r2
BlivionIaG Oct 12, 2026
57fadd1
feat(hip): the runtime pieces an engine uses beyond #463's model-free…
BlivionIaG Oct 10, 2026
211ea81
feat(hip): the kernels a tensor-parallel rank and the MTP head add
BlivionIaG Oct 10, 2026
42664f9
feat(qwen3_5): the Qwen3.5 / Qwen3.6 engine on HIP, its native server…
BlivionIaG Oct 10, 2026
3d9bd2e
feat(hip): one rank source: --speed-up is refused, the HIP engine's r…
BlivionIaG Oct 10, 2026
a25c8e2
feat(qwen3_5): the HIP prompt cache serves serial requests too
BlivionIaG Oct 10, 2026
3092774
test(qwen3_5): chat with the prompt cache equals chat without it thro…
BlivionIaG Oct 10, 2026
9a4e10f
feat(qwen3_5): a prompt runs 512-row chunks while other streams decode
BlivionIaG Oct 11, 2026
3f396fc
feat(hip): RDNA4 runs on the dot2 tiles; matrix=on is refused where n…
BlivionIaG Oct 11, 2026
fc795cb
test(qwen3_5): serve_rewind.py's docstring on one line, as the lean c…
BlivionIaG Oct 11, 2026
10f67d9
refactor(qwen3_5): the engine reaches the other ranks through hip/col…
BlivionIaG Oct 11, 2026
7f5fd5b
build(hip): the HIP server's CLI module takes EXLR8's import, as main…
BlivionIaG Oct 12, 2026
badbb6f
feat(qwen3_5): structured output on HIP: the lane core's grammar mask…
BlivionIaG Oct 11, 2026
13961db
feat(hip): tensor parallelism over RCCL, behind hip/collective.zig
BlivionIaG Oct 11, 2026
ba0bc3c
feat(hip): the graph cache by shape in the hip module, for every HIP …
BlivionIaG Oct 12, 2026
905d9e9
feat(hip): a step recorded as graphs cut at its collectives, the coll…
BlivionIaG Oct 12, 2026
5480055
feat(hip): the graph cache over any replayable step, a caller's own k…
BlivionIaG Oct 12, 2026
ebe69eb
feat(qwen3_5): HIP rounds record split graphs: the collectives run be…
BlivionIaG Oct 12, 2026
10926cf
feat(qwen3_5): HIP rounds replay split graphs at any world size, RCCL…
BlivionIaG Oct 12, 2026
66d8a19
fix(qwen3_5): every rank sizes its streams for rank 0's window, so a …
BlivionIaG Oct 12, 2026
d47b0f8
perf(qwen3_5): the HIP loader drops each part's mapped pages once it …
BlivionIaG Oct 13, 2026
a9bab75
Merge 1.0.9 (c36b536d) into hip-kernels-affine
BlivionIaG Oct 13, 2026
fa4d769
Merge branch 'qwen35-structured' into fn-base3
BlivionIaG Oct 13, 2026
f76877c
Merge branch 'hip-kernels-affine' (1.0.9) into fn-base3
BlivionIaG Oct 13, 2026
996c098
fix(core): MLX affine dequant reads any code width from 2 to 8 bits, …
BlivionIaG Oct 12, 2026
7aa8722
refactor(hip): the memory budget in admission.zig, where every HIP fa…
BlivionIaG Oct 11, 2026
1356ecb
refactor(hip): the routed MoE and the tensor-parallel reduce in the h…
BlivionIaG Oct 11, 2026
6be6733
refactor(hip): the token draw from logits rows in hip_serve, a module…
BlivionIaG Oct 11, 2026
fd3baad
perf(hip): the MoE route's expert starts and tile ends by a block sca…
BlivionIaG Oct 12, 2026
3fa8861
refactor(core): a MoE layer's stacked experts and router rows in core…
BlivionIaG Oct 11, 2026
07ff3aa
feat(hip): a MoE plan sized by the rows' own pairs, for a family whos…
BlivionIaG Oct 12, 2026
c28aad2
feat(hip): the merged MoE pick over 512 threads, one expert a thread …
BlivionIaG Oct 12, 2026
1ae1078
style(hip): the ops headers end without a blank line, as git diff --c…
BlivionIaG Oct 14, 2026
fbc626d
Merge branch 'hip-kernels-ops' into hip-kernels-affine (ops headers e…
BlivionIaG Oct 14, 2026
47612d0
Merge branch 'hip-kernels-ops' into qwen35-family (ops headers end wi…
BlivionIaG Oct 14, 2026
3850523
Merge branch 'qwen35-family' into qwen35-rccl (ops headers end withou…
BlivionIaG Oct 14, 2026
deec0a9
Merge branch 'qwen35-family' into qwen35-structured (ops headers end …
BlivionIaG Oct 14, 2026
3f4cc24
Merge the ops headers' whitespace fix (#617, through #621, #697 and #…
BlivionIaG Oct 14, 2026
21dbcbe
Merge the ops headers' whitespace fix (through #811)
BlivionIaG Oct 14, 2026
e10cd5e
Merge the ops headers' whitespace fix (through #812)
BlivionIaG Oct 14, 2026
5537d6a
fix(hip): the paged prefill tile calls expf, as the flat tile does
BlivionIaG Oct 14, 2026
bbf83cd
Merge branch 'hip-kernels-ops' into hip-kernels-affine (the paged pre…
BlivionIaG Oct 14, 2026
9178585
Merge branch 'hip-kernels-ops' into qwen35-family (the paged prefill …
BlivionIaG Oct 14, 2026
f5281d5
Merge branch 'qwen35-family' into qwen35-rccl (the paged prefill tile…
BlivionIaG Oct 14, 2026
28c3160
Merge branch 'qwen35-family' into qwen35-structured (the paged prefil…
BlivionIaG Oct 14, 2026
4a91921
Merge the paged prefill tile's expf (#617, through #621, #697 and #655)
BlivionIaG Oct 14, 2026
4c26705
Merge the paged prefill tile's expf (through #811)
BlivionIaG Oct 14, 2026
4e61d5f
Merge the paged prefill tile's expf (through #812)
BlivionIaG Oct 14, 2026
d91b074
fix(hip): one fp32 DeltaNet recurrence at every length; the chunked p…
BlivionIaG Oct 14, 2026
da96b90
Merge branch 'hip-kernels-ops' into hip-kernels-affine (one fp32 Delt…
BlivionIaG Oct 14, 2026
1da7042
Merge branch 'hip-kernels-ops' into qwen35-family (one fp32 DeltaNet …
BlivionIaG Oct 14, 2026
205b800
Merge branch 'qwen35-family' into qwen35-rccl (one fp32 DeltaNet recu…
BlivionIaG Oct 14, 2026
81d6529
Merge branch 'qwen35-family' into qwen35-structured (one fp32 DeltaNe…
BlivionIaG Oct 14, 2026
1bdd859
refactor(hip): the policy's gdn switch goes with the chunked recurren…
BlivionIaG Oct 14, 2026
edc5b3f
refactor(hip): the policy's gdn switch goes with the chunked recurren…
BlivionIaG Oct 14, 2026
02c3ff0
Merge the one fp32 DeltaNet recurrence (#617, through #655)
BlivionIaG Oct 14, 2026
4d5f7a9
Merge the one fp32 DeltaNet recurrence (through #697)
BlivionIaG Oct 14, 2026
060c30e
Merge the one fp32 DeltaNet recurrence (through #621)
BlivionIaG Oct 14, 2026
0ff2cb5
Merge the one fp32 DeltaNet recurrence (through #811)
BlivionIaG Oct 14, 2026
80f45fe
Merge the one fp32 DeltaNet recurrence (through #812)
BlivionIaG Oct 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(qwen3_5): a prompt runs 512-row chunks while other streams decode
A prompt pass ran 1024-row chunks whatever else was running, so a decoding stream waited about 500 ms (gfx1100,
9B 4-bit) for each one. While another stream decodes, chunks are now policy fill_rows rows (512 by default, a
multiple of 64 dividing 1024); alone, 1024. A prompt cut on 64 rows gives the same tokens however it is cut:
with 256- and 1024-row chunks the 9B 4-bit and the 35B-A3B 2-bit reply the same to prompts of 325 to 5025
tokens. The policy carries fill_rows to every rank.
  • Loading branch information
BlivionIaG committed Oct 12, 2026
commit 9a4e10fda3f1430a71b487fab70874c2adefbab4
10 changes: 9 additions & 1 deletion zig/src/families/qwen3_5/backend/hip/engine/hip_lanes.zig
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ pub const Hip = struct {
h.gpa.destroy(l);
}

/// Whether a stream past its prompt holds a lane: a prompt's chunk then holds its round back.
fn decoding(h: *const Hip) bool {
var it = h.lanes.valueIterator();
while (it.next()) |l| if (l.*.fill == null) return true;
return false;
}

/// The backend behind `ptr`, the calling thread bound to its GPU (the lane thread did not open it).
fn of(ptr: *anyopaque) *Hip {
const h: *Hip = @ptrCast(@alignCast(ptr));
Expand Down Expand Up @@ -328,7 +335,8 @@ pub const Hip = struct {
const prompt = s.prompt();
const f = &lane.fill.?;
const limit: usize = if (f.next < f.count) f.stops[f.next] else prompt.len;
const to = prefix.chunkEnd(f.at, limit);
// a prompt cut anywhere on 64 rows gives the same bits; streams decoding between chunks wait less on short ones
const to = prefix.chunkEnd(f.at, limit, if (h.decoding()) h.e.o.policy.fill_rows else prefix.chunk);
if (h.link != null) try h.send(&.{ @backingInt(worker.Op.fill), lane.id, @intCast(to) });
if (to == prompt.len) {
_ = h.take(try h.e.prefill(&lane.caches, prompt, f.at, lane.hidden, .{ .sampling = sampling(s), .position = prompt.len }, null));
Expand Down
17 changes: 13 additions & 4 deletions zig/src/families/qwen3_5/backend/hip/engine/prefix.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! The chunks a prompt pass runs in, and the gap between the snapshots it keeps.

const std = @import("std");
const pages = @import("../forward/pages.zig");

/// A snapshot this close to the prompt's end saves too little to keep next to the one before it.
Expand All @@ -8,10 +9,18 @@ pub const min_gap = 256;
/// Cuts sit on page edges, multiples of the recurrence's chunk, so a resumed span chunks as a fresh prompt does.
pub const step = pages.tokens;

/// Rows a prompt pass advances between two rounds; its steps end on multiples of this, so a prompt is cut the same way.
/// Rows a prompt pass advances between two rounds when no other stream decodes; steps end on multiples of it.
pub const chunk = 1024;

/// Where the step from `at` ends: the next multiple of `chunk`, or `limit` when that comes first.
pub fn chunkEnd(at: usize, limit: usize) usize {
return @min(limit, (at / chunk + 1) * chunk);
/// Where the step from `at` ends: the next multiple of `rows`, or `limit` when that comes first.
pub fn chunkEnd(at: usize, limit: usize, rows: usize) usize {
return @min(limit, (at / rows + 1) * rows);
}

test "a prompt step ends on the next multiple of its rows, or the prompt's cut" {
try std.testing.expectEqual(@as(usize, 1024), chunkEnd(0, 5000, chunk));
try std.testing.expectEqual(@as(usize, 512), chunkEnd(0, 5000, 512));
try std.testing.expectEqual(@as(usize, 1024), chunkEnd(512, 5000, 512));
try std.testing.expectEqual(@as(usize, 1024), chunkEnd(700, 5000, chunk));
try std.testing.expectEqual(@as(usize, 900), chunkEnd(700, 900, 512));
}
18 changes: 14 additions & 4 deletions zig/src/hip/policy.zig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub const Policy = struct {
fuse: Pick = .auto,
gdn: Pick = .auto,
prefill_step: u32 = 1024,
/// Prompt rows a chunk while other streams decode: a multiple of 64 dividing 1024 (the idle chunk).
fill_rows: u32 = 512,
/// Set from the serve flags, not keys: rank 0's travel to the other ranks.
mtp: Mtp = .{},
/// Snapshots the radix prompt cache keeps (`--checkpoint-slots`).
Expand Down Expand Up @@ -104,13 +106,16 @@ pub const Policy = struct {
try next.set(pair[0..eq], pair[eq + 1 ..]);
}
if (next.prefill_step == 0 or next.prefill_step % 64 != 0) return error.StepNotAligned;
if (next.fill_rows == 0 or next.fill_rows % 64 != 0 or 1024 % next.fill_rows != 0) return error.StepNotAligned;
p.* = next;
}

fn set(p: *Policy, key: []const u8, value: []const u8) Error!void {
const eql = std.mem.eql;
if (eql(u8, key, "matrix")) p.matrix = try parseEnum(Choice, value) else if (eql(u8, key, "attention")) p.attention = try parseEnum(Attention, value) else if (eql(u8, key, "kernels")) p.kernels = try parseEnum(Pick, value) else if (eql(u8, key, "graphs")) p.graphs = try parseEnum(Choice, value) else if (eql(u8, key, "stream")) p.stream = try parseEnum(Pick, value) else if (eql(u8, key, "gemm")) p.gemm = try parseEnum(Pick, value) else if (eql(u8, key, "fuse")) p.fuse = try parseEnum(Pick, value) else if (eql(u8, key, "gdn")) p.gdn = try parseEnum(Pick, value) else if (eql(u8, key, "prefill_step")) {
p.prefill_step = std.fmt.parseInt(u32, value, 10) catch return error.BadValue;
} else if (eql(u8, key, "fill_rows")) {
p.fill_rows = std.fmt.parseInt(u32, value, 10) catch return error.BadValue;
} else if (eql(u8, key, "graph_fail")) {
p.graph_fail = std.fmt.parseInt(i32, value, 10) catch return error.BadValue;
} else if (eql(u8, key, "rccl_lib")) try p.rccl_lib.set(value) else return error.UnknownKey;
Expand All @@ -122,7 +127,7 @@ pub const Policy = struct {

/// One line for the start-up log and server info; default and local fields are left out of the keys.
pub fn format(p: Policy, w: *std.Io.Writer) std.Io.Writer.Error!void {
try w.print("matrix={t},attention={t},kernels={t},graphs={t},prefill_step={d}", .{ p.matrix, p.attention, p.kernels, p.graphs, p.prefill_step });
try w.print("matrix={t},attention={t},kernels={t},graphs={t},prefill_step={d},fill_rows={d}", .{ p.matrix, p.attention, p.kernels, p.graphs, p.prefill_step, p.fill_rows });
if (p.stream != .auto) try w.print(",stream={t}", .{p.stream});
if (p.gemm != .auto) try w.print(",gemm={t}", .{p.gemm});
if (p.fuse != .auto) try w.print(",fuse={t}", .{p.fuse});
Expand All @@ -132,7 +137,7 @@ pub const Policy = struct {
try w.print("; mtp drafts {d} under {d}, {d} snapshots", .{ p.mtp.drafts, p.mtp.confidence, p.slots });
}

pub const word_count = 6;
pub const word_count = 7;

/// The policy as a fixed set of words, for rank 0 to send and every rank to use the same.
pub fn words(p: Policy) [word_count]u32 {
Expand All @@ -143,7 +148,7 @@ pub const Policy = struct {
};
var nibbles: [2]u32 = .{ 0, 0 };
for (pack, 0..) |v, i| nibbles[i / 8] |= v << @intCast(4 * (i % 8));
return .{ nibbles[0], nibbles[1] | @as(u32, p.mtp.drafts) << 24, p.prefill_step, @truncate(conf), @intCast(conf >> 32), p.slots };
return .{ nibbles[0], nibbles[1] | @as(u32, p.mtp.drafts) << 24, p.prefill_step, @truncate(conf), @intCast(conf >> 32), p.slots, p.fill_rows };
}

/// `local` with every field rank 0 sent; a rank keeps its own graph fault and library path.
Expand All @@ -162,6 +167,7 @@ pub const Policy = struct {
p.mtp = .{ .drafts = @truncate(w[1] >> 24), .confidence = @bitCast(@as(u64, w[3]) | @as(u64, w[4]) << 32) };
p.prefill_step = w[2];
p.slots = w[5];
p.fill_rows = w[6];
return p;
}

Expand Down Expand Up @@ -218,11 +224,15 @@ test "apply sets fields and refuses what it does not know" {
try std.testing.expectError(error.UnknownKey, p.apply("mtp_drafts=2"));
try std.testing.expectError(error.BadValue, p.apply("matrix=maybe"));
try std.testing.expectError(error.StepNotAligned, p.apply("prefill_step=1000"));
try p.apply("fill_rows=256");
try std.testing.expectEqual(@as(u32, 256), p.fill_rows);
for ([_][]const u8{ "fill_rows=0", "fill_rows=100", "fill_rows=384", "fill_rows=2048" }) |bad| try std.testing.expectError(error.StepNotAligned, p.apply(bad));
try std.testing.expectEqual(@as(u32, 256), p.fill_rows);
}

test "a policy survives its words" {
var p: Policy = .{ .mtp = .{ .drafts = 2, .confidence = 0.25 }, .slots = 4, .graph_fail = 1 };
try p.apply("matrix=on,attention=f32,graphs=off,gdn=reference");
try p.apply("matrix=on,attention=f32,graphs=off,gdn=reference,fill_rows=128");
const back = Policy.fromWords(p.words(), .{ .graph_fail = 1 });
try std.testing.expectEqualDeep(p, back);
}
Expand Down