Skip to content
Closed
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
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

## Unreleased

- Nemotron on HIP: a checkpoint whose token table (`backbone.embeddings`) is stored bf16 beside quantized matrices, marked `false` in config.json's quantization block or stored without scales, is admitted and loads; its rows are gathered as stored, the memory plan counts them at their stored bytes, and the startup label adds `+bf16-embed`; a bf16 `lm_head`, projection or other unquantized tensor is still refused by name (#3575, refs #3061). Thanks to @gilby.
- GLM-5.3-Flash on CUDA: while rank 0's vision tower encodes a prompt's images, the other ranks sleep on their liveness lines instead of waiting in a collective receive for the whole pass, so a long image pass no longer trips a net plugin's operation timeout and stops every rank; replies are unchanged (#3675, for #3614). Thanks to @ultradaoto.

- GLM-5.3-Flash on Metal: prompt index scores read each row's queries once per tile and routed-expert gathers load the next step's codes ahead, so follow-up turns reach the first token sooner with unchanged outputs (#3458).
- Desktop: a Qwen3.8-27B checkpoint is offered and loads, where the library applied the 2B geometry to every `qwen3_5` checkpoint and rejected the supported 27B at hidden size 5,120 (#3771). Thanks to @AIFlowML.

- Intel Arc (XPU): two or four Level Zero GPUs open as peers in one context, with new peer-to-peer all-reduce collectives (FP16, BF16 and FP32; one shot up to 512 KiB, reduce-scatter then gather above) that sum in fixed rank order for exact bits, and `zig build xpu-tp-bench` builds `tf-xpu-tp-bench` to check and time them; nothing serves through them yet (#3585, part of #3583). Thanks to @supernovae.

- Gemma 4 on Metal: an image input whose tower cannot load is refused cleanly instead of crashing during deinit, and a host test pins that a failed tower load leaves the model with none (#3421). Thanks to @jschmied.

- Nemotron on HIP: a checkpoint whose token table (`backbone.embeddings`) is stored bf16 beside quantized matrices, marked `false` in config.json's quantization block or stored without scales, is admitted and loads; its rows are gathered as stored, the memory plan counts them at their stored bytes, and the startup label adds `+bf16-embed`; a bf16 `lm_head`, projection or other unquantized tensor is still refused by name (#3575, refs #3061). Thanks to @gilby.

- GLM-5.3-Flash on Metal: prompt index scores read each row's queries once per tile and routed-expert gathers load the next step's codes ahead, so follow-up turns reach the first token sooner with unchanged outputs (#3458).

- Web: an explicit relative `--token-file` path for the service installer is anchored to the directory it is run from, so the file the installer prepares and the file the generated launcher opens are the same; the default path and symlink handling are unchanged (#3838, fixes #3835). Thanks to @AIFlowML.

Expand Down Expand Up @@ -38,8 +44,6 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

- Docs: the Qwen3.8-27B recipe says to serve with `--thinking-budget 4096` when thinking is on, and gives its GPQA Diamond result on TensorFold 1.2.7 and one GB10: replies cut at the limit from 78 of 198 to 0, and correct from 58.1% to 82.8% (#3373, fixes #3323).



- Idol on CUDA: `tf-idol` runs Idol's denoiser on GB10 (sm_121) and on RTX 50-series and RTX PRO Blackwell (sm_120) cards against a reference case, gated step by step against idol-sdk's float32 run as on Metal, and refuses other GPUs by name (#1767, for #1757). Thanks to @jayleaton, with device runs from @GustavBlack and @Nipale-ai.

- Docs: the drafter training recipe gains a section on adapting an already released drafter, budgeted from a few passes over the scarcest class at a low learning rate with early checkpoints, with the Qwen3.8-27B pilot behind it (#3369, refs #2667). Thanks to @Maxrio9.
Expand Down Expand Up @@ -331,6 +335,7 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel
- Flash Next at TP=2 on CUDA: the draft head, head-group and rollback passes replay as CUDA graphs on both ranks, and one-row split lanes skip their interleave copies; with Qwen3.8-Flash-Next NVFP4 and MTP at TP=2 on GB10s, decode is 1.2-1.4% faster and prompts 0.5-2.1% faster, with identical replies (#2837, for #2835).
- Intel XPU: Qwen3.8-27B's prompt `gdn_out` kernel keeps its scale bookkeeping in cheaper exact forms, for 22.6% less kernel time on an Arc Pro B70 (736.3 to 570.2 ms over a 32K prompt) with byte-identical outputs, its fallback included (#2921, refs #2859). Thanks to @dinadur.
- CI: the no-GPU host tests run as two parallel jobs, `zig` and `zig-b`, and a build check fails if any host check is in both or neither; a local `zig build test-host` still runs all of them (#3474).
- GLM-5.3-Flash on CUDA: while rank 0's vision tower encodes a prompt's images, the other ranks sleep on their liveness lines, as they do when no stream is left, instead of waiting in an NCCL receive for the whole pass, so a pass longer than a net plugin's operation timeout no longer stops every rank. On three GB10s at the mesh plugin's 30 s default, one 3840x2160 image (66 s), two 3072x1728 and fifteen 1920x1080 screenshots answer, with the same replies and short-image times (for #3614).

- Nemotron 3.5 Bolt on CUDA: the shared expert runs on the side stream in decode windows, as on Super, so decode on a GB10 is 2.9-3.0% faster at one stream and 1.4-2.1% at four, with identical replies (#2847, for #2840).

Expand Down
34 changes: 30 additions & 4 deletions app/electron/agent/engine/geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,26 @@ const QWEN35: PinnedGeometry = {
},
}

const QWEN27: PinnedGeometry = {
title: 'Qwen3.5 27B',
engineError: 'UnqualifiedQwenShape',
section: 'text_config',
dims: {
hidden_size: 5120,
vocab_size: 248320,
num_hidden_layers: 64,
intermediate_size: 17408,
linear_num_key_heads: 16,
linear_num_value_heads: 48,
linear_key_head_dim: 128,
linear_value_head_dim: 128,
linear_conv_kernel_dim: 4,
num_attention_heads: 24,
num_key_value_heads: 4,
head_dim: 256,
},
}

const LFM2_MOE: PinnedGeometry = {
title: 'LFM2.5',
engineError: 'UnsupportedLfmGeometry',
Expand Down Expand Up @@ -76,11 +96,15 @@ function layerTypesMatch(kind: string, layers: unknown): boolean {
}

export function admitGeometry(modelType: string, config: unknown): GeometryAdmission {
const pinned = PINNED[modelType]
if (!pinned) return { admitted: true, reason: null }
const defaultGeometry = PINNED[modelType]
if (!defaultGeometry) return { admitted: true, reason: null }
if (!plain(config)) return { admitted: true, reason: null }
const section = pinned.section ? config[pinned.section] : config
const section = defaultGeometry.section ? config[defaultGeometry.section] : config
if (!plain(section)) return { admitted: true, reason: null }
// The native dispatcher sends a tied head or the 2B hidden size to the 2B engine.
const useQwen27 = modelType === 'qwen3_5' && section.hidden_size === QWEN27.dims.hidden_size &&
config.hidden_size !== QWEN35.dims.hidden_size && config.tie_word_embeddings !== true && section.tie_word_embeddings !== true
const pinned = useQwen27 ? QWEN27 : defaultGeometry
for (const [key, expected] of Object.entries(pinned.dims)) {
const value = section[key]
if (value === undefined || value === null) continue
Expand All @@ -91,7 +115,9 @@ export function admitGeometry(modelType: string, config: unknown): GeometryAdmis
}
}
}
if (!layerTypesMatch(modelType, section.layer_types)) {
const interval = section.full_attention_interval
const wrongQwen27Interval = useQwen27 && typeof interval === 'number' && interval > 0 && interval !== 4
if (wrongQwen27Interval || !layerTypesMatch(modelType, section.layer_types)) {
return {
admitted: false,
reason: `This checkpoint's layer types are not the ones the bundled engine serves for ${pinned.title}; the engine refuses it (${pinned.engineError}).`,
Expand Down
39 changes: 39 additions & 0 deletions app/electron/agent/engine/library.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,45 @@ try {
const rescan = await lowMemory.scan()
assert.deepEqual(rescan.models.map((model: any) => [model.id, model.loadable, model.reason]), lowered.models.map((model: any) => [model.id, model.loadable, model.reason]), 'a later rescan agrees with the refreshed state')

const qwen27 = {
hidden_size: 5120, vocab_size: 248320, num_hidden_layers: 64, intermediate_size: 17408,
linear_num_key_heads: 16, linear_num_value_heads: 48, linear_key_head_dim: 128,
linear_value_head_dim: 128, linear_conv_kernel_dim: 4, num_attention_heads: 24,
num_key_value_heads: 4, head_dim: 256, full_attention_interval: 4,
}
const qwen27Library = library({ appHome: path.join(root, 'qwen27-app') })
const qwen27Models = path.join(root, 'qwen27-models')
const qwen27Cases = [
{ name: 'untied', tied: false, text: qwen27 },
{ name: 'wrong-kv-heads', tied: false, text: { ...qwen27, num_key_value_heads: 2 } },
{ name: 'wrong-interval', tied: false, text: { ...qwen27, full_attention_interval: 2 } },
{ name: 'tied-root', tied: true, text: qwen27 },
{ name: 'tied-tower', tied: false, text: { ...qwen27, tie_word_embeddings: true } },
]
for (const { name, tied, text } of qwen27Cases) {
const folder = path.join(qwen27Models, name)
await checkpoint(folder)
await fs.writeFile(path.join(folder, 'config.json'), JSON.stringify({
model_type: 'qwen3_5', tie_word_embeddings: tied, quantization: { bits: 4, group_size: 64 },
text_config: text,
}))
}
const qwen27Entries = (await qwen27Library.addFolder(qwen27Models)).models
const untied = qwen27Entries.find((model) => model.path === path.join(qwen27Models, 'untied'))!
assert.equal(untied.loadable, true, 'the qualified untied 27B is available in the library')
assert.equal((await qwen27Library.resolve(untied.id)).path, untied.path)
const wrongHeads = qwen27Entries.find((model) => model.path === path.join(qwen27Models, 'wrong-kv-heads'))!
assert.equal(wrongHeads.loadable, false)
assert.match(wrongHeads.reason!, /num key value heads is 2.*UnqualifiedQwenShape/)
const wrongInterval = qwen27Entries.find((model) => model.path === path.join(qwen27Models, 'wrong-interval'))!
assert.equal(wrongInterval.loadable, false)
assert.match(wrongInterval.reason!, /layer types/)
for (const name of ['tied-root', 'tied-tower']) {
const tied = qwen27Entries.find((model) => model.path === path.join(qwen27Models, name))!
assert.equal(tied.loadable, false)
assert.match(tied.reason!, /UnsupportedQwenGeometry/)
}

const validRegistry = await fs.readFile(lib.file, 'utf8')
await fs.writeFile(lib.file, '{')
await assert.rejects(() => library().snapshot(), /library is invalid/)
Expand Down
14 changes: 14 additions & 0 deletions zig/build/xpu.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn steps(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
.{ "gemm128", "zig/kernels/xpu/qwen27/gemm.cl", " -DGSZ=128" },
.{ "gdn", "zig/kernels/xpu/qwen27/gdn_chunk.cl", "" },
.{ "drafter", "zig/kernels/xpu/qwen27/drafter.cl", "" },
.{ "tp", "zig/kernels/xpu/tp.cl", "" },
.{ "glue_g4s", "zig/kernels/xpu/gemma4/glue_g4.cl", " -I zig/kernels/xpu/gemma4" },
.{ "glue_g4g", "zig/kernels/xpu/gemma4/glue_g4.cl", " -DHD=512 -I zig/kernels/xpu/gemma4" },
.{ "rows_g4s", "zig/kernels/xpu/gemma4/glue_g4.cl", " -I zig/kernels/xpu/gemma4" },
Expand Down Expand Up @@ -94,9 +95,22 @@ pub fn steps(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
\\
) });
const ze_mod = zeModule(b, target, optimize);
const tp_mod = b.createModule(.{ .root_source_file = b.path("zig/src/xpu/tp.zig"), .target = target, .optimize = optimize, .link_libc = true });
tp_mod.addImport("ze", ze_mod);
// one `core` for these trees: the Gemma 4 config, the safetensors readers, Nemotron, the CLI and server
const core = b.createModule(.{ .root_source_file = b.path("zig/src/core/root.zig"), .target = target, .optimize = .ReleaseSafe, .link_libc = true });
core.addImport("gpu_memory", @import("gpu_memory.zig").module(b, target));
{
const embedded_tp = b.createModule(.{ .root_source_file = files.add("xpu_tp_kernels.zig",
\\pub const tp align(8) = @embedFile("tp.bin").*;
\\
) });
const tpb = b.createModule(.{ .root_source_file = b.path("zig/src/xpu/tp_bench.zig"), .target = target, .optimize = optimize, .link_libc = true });
tpb.addImport("xpu_tp_kernels", embedded_tp);
tpb.addImport("ze", ze_mod);
const tpb_exe = b.addExecutable(.{ .name = "tf-xpu-tp-bench", .root_module = tpb });
b.step("xpu-tp-bench", "Build the multi-GPU Level Zero P2P TP=2/4 collective benchmark").dependOn(&b.addInstallArtifact(tpb_exe, .{}).step);
}
{
const g4 = b.createModule(.{ .root_source_file = b.path("zig/src/families/gemma4/xpu_main.zig"), .target = target, .optimize = optimize, .link_libc = true });
g4.addImport("xpu_gemma4_kernels", embedded_g4);
Expand Down
23 changes: 17 additions & 6 deletions zig/build/xpu_contract.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ pub fn steps(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.buil
for ([_][]const u8{ "glue_attn.cl", "glue_quant.cl" }) |part| glue.addFileInput(b.path(b.fmt("zig/kernels/xpu/qwen27/{s}", .{part})));
const glue_dir = glue.addOutputDirectoryArg("ocloc-glue");
_ = files.addCopyFile(glue_dir.path(b, "glue.bin"), b.fmt("{s}/glue.bin", .{device}));
const tp_obj = b.addSystemCommand(&.{ ocloc, "compile", "-q", "-file" });
tp_obj.addFileArg(b.path("zig/kernels/xpu/tp.cl"));
tp_obj.addArgs(&.{ "-device", device, "-options", opts, "-output_no_suffix", "-output", "tp", "-out_dir" });
tp_obj.setCwd(b.path("."));
const tp_dir = tp_obj.addOutputDirectoryArg("ocloc-tp");
_ = files.addCopyFile(tp_dir.path(b, "tp.bin"), b.fmt("{s}/tp.bin", .{device}));
const ctl = b.addSystemCommand(&.{ ocloc, "compile", "-q", "-file" });
ctl.addFileArg(b.path("zig/kernels/xpu/contract_controls.cl"));
ctl.addArgs(&.{ "-device", device, "-options", opts, "-output_no_suffix", "-output", "contract_controls", "-out_dir" });
Expand Down Expand Up @@ -58,7 +64,7 @@ pub fn runner(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.bui

const files = b.addWriteFiles();
if (prebuilt) |dir| {
for ([_][]const u8{ "glue", "contract_controls", "contract_gate_controls" }) |name| {
for ([_][]const u8{ "glue", "tp", "contract_controls", "contract_gate_controls" }) |name| {
_ = files.addCopyFile(.{ .cwd_relative = b.fmt("{s}/{s}.bin", .{ dir, name }) }, b.fmt("{s}.bin", .{name}));
}
} else {
Expand All @@ -70,17 +76,22 @@ pub fn runner(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.bui
for ([_][]const u8{ "glue_attn.cl", "glue_quant.cl" }) |part| glue.addFileInput(b.path(b.fmt("zig/kernels/xpu/qwen27/{s}", .{part})));
const glue_dir = glue.addOutputDirectoryArg("ocloc-glue-run");
_ = files.addCopyFile(glue_dir.path(b, "glue.bin"), "glue.bin");
for ([_][]const u8{ "contract_controls", "contract_gate_controls" }) |name| {
for ([_][2][]const u8{
.{ "tp", "zig/kernels/xpu/tp.cl" },
.{ "contract_controls", "zig/kernels/xpu/contract_controls.cl" },
.{ "contract_gate_controls", "zig/kernels/xpu/contract_gate_controls.cl" },
}) |pair| {
const run = b.addSystemCommand(&.{ ocloc, "compile", "-q", "-file" });
run.addFileArg(b.path(b.fmt("zig/kernels/xpu/{s}.cl", .{name})));
run.addArgs(&.{ "-device", device, "-options", opts, "-output_no_suffix", "-output", name, "-out_dir" });
run.addFileArg(b.path(pair[1]));
run.addArgs(&.{ "-device", device, "-options", opts, "-output_no_suffix", "-output", pair[0], "-out_dir" });
run.setCwd(b.path("."));
const dir = run.addOutputDirectoryArg(b.fmt("ocloc-{s}-run", .{name}));
_ = files.addCopyFile(dir.path(b, b.fmt("{s}.bin", .{name})), b.fmt("{s}.bin", .{name}));
const dir = run.addOutputDirectoryArg(b.fmt("ocloc-{s}-run", .{pair[0]}));
_ = files.addCopyFile(dir.path(b, b.fmt("{s}.bin", .{pair[0]})), b.fmt("{s}.bin", .{pair[0]}));
}
}
const images = b.createModule(.{ .root_source_file = files.add("xpu_contract_images.zig",
\\pub const glue align(8) = @embedFile("glue.bin").*;
\\pub const tp align(8) = @embedFile("tp.bin").*;
\\pub const controls align(8) = @embedFile("contract_controls.bin").*;
\\pub const gate_controls align(8) = @embedFile("contract_gate_controls.bin").*;
), .target = target, .optimize = optimize });
Expand Down
Loading
Loading