Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6636e69
cuda: a one-shot RoCE all-gather for two ranks (roce.zig, roce_gather…
BobClawblaw Oct 14, 2026
39de039
lane core and native CUDA host for two-rank families with a vision to…
BobClawblaw Oct 14, 2026
bdc47c8
Merge branch 'pr/roce-gather' into pr/glm-flash-cuda
BobClawblaw Oct 14, 2026
cbe08cf
GLM-5.3-Flash on two CUDA ranks: the native family (zig/src/families/…
BobClawblaw Oct 14, 2026
a76f16a
glm kernels: the tensor-core fragment header beside them (qmm_frag.cu…
BobClawblaw Oct 14, 2026
abb8bbe
glm: the three Flash Next kernels the family loads (experts, experts_…
BobClawblaw Oct 14, 2026
2903dd7
cuda abi: the driver entries the GLM family uses (module function enu…
BobClawblaw Oct 14, 2026
87ef757
tf-cuda-test glm-*: exit right after the pass or summary line (the te…
BobClawblaw Oct 14, 2026
a759ccd
Merge branch 'pr/roce-gather' into pr/glm-flash-cuda
BobClawblaw Oct 15, 2026
db750c4
Merge branch 'pr/lane-host-vision' into pr/glm-flash-cuda
BobClawblaw Oct 15, 2026
a2eefa2
glm cuda: zig fmt
BobClawblaw Oct 15, 2026
22d92e4
lane host: a warm pass that steps aside is not launched after its can…
BobClawblaw Oct 15, 2026
a76651a
glm cuda: comments one line each, files under 600 lines, the long hea…
BobClawblaw Oct 15, 2026
ef73ec3
tf_video: the includes back under its one-line header
BobClawblaw Oct 15, 2026
e0d3baa
Merge branch 'pr/lane-host-vision' into pr/glm-flash-cuda
BobClawblaw Oct 15, 2026
0e50498
cuda: RoCE gather comments on one line each, the protocol notes in do…
BobClawblaw Oct 15, 2026
cc5d9d1
vision inputs: a server without --vision refuses image parts in the f…
BobClawblaw Oct 15, 2026
89c68c8
Merge branch 'pr/lane-host-vision' into pr/glm-flash-cuda
BobClawblaw Oct 15, 2026
aaed024
qwen_image.formatSeconds: t * 10 rounded in integers, not f128, so te…
BobClawblaw Oct 15, 2026
2cc423f
Merge branch 'pr/lane-host-vision' into pr/glm-flash-cuda
BobClawblaw Oct 15, 2026
9e6dfcd
lane host: a set-up job's kept entry stays pinned until its restore r…
BobClawblaw Oct 15, 2026
a8ea350
Merge remote-tracking branch 'fork/pr/lane-host-vision' into pr/glm-f…
BobClawblaw Oct 15, 2026
d069277
cuda: RoCE gather ranks agree one shard cap (each sends its max_bytes…
BobClawblaw Oct 15, 2026
22d2a30
Merge remote-tracking branch 'fork/pr/roce-gather' into pr/glm-flash-…
BobClawblaw Oct 15, 2026
b07b11b
glm cuda: the review's four fixes: a RoCE check after every sync that…
BobClawblaw Oct 15, 2026
52b82fc
prompt cache: an entry removed while pinned is dead to lookups and fr…
BobClawblaw Oct 15, 2026
468fa88
Merge branch 'pr/lane-host-vision' into pr/glm-flash-cuda
BobClawblaw Oct 15, 2026
c525ea9
glm cuda: the gather check and the agreed settings' doc comments on o…
BobClawblaw Oct 15, 2026
7c9d845
Merge remote-tracking branch 'origin/main' into pr/roce-gather
BobClawblaw Oct 16, 2026
b8d45de
cuda: the RoCE gather joins tp_group: its setup crosses the group's N…
BobClawblaw Oct 16, 2026
bb7e2a2
Merge origin/main (1.0.12) into pr/lane-host-vision: main's image pat…
BobClawblaw Oct 16, 2026
b416ec8
lane core: several queued prompts in one pass for a backend with pref…
BobClawblaw Oct 16, 2026
1ac97f6
Merge remote-tracking branch 'fork/pr/roce-gather' into tmp-855-base
BobClawblaw Oct 16, 2026
b982a3b
Merge #853 and #852 (both on main 1.0.12 with #804) into pr/glm-flash…
BobClawblaw Oct 16, 2026
aa9d4a7
glm cuda: the ranks' communicator is a tp_group.Group; on two ranks t…
BobClawblaw Oct 16, 2026
653bd37
glm cuda: EXL3 routed experts (Mia-AiLab's checkpoint: 4-bit mcg trel…
BobClawblaw Oct 16, 2026
8278074
kernel contract: glm_exl3's eight launches with their sm_80/86/89/120…
BobClawblaw Oct 16, 2026
084c253
glm cuda: the ranks watch each other (tp_watch): a rank that fails or…
BobClawblaw Oct 16, 2026
b090a7b
glm cuda: verify windows to the decode buffers' 8 rows, so the lane c…
BobClawblaw Oct 16, 2026
93f5261
glm cuda: the image tower (model.visual.*, rank 0's) on cuBLASLt and …
BobClawblaw Oct 16, 2026
f9d4f9f
glm cuda: images on two ranks (--vision): rank 0's tower encodes a pr…
BobClawblaw Oct 16, 2026
3cc4581
tools/glm_vision_ref.py: the torch reference tf-cuda-test glm-vision …
BobClawblaw Oct 16, 2026
edc2285
glm cuda: the bf16 linears on glm_mm (ours, from the glm_cuda family)…
BobClawblaw Oct 16, 2026
875b695
glm cuda: TF_GLM_PROF=1 also times prompt chunks by section (gate, fo…
BobClawblaw Oct 16, 2026
526ffd4
Merge the glm_cuda family's head (c525ea99): its work now lives in fa…
BobClawblaw Oct 16, 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
Merge origin/main (1.0.12) into pr/lane-host-vision: main's image pat…
…h (core/picture, server images and videos, media_fetch), its two-rank serving (--tp/--rank, engines.follow, room by the smallest rank) and the prompt cache's borrowers replace this branch's; the batched prompt passes come back on main's lane host next
  • Loading branch information
BobClawblaw committed Oct 16, 2026
commit bb7e2a211768592497aec4ff0ae3345b1129f8a1
7 changes: 4 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const exl3_build = @import("zig/build/exl3.zig");
const exlr8_build = @import("zig/build/exlr8.zig");
const server_build = @import("zig/build/server.zig");
const golden_build = @import("zig/build/golden.zig");
const vision_build = @import("zig/build/vision.zig");
const contract_build = @import("zig/build/kernel_contract.zig");
const video_build = @import("zig/build/video.zig");

comptime {
const required = std.mem.trim(u8, @embedFile(".zig-version"), "\r\n");
Expand Down Expand Up @@ -285,7 +286,7 @@ fn metalTargets(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.b
counters_build.targets(b, target, optimize, metal, mods.sources, test_step);

// The engines registry: the families this platform's binaries serve; the CLI reads it for models/info/pull.
const api = b.createModule(.{ .root_source_file = b.path("zig/src/core/engine_api.zig"), .target = target, .optimize = optimize, .link_libc = true, .imports = &.{ .{ .name = "lanes", .module = mods.lanes }, .{ .name = "qwen_image", .module = vision_build.module(b, target, optimize) } } });
const api = b.createModule(.{ .root_source_file = b.path("zig/src/core/engine_api.zig"), .target = target, .optimize = optimize, .link_libc = true, .imports = &.{.{ .name = "lanes", .module = mods.lanes }} });
const engines = b.createModule(.{
.root_source_file = b.path("zig/src/native/metal.zig"),
.target = target,
Expand Down Expand Up @@ -601,7 +602,7 @@ pub fn distMetalServer(b: *std.Build, target: std.Build.ResolvedTarget, draft_id
m.metal.addSystemFrameworkPath(b.graph.cwdRelativePath(b.pathJoin(&.{ sdk, "System/Library/Frameworks" })));
m.metal.addLibraryPath(b.graph.cwdRelativePath(b.pathJoin(&.{ sdk, "usr/lib" })));
m.metal.addSystemIncludePath(b.graph.cwdRelativePath(b.pathJoin(&.{ sdk, "usr/include" })));
const api = b.createModule(.{ .root_source_file = b.path("zig/src/core/engine_api.zig"), .target = target, .optimize = .fast, .link_libc = true, .imports = &.{ .{ .name = "lanes", .module = m.lanes }, .{ .name = "qwen_image", .module = vision_build.module(b, target, .ReleaseFast) } } });
const api = b.createModule(.{ .root_source_file = b.path("zig/src/core/engine_api.zig"), .target = target, .optimize = .fast, .link_libc = true, .imports = &.{.{ .name = "lanes", .module = m.lanes }} });
const engines = b.createModule(.{ .root_source_file = b.path("zig/src/native/metal.zig"), .target = target, .optimize = .fast, .link_libc = true, .imports = &.{ .{ .name = "metal", .module = m.metal }, .{ .name = "engine_api", .module = api }, .{ .name = "tensorfold", .module = m.engine } } });
return nativeServer(b, target, .fast, m.metal, m.engine, api, engines, build_options, null);
}
Expand Down
18 changes: 13 additions & 5 deletions zig/build/cuda.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const std = @import("std");
const exlr8_build = @import("exlr8.zig");
const golden_build = @import("golden.zig");
const vision_build = @import("vision.zig");

/// Each .cu in zig/kernels/cuda (`src`, else `name`) with the flags its Python extension passes in `extra_cuda_cflags`.
const Kernel = struct { name: []const u8, flags: []const []const u8, src: ?[]const u8 = null, arch_specific: bool = false };
Expand Down Expand Up @@ -142,7 +141,6 @@ pub fn targets(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.bu
const runner = b.createModule(.{ .root_source_file = b.path("zig/tests/cuda/main.zig"), .target = target, .optimize = optimize, .link_libc = true, .strip = strip });
runner.addImport("cuda", cuda);
runner.addImport("core", mods.core);
runner.addImport("qwen_image", vision_build.module(b, target, optimize));
runner.addImport("lanes", mods.lanes);
runner.addImport("nemotron", mods.nemotron);
runner.addImport("lfm2", lfm2Module(b, target, optimize, cuda, mods.core));
Expand Down Expand Up @@ -186,8 +184,8 @@ fn radioModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.bu
}

/// The CUDA engines a native server opens (native/cuda.zig), over the given runtime and families.
fn engines(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, cuda: *std.Build.Module, lanes: *std.Build.Module, nemotron: *std.Build.Module) struct { api: *std.Build.Module, engines: *std.Build.Module } {
const api = b.createModule(.{ .root_source_file = b.path("zig/src/core/engine_api.zig"), .target = target, .optimize = optimize, .link_libc = true, .imports = &.{ .{ .name = "lanes", .module = lanes }, .{ .name = "qwen_image", .module = vision_build.module(b, target, optimize) } } });
fn engines(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, cuda: *std.Build.Module, core: *std.Build.Module, lanes: *std.Build.Module, nemotron: *std.Build.Module, heat: *std.Build.Module) struct { api: *std.Build.Module, engines: *std.Build.Module } {
const api = b.createModule(.{ .root_source_file = b.path("zig/src/core/engine_api.zig"), .target = target, .optimize = optimize, .link_libc = true, .imports = &.{.{ .name = "lanes", .module = lanes }} });
const mod = b.createModule(.{
.root_source_file = b.path("zig/src/native/cuda.zig"),
.target = target,
Expand Down Expand Up @@ -270,7 +268,17 @@ pub fn hostTests(b: *std.Build, draft_ids: *std.Build.Module, build_options: *st
@import("cortheon_fuzz.zig").add(b, host, native_modules.api, mods.tokenizer, template);
}
// the tokenizer's own tests (memo, steps, regex, unicode) run here: no other test binary reaches them
for ([_]*std.Build.Module{ cuda, mods.core, mods.lanes, mods.nemotron, mods.heat, mods.tokenizer, native, stagger(b, host, .debug), vision_build.module(b, host, .debug) }) |m| step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = m })).step);
for ([_]*std.Build.Module{ cuda, mods.core, mods.lanes, mods.nemotron, lfm2Module(b, host, .debug, cuda, mods.core), mods.radio, mods.heat, mods.tokenizer, native, stagger(b, host, .debug) }) |m| step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = m })).step);
// the GLM-5.3-Flash CUDA family's host side
const glm = glmCuda(b, host, .debug, cuda, mods.core, mods.lanes, mods.heat);
step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = glm })).step);
// the shares a GLM-5.3-Flash rank takes (cluster/canon.zig against the Python family's)
const shares = b.createModule(.{ .root_source_file = b.path("zig/src/cluster/canon_glm_test.zig"), .target = host, .optimize = .debug });
step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = shares })).step);
// the tool-call parser's tests, run beside the server's on Macs: the GLM calls the CUDA port serves
const parse_tests = b.createModule(.{ .root_source_file = b.path("zig/src/server/tool_parse_test.zig"), .target = host, .optimize = .debug, .link_libc = true, .imports = &.{ .{ .name = "engine_api", .module = native_modules.api }, .{ .name = "tokenizer", .module = mods.tokenizer }, .{ .name = "template", .module = template } } });
_ = @import("server.zig").addTo(b, parse_tests, host, .debug);
step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = parse_tests })).step);
const cli = b.createModule(.{ .root_source_file = b.path("zig/src/cli/cuda_main.zig"), .target = host, .optimize = .debug, .link_libc = true });
cli.addImport("cuda", cuda);
cli.addImport("core", mods.core);
Expand Down
6 changes: 0 additions & 6 deletions zig/build/vision.zig

This file was deleted.

51 changes: 31 additions & 20 deletions zig/src/core/engine_api.zig
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//! The engine a server drives (``Engine``), and ``LaneHost``: the lane core served on one thread, rounds left to it.
const std = @import("std");
/// Image inputs (decode, resize, patches) for families with a vision tower; the server reaches them here.
pub const Image = lanes.Image;
pub const qwen_image = @import("qwen_image");
const lanes = @import("lanes");
const Allocator = std.mem.Allocator;

Expand Down Expand Up @@ -96,8 +93,20 @@ pub const Request = struct {
logprobs: ?u8 = null,
/// Rows for each prompt token after the first, with ranks and this many best tokens, when ``Info.prompt_logprobs``.
prompt_logprobs: ?u8 = null,
/// An image prompt's inputs in prompt order (Info.vision engines only; the prompt holds their placeholder rows).
images: []const lanes.Image = &.{},
/// Images whose rows replace placeholder tokens of ``prompt``, in order; only when ``Info.vision`` is set.
images: []const Image = &.{},
/// The prompt as the prompt cache matches it (each image's placeholders by its content); empty: ``prompt``.
cache_key: []const u32 = &.{},

/// The prompt as the prompt cache matches it: an image request's placeholders stand for their images.
pub fn cacheKey(r: *const Request) []const u32 {
return if (r.cache_key.len > 0) r.cache_key else r.prompt;
}

/// The prompt length its kept states count as: its own, or for a warm pass the request whose reply it prefills.
pub fn bornLen(r: *const Request) u32 {
return if (r.born > 0) r.born else @intCast(r.prompt.len);
}
};

/// An image prepared for the engine's tower (``Vision.prepare``): patches, patch grid, tokens and a content hash.
Expand Down Expand Up @@ -242,10 +251,6 @@ pub const Info = struct {
vision: ?Vision = null,
/// The engine decodes greedily only: the server refuses a request with a temperature before admitting it.
greedy_only: bool = false,
/// The engine encodes image inputs (Request.images): it was opened with ``vision`` and its family has a tower.
vision: bool = false,
/// Its tower takes GLM-5.3-Flash's preparation and placeholders (qwen_image.glm) instead of Qwen's.
vision_glm: bool = false,
/// Whether a request's caches fit beside the running streams' now (null: a free lane does); else it waits in order.
admit: ?Admit = null,
};
Expand Down Expand Up @@ -322,21 +327,27 @@ pub const Open = struct {
master_port: u16 = 29551,
/// --policy: the engine's policy as `key=value,...`; empty: its defaults.
policy: []const u8 = "",
/// --vision: load the family's vision tower and accept image inputs.
vision: bool = false,
/// --kv-dtype: bits of the attention cache's codes (8 or 4) for families that keep a quantized cache.
kv_bits: u8 = 8,
/// --vision: load the checkpoint's image tower (null: text only; an engine without one refuses).
vision: ?VisionOpen = null,
};

