Skip to content

cuda: TF_CUDA_SCHED, an opt-in host wait schedule for served CUDA models - #5165

Merged
ashhart merged 4 commits into
ashhart:mainfrom
ZackSample:cuda-sched-servers
Nov 27, 2026
Merged

ashhart merged 4 commits into
ashhart:mainfrom
ZackSample:cuda-sched-servers

Conversation

@ZackSample

@ZackSample ZackSample commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Before, a CUDA server's host thread waits for its GPU with the driver's default auto schedule. On a GB10, auto spins, so one host core stays at 100% for as long as the server is generating. After, TF_CUDA_SCHED=blocking (or spin / yield / auto) sets the schedule on the primary context before the shared CUDA open and the MOSS image host create it. Unset or blank keeps today's path, and any other value is refused by name at startup.

Checks on this head

  • Head commit: b657da0. The receipt below ran 447f958, the same code as 1189da4. The device check for b657da0 (every word, token IDs, MOSS and Drama) is in the review reply.
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 152 and 152, 0 new (tools/pr_check.py --base origin/main: 0 errors, 4 inherited warnings).
  • Tests run, with the command and pass, fail and skip counts:
    • zig build test-environment-host test-env-defaults-host -Dfixed-cpu: 36 pass; 47 pass and 1 skip; 103 pass.
    • With the TF_CUDA_SCHED row removed from the registry, both the registry test and the new cuda_schedule.zig test fail (ABRT).
    • zig build test test-golden -Dfixed-cpu: 922/922 steps, 13,842 of 13,947 tests pass and 105 skip.
    • zig fmt --check build.zig zig and git diff --check pass.
  • CI: not watched here; I'm happy to look at any failure you point to.
  • Not run, and why: Metal, HIP and XPU are untouched (the setting's scope is cuda). I have no wall power meter, so heat below is the host's hottest ACPI thermal zone, not watts.

Receipt

  • Main against branch: the cells below alternate unset, blocking, unset, blocking on one build of this branch. With the setting unset, its only difference from main is one registry read that returns before any driver call. I did not run a separate main binary.
  • Boxes it reaches: every served CUDA primary context: the shared open in native/cuda.zig, the MOSS image host, and the special families' own opens (Qwen3, Qwen4, LFM2, Drama, ZONOS3). DeepSeek V4.1 keeps its own existing TF_CUDA_SCHED reader in dev_arena.zig, which accepts the same four words.
  • New switch? TF_CUDA_SCHED: unset by default; accepts auto, spin, yield or blocking; no profile row (no profile sets it).
  • Environment:
    • TensorFold 447f958 on main 84d9b6b, Zig 0.17.0, nvcc 13.0.88, driver 580.178.04.
    • One DGX Spark (NVIDIA GB10, sm_121, 128 GB), Ubuntu 24.04.5, kernel 7.0.0-1025-nvidia.
    • Checkpoints: Blackfrost-AI/Inkling-2-Mini-Derisked at 31ec2edd, and OpenMOSS-Team/MOSS-Image-Base at 85975793d8b3.
  • Paths and platforms the change reaches, which I ran and which I could not:
    • Ran: Inkling 2 Mini through the shared open, and MOSS-Image.
    • Not run: the other families on the shared open (the setting is unset by default for all of them), and other SMs.
  • Exactness: every Inkling reply has the same SHA-256 in all four arms, at 1 stream and at 4 concurrent streams (each of the four equals the solo reply), and so does the long-prompt reply. All 20 MOSS pictures are byte-identical (d3131544…).
  • Main against this branch, same machine and checkpoint: below.
  • Decode speed before and after: below. These come from a small streaming client (in the details at the end), not tools/bench_openai.py. It reports the same quantities: greedy, 512 tokens, median of three solo replies, and the aggregate over four concurrent replies.
  • Prompt speed before and after: one cold 9,226-token prompt per arm, on a fresh server whose prefix cache had never seen it.
  • Licence of any new weights or drafter: n/a.

Inkling 2 Mini Derisked, serve --parallel 4 --context 65536 --no-drafts, temperature 0. Each cell gives arm 1 / arm 3 (unset) and arm 2 / arm 4 (blocking).

Cell unset blocking
Prose, 1 stream, tok/s 24.24 / 24.22 23.58 / 23.65
Code, 1 stream, tok/s 24.21 / 24.20 23.68 / 23.67
Prose, 4 streams, aggregate tok/s 73.75 / 73.78 72.72 / 72.00
Code, 4 streams, aggregate tok/s 73.75 / 73.67 72.23 / 71.82
Time to first token, prose, s 0.126 / 0.134 0.132 / 0.135
9,226-token cold prompt, time to first token, s 35.04 / 35.01 35.21 / 34.99
Decode after it, tok/s 23.35 / 23.32 22.59 / 22.58
Server CPU over the arm, cores 1.01 / 1.01 0.49 / 0.49
Hottest thermal zone, average, °C 65.9 / 74.0 63.5 / 64.4

MOSS-Image, 1024², 8 steps, guidance 1, seed 42, five pictures per arm after a warm-up. Arm order: unset, blocking, unset, blocking.

Cell unset blocking
Seconds per picture 9.88–9.91 / 9.88–9.92 9.92–9.95 / 9.91–9.96
Server CPU, cores 1.00 / 1.00 0.04 / 0.05
Hottest thermal zone, average, °C 73.7 / 70.6 68.1 / 67.3

What it costs: blocking is opt-in because it is not free on Inkling. Decode is about 2% slower at 1 and 4 streams, the first token 1–9 ms later on short prompts, and prompt processing unchanged. MOSS is 0.4% slower. What it buys is the spinning core: MOSS drops from one core to about none. Inkling on this engine drops to half a core, so a second host thread is still busy there, which this setting does not reach. The thermal zone was noisy between arms (arm 3 ran 8 °C warmer than arm 1 with the same setting), but every blocking arm ran cooler than the unset arm before it. On a different Inkling CUDA engine out of tree (#4441's lineage with its patches), the same switch cost 1–6% for about 6–8 °C, so the price depends on how often an engine waits; that is why this stays a choice, not a default.

The client used for the Inkling cells
#!/usr/bin/env python3
"""One arm of the CUDA wait-mode A/B on an Inkling server: greedy decode at 1 and 4 streams, time to first token, reply
hashes, the server's CPU use and the hottest thermal zone.
    python3 sched_ab.py PORT SERVER_PID LABEL OUT.json
"""
import glob, hashlib, http.client, json, sys, threading, time

PORT, PID, LABEL, OUT = int(sys.argv[1]), int(sys.argv[2]), sys.argv[3], sys.argv[4]
PROMPTS = {
    "prose": "Write a calm, detailed walk through a coastal town at dawn: the harbour, the bakery, the fishing boats.",
    "code": "Write a Python function that merges overlapping intervals, with a docstring and three test cases.",
}
TOKENS = 512
TICK = 100


def zone():
    return max(int(open(z).read()) for z in glob.glob("/sys/class/thermal/thermal_zone*/temp")) / 1000


def cpu():
    f = open(f"/proc/{PID}/stat").read().rsplit(")", 1)[1].split()
    return (int(f[11]) + int(f[12])) / TICK


def ask(prompt):
    body = {"messages": [{"role": "user", "content": prompt}], "max_tokens": TOKENS, "temperature": 0, "stream": True,
            "stream_options": {"include_usage": True}}
    c = http.client.HTTPConnection("127.0.0.1", PORT, timeout=600)
    t0 = time.time()
    c.request("POST", "/v1/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"})
    r = c.getresponse()
    first, text, usage = None, [], None
    for line in r:
        line = line.strip()
        if not line.startswith(b"data: ") or line == b"data: [DONE]":
            continue
        d = json.loads(line[6:])
        if d.get("usage"):
            usage = d["usage"]
        for ch in d.get("choices", []):
            delta = ch.get("delta", {})
            piece = (delta.get("reasoning_content") or delta.get("reasoning") or "") + (delta.get("content") or "")
            if piece:
                first = first or time.time()
                text.append(piece)
    end = time.time(); c.close()
    n = usage["completion_tokens"]
    return {"prompt_tokens": usage["prompt_tokens"], "ttft": round(first - t0, 3), "decode_tps": round((n - 1) / (end - first), 2), "tokens": n,
            "sha": hashlib.sha256("".join(text).encode()).hexdigest()[:16]}


def main():
    ask("Say hi.")  # warm
    temps, stop = [], threading.Event()
    def sample():
        while not stop.is_set():
            temps.append(zone()); time.sleep(1)
    th = threading.Thread(target=sample); th.start()
    c0, t0 = cpu(), time.time()
    solo = {k: [ask(p) for _ in range(3)] for k, p in PROMPTS.items()}
    four = {}
    for k, p in PROMPTS.items():
        got = [None] * 4
        ts = [threading.Thread(target=lambda i=i: got.__setitem__(i, ask(p))) for i in range(4)]
        s = time.time()
        for t in ts: t.start()
        for t in ts: t.join()
        four[k] = {"replies": got, "aggregate_tps": round(sum(g["tokens"] for g in got) / (time.time() - s), 2)}
    longp = " ".join(["The river bends past the old mill, where the water slows and the reeds grow thick along the bank."] * 400)
    long = ask(longp + "\n\nIn two sentences, what is this text about?")
    cores = round((cpu() - c0) / (time.time() - t0), 2)
    stop.set(); th.join()
    r = {"label": LABEL, "solo": solo, "four": four, "long": long, "server_cores": cores, "zone_avg_c": round(sum(temps) / len(temps), 1),
         "zone_max_c": max(temps), "seconds": round(time.time() - t0, 1)}
    json.dump(r, open(OUT, "w"), indent=1)
    med = lambda xs: sorted(xs)[len(xs) // 2]
    for k in PROMPTS:
        print(f"{LABEL} {k}: x1 {med([x['decode_tps'] for x in solo[k]])} tok/s, ttft {med([x['ttft'] for x in solo[k]])} s, "
              f"x4 {four[k]['aggregate_tps']} tok/s, hashes x1 {sorted({x['sha'] for x in solo[k]})} x4 {sorted({x['sha'] for x in four[k]['replies']})}")
    print(f"{LABEL} long: ttft {long['ttft']} s, {long['decode_tps']} tok/s, hash {long['sha']}")
    print(f"{LABEL}: server {cores} cores, zone avg {r['zone_avg_c']} max {r['zone_max_c']} C over {r['seconds']} s", flush=True)


main()

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (The change is host scheduling only. Drafts are off in these cells because main's Inkling CUDA engine has no drafter. Concurrent equals solo above.)
  • No precision traded for speed. If the bits change, the description says which sums change and why. (No bits change.)
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled. Unset (the default) is main's path. Opting into blocking costs about 2% decode on Inkling, as measured above.

ZackSample added a commit to ZackSample/TensorFold that referenced this pull request Nov 26, 2026
@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you, @ZackSample.

CHANGES REQUESTED at b6825f0ee9966997a37dd0e2a5809f4cdfd16444.

The parser and placement are correct on the shared registry and MOSS paths. Unset or blank returns before any scheduling call, each accepted word maps to the existing driver flag, and the call precedes primary-context initialization at zig/src/native/cuda.zig:248-249 and zig/src/native/moss_image_host.zig:443-446. No launch, sampler, FP32 operation, or rounding path changes.

One scope defect remains. Startup validates TF_CUDA_SCHED for CUDA models at zig/src/native/cuda.zig:160-164, but Qwen3 returns at :173 and Drama, ZONOS3, Qwen4 and LFM2 dispatch through zig/src/native/cuda_open.zig:10-21 before the shared openWith call. Their context constructors do not apply the setting; examples are zig/src/families/qwen3/cuda/engine.zig:74-81, zig/src/native/qwen4_cuda.zig:17-25, and zig/src/native/lfm2.zig:172-178.

With TF_CUDA_SCHED=blocking, those servers accept the value but leave the driver's schedule unchanged, contrary to the general CUDA-server contract in docs/environment.md:28. Please either apply the helper before every served primary-context creation or narrow the accepted and documented scope to the paths that implement it.

The host parser checks do not establish driver delivery or output equality. The smallest subsequent device check should compare actual token IDs with the serial reference for every accepted word, plus one MOSS picture comparison on the two touched paths.

  • Synthena

@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thanks @ZackSample for adding a clear, validated CUDA scheduling switch. The generic CUDA and MOSS paths apply it, but Qwen3, Qwen4 and the other special-family openers return before that call and create their own contexts, so a valid setting is silently ignored for those models; please apply it before each special family's primary-context initialization.

  • Synthena

@ZackSample

Copy link
Copy Markdown
Contributor Author

Thanks. Applied before every served primary-context creation, in b657da0 on top of your 1189da4:

  • Qwen4 (qwen4_cuda.zig), LFM2 (lfm2.zig) and Drama (drama_limit.zig, whose context the Drama engines then retain) call cuda_schedule.apply on their own driver, just before Context.init.
  • Qwen3 (cuda_qwen3.zig) and ZONOS3 (zonos_open.zig) open their driver inside their family modules, so cuda_schedule.hold sets the schedule through a driver of its own. That driver stays open until the engine's open returns, and is null when the setting is unset.
  • DeepSeek V4.1 keeps its existing reader in dev_arena.zig.

Device check

Each arm is one fresh server with TF_CUDA_SCHED unset, auto, spin, yield or blocking, on a GB10 (sm_121), driver 580.178.04.

  • Inkling 2 Mini Derisked, the shared open, --parallel 4 --context 65536 --no-drafts.
    • Requests: "draft": false, "return_token_ids": true, greedy, 256 tokens each.
    • One prose and one code reply alone, then four concurrent copies of the prose prompt.
  • MOSS-Image: one 1024² picture, 8 steps, seed 42.
  • Drama 3 NVFP4-Pruned, its own open: one /v1/audio/speech WAV, seed 7, built-in voice.

The check fails unless every arm's outputs equal the unset arm's, and every set word appears in that server's cuda schedule: log line.

Model Output unset auto spin yield blocking
Inkling token IDs, prose, 1 stream (256) 3c25c21a2f59b730 same same same same
Inkling token IDs, code, 1 stream (256) f6ef4bf99ae79fe2 same same same same
Inkling token IDs, prose, each of 4 concurrent 3c25c21a2f59b730 ×4 same same same same
MOSS PNG SHA-256 d3131544…a7d (main's reference) same same same same
Drama WAV SHA-256 6bff0f15…2781 same same same same
Server CPU, Inkling / MOSS / Drama, cores 1.00 / 0.99 / 1.00 1.00 / 1.00 / 1.00 1.00 / 1.00 / 1.00 1.00 / 1.00 / 1.00 0.42 / 0.06 / 0.07
  • What the CPU column shows: each server applied the word it logged. blocking frees the spinning core on all three paths, and yield stays busy on the core, as it should.
  • Hashes: token IDs are the first 16 hex digits of the SHA-256 of the JSON ID array. Full hashes and per-arm logs are kept.
  • Negative control: the head before this commit (1189da4's code), on Drama with blocking, accepts the value but logs no schedule and keeps 1.00 core. The check exits 1 there.

Not run

  • Qwen3, Qwen4, LFM2 and ZONOS3: I have none of those checkpoints. So the hold path (Qwen3 and ZONOS3) has not run on a device, and the Qwen4 and LFM2 apply calls are compile- and host-checked only.
  • Other SMs. Metal, HIP and XPU are untouched.

Checks on b657da0

  • zig build test-environment-host test-env-defaults-host -Dfixed-cpu: 36 pass; 47 pass and 1 skip; 103 pass.
  • zig build test test-golden -Dfixed-cpu: 924/924 steps, 13,601 of 13,706 tests pass and 105 skip.
  • python3 tools/zig/lean_check.py: 123 on 1189da4 and 123 on this head, 0 new.
  • zig fmt --check build.zig zig and git diff --check pass.
  • The device check ran a build of this tree before one doc comment in cuda_schedule.zig was shortened for the lean checker. That edit touches no code.
The device check
#!/usr/bin/env python3
"""TF_CUDA_SCHED device check: each word (and unset) on one server per arm; token IDs, picture bytes or audio bytes must
equal the unset arm's, and each set word must be logged by the server. Exits nonzero on any difference.
    python3 device_check.py BINARY OUT {inkling|moss|drama} [words...]
"""
import base64, hashlib, http.client, json, os, subprocess, sys, threading, time
from pathlib import Path

HOME = Path.home()
PORT = 8891
TICK = os.sysconf("SC_CLK_TCK")
MODELS = {
    "inkling": [str(HOME / "models/inkling-2-mini-derisked"), "--parallel", "4", "--context", "65536", "--no-drafts"],
    "moss": [str(HOME / "models/moss-image-base"), "--name", "moss-image"],
    "drama": [str(HOME / "models/drama-3-NVFP4-Pruned"), "--name", "drama-3"],
}
PROSE = "Write a calm, detailed walk through a coastal town at dawn: the harbour, the bakery, the fishing boats."
CODE = "Write a Python function that merges overlapping intervals, with a docstring and three test cases."
FOX = "A red fox standing in a misty birch grove at dawn, soft golden light through the trees, photorealistic, sharp detail in the fur."
SPEECH = "The lighthouse keeper climbed the stairs."


def post(path, body, timeout=900):
    c = http.client.HTTPConnection("127.0.0.1", PORT, timeout=timeout)
    c.request("POST", path, json.dumps(body).encode(), {"Content-Type": "application/json"})
    r = c.getresponse(); raw = r.read(); c.close()
    if r.status != 200:
        raise SystemExit(f"{path} HTTP {r.status}: {raw[:300]!r}")
    return raw


def chat(prompt):
    body = {"messages": [{"role": "user", "content": prompt}], "max_tokens": 256, "temperature": 0, "draft": False, "return_token_ids": True}
    ids = json.loads(post("/v1/chat/completions", body))["tensorfold"]["token_ids"]
    return hashlib.sha256(json.dumps(ids).encode()).hexdigest()[:16] + f" ({len(ids)} ids)"


def work(model):
    if model == "inkling":
        out = {"prose x1": chat(PROSE), "code x1": chat(CODE)}
        got = [None] * 4
        ts = [threading.Thread(target=lambda i=i: got.__setitem__(i, chat(PROSE))) for i in range(4)]
        for t in ts: t.start()
        for t in ts: t.join()
        out.update({f"prose x4 #{i}": g for i, g in enumerate(got)})
        return out
    if model == "moss":
        b = {"model": "moss-image", "prompt": FOX, "size": "1024x1024", "steps": 8, "guidance": 1, "seed": 42, "response_format": "b64_json"}
        return {"fox": hashlib.sha256(base64.b64decode(json.loads(post("/v1/images/generations", b))["data"][0]["b64_json"])).hexdigest()}
    b = {"model": "drama-3", "input": SPEECH, "response_format": "wav", "seed": 7}
    return {"speech": hashlib.sha256(post("/v1/audio/speech", b)).hexdigest()}


def cpu(pid):
    f = open(f"/proc/{pid}/stat").read().rsplit(")", 1)[1].split()
    return (int(f[11]) + int(f[12])) / TICK


def arm(binary, out, model, word):
    log = out / f"{model}-{word}.log"
    env = dict(os.environ, TF_CUDA_SCHED="" if word == "unset" else word)
    p = subprocess.Popen([binary, "serve", "--host", "127.0.0.1", "--port", str(PORT), "--no-update-check", *MODELS[model]],
                         env=env, stdout=open(log, "w"), stderr=subprocess.STDOUT)
    try:
        for _ in range(300):
            if p.poll() is not None:
                raise SystemExit(f"{model} {word}: server exited\n" + log.read_text()[-2000:])
            try:
                c = http.client.HTTPConnection("127.0.0.1", PORT, timeout=2); c.request("GET", "/v1/models"); c.getresponse().read(); c.close(); break
            except OSError:
                time.sleep(3)
        c0, t0 = cpu(p.pid), time.time()
        r = work(model)
        cores = round((cpu(p.pid) - c0) / (time.time() - t0), 2)
    finally:
        p.terminate(); p.wait()
    logged = [l.split("cuda schedule: ", 1)[1].strip() for l in log.read_text().splitlines() if "cuda schedule: " in l]
    rec = {"model": model, "word": word, "outputs": r, "server_cores": cores, "logged": logged}
    print(json.dumps(rec), flush=True)
    time.sleep(10)
    return rec


def main():
    binary, out, model = sys.argv[1], Path(sys.argv[2]), sys.argv[3]
    words = sys.argv[4:] or ["unset", "auto", "spin", "yield", "blocking"]
    out.mkdir(parents=True, exist_ok=True)
    recs = [arm(binary, out, model, w) for w in words]
    (out / f"{model}.json").write_text(json.dumps(recs, indent=1))
    ref, bad = recs[0]["outputs"], []
    for r in recs:
        if r["outputs"] != ref:
            bad.append(f"{r['word']}: outputs differ from {recs[0]['word']}")
        want = [] if r["word"] == "unset" else [r["word"]]
        if r["logged"][:1] != want:
            bad.append(f"{r['word']}: server logged {r['logged']}")
    if model == "inkling" and len({v for k, v in ref.items() if k.startswith("prose")}) != 1:
        bad.append("inkling: a concurrent reply differs from the solo one")
    print(f"{model}: " + ("PASS, every arm equals " + recs[0]["word"] if not bad else "FAIL\n  " + "\n  ".join(bad)), flush=True)
    sys.exit(1 if bad else 0)


main()

@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you for extending the setting to each special family's primary-context path and for the detailed Inkling, MOSS, and Drama checks. The placement now covers the scope I asked about.

One default-path regression remains in the two hold call sites. TF_CUDA_DEVICE accepts the full u32 range, but cuda_qwen3.zig:33 and zonos_open.zig:72 evaluate @intCast before hold can return null for unset or blank scheduling. An ordinal above c_int, such as 4294967295, can therefore trap instead of reaching the existing device refusal even when TF_CUDA_SCHED is off.

Please pass the u32 ordinal into hold, perform its unset/blank return first, and only then use std.math.cast before opening the temporary driver. Removing the caller-side casts at both sites is the smallest fix. A boundary regression for unset and blank, plus an opt-in overflow refusal, would protect the off path.

After that, the remaining device coverage is Qwen3 and ZONOS3 through hold, and Qwen4 and LFM2 through apply, with exact consumer outputs against unset for every accepted word.

  • Synthena

@ZackSample

Copy link
Copy Markdown
Contributor Author

Thanks. Fixed in d455dbf:

  • cuda_schedule.hold now takes the u32 ordinal. With TF_CUDA_SCHED unset or blank it returns null before it reads the ordinal.
  • With the setting on, it casts the ordinal with std.math.cast. An ordinal past c_int is refused with error.NoSuchCudaDevice before any driver opens. That is the same refusal the ZONOS3 and Drama engines use.
  • cuda_qwen3.zig and zonos_open.zig pass the ordinal unchanged. Their @intCast calls are gone.
  • New host test in cuda_schedule.zig:
    • Unset, "" and " " return null at maxInt(u32) and at maxInt(c_int) + 1.
    • Every registered word is refused at both ordinals.

Checks on d455dbf

  • zig build test-environment-host test-env-defaults-host -Dfixed-cpu: 48 pass and 1 skip (the new test is the 48th).
  • zig build test test-golden -Dfixed-cpu: 924/924 steps succeed; 7,096 of 7,165 tests pass and 69 skip. Zig reused its cached results for the modules this change does not touch.
  • python3 tools/zig/lean_check.py: 123 problems, the same as 1189da4, 0 new.
  • zig fmt --check build.zig zig and git diff --check pass.

Device coverage for Qwen3, ZONOS3, Qwen4 and LFM2

I'm going to leave these out. I don't have any of those checkpoints, and I won't download four model families to cover an opt-in switch. With the setting unset, those paths do the same as before: hold returns null before it touches the ordinal or a driver, and apply returns before setSchedule.

The device check script in my previous comment takes a model table, so anyone who has those checkpoints can add an entry and run it. I'm also happy for this to land with those four marked host-checked only, or for the PR to be narrowed to the families that were run on a device (shared CUDA open, MOSS, Drama), whichever you prefer.

ZackSample and others added 4 commits November 27, 2026 03:40
Unset keeps the driver's auto schedule, which spins one host core per server
on a GB10. The setting is registered in platform/environment.zig (auto, spin,
yield or blocking, refused by name otherwise) and applied to the primary
context before the shared CUDA open and the MOSS image host create it.
Qwen3, Qwen4, LFM2, Drama and ZONOS3 open their own CUDA contexts before the
shared open, so a valid TF_CUDA_SCHED was accepted and then ignored for them.
Qwen4, LFM2 and Drama's device limit apply it on their own driver; Qwen3 and
ZONOS3, whose engines open the driver inside their family modules, hold one
with the setting until the engine's context starts.
…F_CUDA_SCHED is off

An ordinal past c_int is refused (NoSuchCudaDevice) only when the setting is on, before a driver opens; unset and
blank return null whatever the ordinal. The Qwen3 and ZONOS3 call sites pass the ordinal unchanged. Host regression
for both.
@ashhart
ashhart merged commit 5594368 into ashhart:main Nov 27, 2026
2 of 12 checks passed
@ashhart

ashhart commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Thank you @ZackSample. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

ashhart added a commit that referenced this pull request Nov 28, 2026
Five PR numbers were swapped between items (Idol #1787, TF_CUDA_SCHED
#5165, TF_Q35_DFLASH_TRACE #5253, the DSpark draft head #5020, GLM draft
head synthesis #4253; the Engram kernels #5087 and the router and row
helpers #5099 described separately). 1.3.6
shipped sm_80/86/120/121, so sm_110 is the only new architecture. The
#5456 workaround is 1.3.5 (1.3.6 is untested against it), the GB10
DFlash 2 cost is about 2%, and the confidential, draft-window and
sharded-checkpoint wording now matches the code.
ashhart added a commit that referenced this pull request Nov 30, 2026
Five PR numbers were swapped between items (Idol #1787, TF_CUDA_SCHED
#5165, TF_Q35_DFLASH_TRACE #5253, the DSpark draft head #5020, GLM draft
head synthesis #4253; the Engram kernels #5087 and the router and row
helpers #5099 described separately). 1.3.6
shipped sm_80/86/120/121, so sm_110 is the only new architecture. The
#5456 workaround is 1.3.5 (1.3.6 is untested against it), the GB10
DFlash 2 cost is about 2%, and the confidential, draft-window and
sharded-checkpoint wording now matches the code.
@ZackSample
ZackSample deleted the cuda-sched-servers branch December 2, 2026 03:28
ashhart added a commit that referenced this pull request Dec 2, 2026
Five PR numbers were swapped between items (Idol #1787, TF_CUDA_SCHED
#5165, TF_Q35_DFLASH_TRACE #5253, the DSpark draft head #5020, GLM draft
head synthesis #4253; the Engram kernels #5087 and the router and row
helpers #5099 described separately). 1.3.6
shipped sm_80/86/120/121, so sm_110 is the only new architecture. The
#5456 workaround is 1.3.5 (1.3.6 is untested against it), the GB10
DFlash 2 cost is about 2%, and the confidential, draft-window and
sharded-checkpoint wording now matches the code.
ashhart added a commit that referenced this pull request Dec 2, 2026
Five PR numbers were swapped between items (Idol #1787, TF_CUDA_SCHED
#5165, TF_Q35_DFLASH_TRACE #5253, the DSpark draft head #5020, GLM draft
head synthesis #4253; the Engram kernels #5087 and the router and row
helpers #5099 described separately). 1.3.6
shipped sm_80/86/120/121, so sm_110 is the only new architecture. The
#5456 workaround is 1.3.5 (1.3.6 is untested against it), the GB10
DFlash 2 cost is about 2%, and the confidential, draft-window and
sharded-checkpoint wording now matches the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants