Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

## Unreleased

- HIP, Qwen3.8-Flash-Next on RDNA 3.5 (gfx1151): MTP draft chains now stop under a 0.8 confidence floor by default (was 0.3), the same one-rank rule `prefill_step` uses. Replies are unchanged. One stream decodes about 6% faster and four streams 2.8% (greedy) to 4.6% (sampled) faster (#2697). Thanks to @gilby.
- Qwen3.8-Flash-Next on HIP stops its MTP draft chains under a 0.8 confidence floor by default instead of the HIP-wide 0.3; `--mtp-confidence` still overrides it, and the other HIP families keep 0.3. On a Strix Halo iGPU one-stream decode is about 6% faster on code and on chat, and four distinct streams about 3%, with one-stream throughput on `tools/bench_prompts.json` unchanged. Replies are unchanged.
- Server: a reply that keeps a tool-call envelope as plain text now says so. `tensorfold.kept_tool_calls` counts the envelopes that name a tool the request did not offer and the malformed ones, and lists up to eight unoffered names, on the whole reply and on a stream's final chunk; `/metrics` gains `kept_tool_calls_unoffered_total` and `kept_tool_calls_malformed_total`. Replies are otherwise unchanged (#2814, for #2800). Thanks to @tarsnake for the report.

- CI: the app workflow keeps its Linux AppImage artifact for 3 days instead of GitHub's default 90 (#2966).
Expand Down
8 changes: 7 additions & 1 deletion docs/recipes/qwen3.8-flash-next.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ A quantized cache changes the output, so its replies differ from bf16's. Drafted
families refuse `--kv-dtype` before any download.

`--mtp-confidence P`, from 0 to 1, sets the probability under which a chain stops before a later draft; the CUDA
default is 0.70, for one stream and for concurrent rounds. Only Flash Next's CUDA engine has this rule, so the MLX path and the other families refuse it.
default is 0.70, for one stream and for concurrent rounds. The native HIP engine defaults to 0.80 for Flash Next on one
RDNA 3.5 GPU (the Strix Halo and other gfx115x iGPUs) and to 0.3 on other cards, across several GPUs, and for Qwen 3.5,
3.6 and 3.8. The MLX path refuses it.

## Native HIP on a Strix Halo iGPU

Expand Down Expand Up @@ -523,6 +525,10 @@ taken after removing that offset. Task scores come from the HIP server: greedy,
match, HumanEval 164 pass@1, MMLU-Pro 700 (50 a category, a letter within 16 tokens; replies without one count as wrong,
159 of them for the uniform 4-bit checkpoint, 14 for oQ4e-mix5 and 4 for oQ4e).

On this iGPU serving alone, draft chains stop at a 0.80 confidence floor by default (other cards and the other HIP
families stay at 0.3);
`--mtp-confidence P` overrides it, and `--mtp-drafts N` caps the chain depth at N drafts.

```bash
zig build native-hip -Dhip=true -Dhip-arch=gfx1151 -Dhipcc=/usr/bin/hipcc -Doptimize=ReleaseFast
./zig-out/native-hip/bin/tensorfold-native serve ./Qwen3.8-Flash-Next-oQ4e-mix5-HIP \
Expand Down
2 changes: 2 additions & 0 deletions zig/src/families/flashnext/hip/native.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub const formats: []const []const u8 = &.{ "mlx-q3g32", "mlx-q4g32", "mlx-q6g32
pub const default_context: i64 = 32768;
/// The engine cuts prompts itself.
pub const prefill_step: u32 = 0;
/// Flash Next's MTP floor on one RDNA 3.5 GPU serving alone, unless `--mtp-confidence` says otherwise.
pub const mtp_confidence_rdna3_5: f64 = 0.8;
/// Device bytes a rank keeps for the forward's scratch until the engine counts its own.
pub const scratch_bytes: u64 = 2 << 30;

Expand Down
8 changes: 7 additions & 1 deletion zig/src/native/hip.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ fn refuse(a: Allocator, problem: *[]const u8, comptime fmt: []const u8, args: an
return error.Refused;
}

/// Whether the run is one RDNA 3.5 GPU serving alone, where a family's measured draft defaults apply.
pub fn rdna3_5Alone(caps: hip.Caps, ranks: u32) bool {
return caps.generation == .rdna3_5 and ranks == 1;
}

/// Why `matrix=on` cannot run on a GPU of `caps`, or null when its matrix-core tiles exist (gfx11's WMMA).
fn matrixRefused(comptime F: type, policy: hip.Policy, caps: hip.Caps) ?[]const u8 {
if (policy.matrix != .on) return null;
Expand Down Expand Up @@ -116,7 +121,7 @@ fn ready(comptime F: type, a: Allocator, gpa: Allocator, io: std.Io, o: api.Open
s,
});
if (o.mtp_drafts) |n| policy.mtp.drafts = @intCast(n);
if (o.mtp_confidence) |c| policy.mtp.confidence = c;
policy.mtp.confidence = fam.confidenceFloor(F, o, rdna3_5Alone(caps, o.tp), policy.mtp.confidence);
if (o.keep) |n| policy.slots = @intCast(@min(n, 1 << 16));
if (matrixRefused(F, policy, caps)) |why| return refuse(a, problem, "matrix=on: {s}; matrix=auto runs the dot2 tiles", .{why});
const group: ?hip.collective.Group = if (o.tp > 1) try join(a, gpa, io, o, caps, &policy, problem) else null;
Expand Down Expand Up @@ -556,6 +561,7 @@ test "matrix=on runs only where the matrix-core tiles exist; auto runs everywher

test {
_ = @import("draft_sources_hip_test.zig");
_ = @import("hip_confidence_test.zig");
}

test "slide admission: hip refuses before checkpoint or device access" {
Expand Down
27 changes: 27 additions & 0 deletions zig/src/native/hip_confidence_test.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! The MTP confidence floor each HIP card, rank count and family resolves, from the cards' real caps rows.
const std = @import("std");
const hip = @import("hip");
const api = @import("engine_api");
const qwen35 = @import("qwen3_5");
const flashnext = @import("flashnext");
const fam = @import("hip_families.zig");
const native_hip = @import("hip.zig");

test "Flash Next's MTP floor is 0.8 on one RDNA 3.5 GPU and 0.3 on other cards, other families and groups; the flag wins" {
const wide: hip.Policy = .{};
try std.testing.expectEqual(@as(f64, 0.3), wide.mtp.confidence);
const plain: api.Open = .{ .dir = "d", .model_type = "qwen4_exp" };
const floor = struct {
fn of(comptime F: type, o: api.Open, gfx: []const u8, ranks: u32) f64 {
return fam.confidenceFloor(F, o, native_hip.rdna3_5Alone(hip.Caps.of(gfx).?, ranks), (hip.Policy{}).mtp.confidence);
}
}.of;
for ([_][]const u8{ "gfx1150", "gfx1151", "gfx1152", "gfx1153" }) |gfx| try std.testing.expectEqual(@as(f64, 0.8), floor(flashnext.native, plain, gfx, 1));
try std.testing.expectEqual(@as(f64, 0.3), floor(flashnext.native, plain, "gfx1151", 2));
for ([_][]const u8{ "gfx1030", "gfx1100", "gfx1201" }) |gfx| try std.testing.expectEqual(@as(f64, 0.3), floor(flashnext.native, plain, gfx, 1));
inline for (.{ qwen35.native, qwen35.native_moe }) |F| try std.testing.expectEqual(@as(f64, 0.3), floor(F, .{ .dir = "d", .model_type = F.model_type }, "gfx1151", 1));
const asked: api.Open = .{ .dir = "d", .model_type = "qwen4_exp", .mtp_confidence = 0.3 };
try std.testing.expectEqual(@as(f64, 0.3), floor(flashnext.native, asked, "gfx1151", 1));
const high: api.Open = .{ .dir = "d", .model_type = "qwen4_exp", .mtp_confidence = 0.9 };
try std.testing.expectEqual(@as(f64, 0.9), floor(flashnext.native, high, "gfx1201", 2));
}
7 changes: 7 additions & 0 deletions zig/src/native/hip_families.zig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ pub fn refused(comptime F: type, o: api.Open) ?[]const u8 {
return null;
}

/// A run's MTP floor: the flag, else the family's `mtp_confidence_rdna3_5` on one RDNA 3.5 GPU, else `fallback`.
pub fn confidenceFloor(comptime F: type, o: api.Open, rdna3_5_alone: bool, fallback: f64) f64 {
if (o.mtp_confidence) |c| return c;
if (comptime !@hasDecl(F, "mtp_confidence_rdna3_5")) return fallback;
return if (rdna3_5_alone) F.mtp_confidence_rdna3_5 else fallback;
}

/// The family's offer, or the empty one (text, the host's defaults) when its Loaded carries none.
pub fn offerOf(loaded: anytype) Offer {
return if (comptime @hasField(@TypeOf(loaded), "offer")) loaded.offer else .{};
Expand Down
Loading