/// An opened engine; ``close`` stops its thread and frees its backend.
pub const Opened = struct {
engine: Engine,
close: *const fn (ctx: *anyopaque) void,
ctx: *anyopaque,
/// Rank 1 of two: replay rank 0's engine calls until it stops (the server then serves no HTTP); null elsewhere.
follow: ?*const fn (ctx: *anyopaque) anyerror!void = null,
/// A packed decision: a trunk (pictures expand at `at`), a branch a question, and each branch's labels (`counts`).
pub const Decision = struct {
trunk: []const u32,
at: usize = 0,
pictures: []const []const u8 = &.{}, // data URLs, in prompt order
branches: []const []const u32 = &.{},
counts: []const usize = &.{},
labels: []const u32 = &.{},
logits: []f64 = &.{},
read: usize = 0, // out: the trunk's tokens with its pictures expanded, plus every branch's
problem: []const u8 = "", // out: why the engine refused (error.Refused), in `arena`
arena: ?std.mem.Allocator = null, // the request's, for what the engine hands back
};

/// An opened engine; ``close`` stops its thread and frees its backend.
pub const Opened = struct { engine: Engine, close: *const fn (ctx: *anyopaque) void, ctx: *anyopaque };

pub const Memory = struct { active: u64 = 0, cache: u64 = 0, peak: u64 = 0, pinned: u64 = 0, limit: ?u64 = null };

/// A backend's words for its own refusals (a request it cannot serve); null: the error's name.
Expand Down
77 changes: 25 additions & 52 deletions zig/src/core/lane_host.zig
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ pub const LaneHost = struct {
const e = job.entry orelse return;
job.entry = null;
const store = job.host.cache orelse return;
defer store.unpin(e); // after resumed, which reads e
if (!job.started) return;
if (!job.started) return store.release(e);
job.stream.reuse.saved = null; // the backend restores before its first chunk; a later keep may free it
const ok = !job.stream.reuse_failed and job.stream.cached == e.at;
if (job.stream.reuse_failed or ok) store.resumed(e, job.request.cacheKey(), ok) else store.release(e);
Expand Down Expand Up @@ -275,48 +274,39 @@ pub const LaneHost = struct {
h.mutex.unlock(h.io);
}

/// The next queued request into the admitted ones (null: none waits, no lane is free, or its caches do not fit).
pub fn takeJob(h: *LaneHost) ?*Job {
/// Prefills the next queued request into a free lane; false when none waits or no lane is free.
fn admitOne(h: *LaneHost) bool {
h.lock();
// a stale device takes no reply: `learn.refuse` ends the queued ones instead
if (h.stale or h.queued.items.len == 0 or h.admitted.items.len >= @min(h.info_.lanes, h.memory_lanes orelse h.info_.lanes)) {
h.unlock();
return null;
return false;
}
const at = admit.pick(h) orelse { // a shared cache pool's head waits for room
h.unlock();
return null;
return false;
};
const job = h.queued.orderedRemove(at);
job.seq = h.admissions;
h.admissions += 1;
h.admitted.append(h.gpa, job) catch {
h.unlock();
h.finish(job, .failed, "out of memory");
return null;
return true;
};
h.unlock();
return job;
}

/// The admitted request's stream (its kept state, drafter and grammar); false when it was dropped instead.
pub fn setup(h: *LaneHost, job: *Job) bool {
const r = job.request;
if (r.background and r.max_tokens == 0 and h.warm_quiet > 0 and !h.quiet(job)) { // other work came first: it never ran
_ = h.cancel(job);
return false;
}
if (r.background and r.max_tokens == 0 and h.warm_quiet > 0 and !h.quiet(job)) return h.cancel(job); // other work came first: it never ran
var reuse: lanes.stream.Reuse = .{};
if (h.cache) |store| if (r.prompt_logprobs == null and !r.untaught) if (store.lookupRewind(h.gpa, r.prompt, born(r), r.history_len, r.rewind_len, r.shared_prefixes, r.chunks, h.spans(r))) |l| {
job.entry = if (l.entry) |e| store.pin(e) else null; // kept alive until its restore reports
// the entry stays alive until the backend restores it: nothing keeps between here and this stream's own pass
if (h.cache) |store| if (r.prompt_logprobs == null and !r.untaught) if (store.lookupRewind(h.gpa, r.cacheKey(), r.bornLen(), r.history_len, r.rewind_len, r.shared_prefixes, r.chunks, h.spans(r))) |l| {
job.entry = l.entry;
job.kept0 = store.counts.kept;
job.marks = l.marks;
reuse = .{ .saved = if (l.entry) |e| e.saved else null, .at = if (l.entry) |e| e.at else 0, .marks = l.marks, .hook = .{ .ptr = job, .at = Job.kept } };
} else |_| {};
job.proposer = lanes.SuffixLookup.init(h.gpa, .{ .min_match = h.min_match }) catch {
_ = h.drop(job, "the drafter could not start");
return false;
};
job.proposer = lanes.SuffixLookup.init(h.gpa, .{ .min_match = h.min_match }) catch return h.drop(job, "the drafter could not start");
const recall = recalls.reader(h, job);
job.stream = lanes.Stream.init(h.gpa, .{
.id = "request",
.prompt = r.prompt,
Expand All @@ -341,33 +331,23 @@ pub const LaneHost = struct {
.reuse = reuse,
.grammar = if (r.structure) |st| h.constraint(st) catch |e| {
job.proposer.deinit();
{
_ = h.drop(job, if (e == error.OutOfMemory) "out of memory" else "the reply's grammar could not start (xgrammar)");
return false;
}
recalls.release(job);
return h.drop(job, if (e == error.OutOfMemory) "out of memory" else "the reply's grammar could not start (xgrammar)");
} else null,
.images = r.images,
.decode_spans = h.spans(r),
.decide = r.decide,
.untaught = r.untaught,
.images = r.images,
.key = r.cache_key,
}) catch {
job.proposer.deinit();
{
_ = h.drop(job, "out of memory");
return false;
}
recalls.release(job);
return h.drop(job, "out of memory");
};
job.started = true;
job.began = std.Io.Clock.awake.now(h.io).toNanoseconds();
return true;
}

/// An admitted request into the engine: a warm pass, the lone driver, the fill queue, or its own prompt pass.
pub fn launch(h: *LaneHost, job: *Job) bool {
const r = job.request;
const began = job.began;
job.fill_on.store(true, .release); // status readers count the fill from here until the pass reports
const began = std.Io.Clock.awake.now(h.io).toNanoseconds();
job.began = began;
if (r.max_tokens == 0 and h.info_.warm_turns) return h.warmPass(job, began);
if (lone.fits(h, job)) return lone.run(h, job, began, false);
if (h.core.fills()) {
Expand Down Expand Up @@ -464,16 +444,7 @@ pub const LaneHost = struct {
}

/// No memory for another lane yet: the job waits at the queue's head, and admission holds until a job ends.
pub fn requeue(h: *LaneHost, job: *Job) bool {
if (job.stream.grammar) |g| g.deinit(h.gpa); // the next admission compiles its own
job.stream.deinit(h.gpa);
job.proposer.deinit();
job.started = false;
job.fill_began = false;
if (job.entry) |e| h.cache.?.unpin(e);
job.entry = null; // looked up again at its next admission
h.gpa.free(job.marks);
job.marks = &.{};
fn requeue(h: *LaneHost, job: *Job) bool {
h.lock();
for (h.admitted.items, 0..) |j, i| if (j == job) {
_ = h.admitted.orderedRemove(i);
Expand Down Expand Up @@ -507,7 +478,7 @@ pub const LaneHost = struct {
const alone_words = "the engine has no memory for this request's caches with nothing else running: lower --context or --parallel";

/// A job cancelled in its prompt pass, its lane already released.
pub fn cancel(h: *LaneHost, job: *Job) bool {
fn cancel(h: *LaneHost, job: *Job) bool {
h.remove(job);
h.finish(job, .cancelled, "");
return true;
Expand All @@ -525,8 +496,10 @@ pub const LaneHost = struct {

fn run(h: *LaneHost) void {
while (true) {
h.takeCancels();
while (admit.many(h)) {}
ends.takeCancels(h);
rows_host.answer(h);
learn.refuse(h);
while (h.admitOne()) {}
h.fillOne();
status.noteLive(h);
h.lock();
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.