Skip to content

flashnext: check TF_FLASHNEXT_SPLIT_DENSE and TF_FLASHNEXT_SHARD_HEAD at load - #3749

Merged
ashhart merged 2 commits into
ashhart:mainfrom
devopsfortunato:flashnext-split-head-env
Nov 20, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
devopsfortunato:flashnext-split-head-env

Conversation

@devopsfortunato

@devopsfortunato devopsfortunato commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Before: TF_FLASHNEXT_SPLIT_DENSE and TF_FLASHNEXT_SHARD_HEAD were read with a raw std.c.getenv and a hand-written 0/1 check. Empty text was refused as a bad value, and nothing checked either one at load. After: both have .flag rows in platform/environment.zig's table and their readers parse through environment.value. A malformed value is refused by name when the engine loads, before device work, and empty or whitespace-only text reads as unset. Valid values (0, 1), defaults (split on, head shard off) and the family error tags (BadDenseSplit, BadHeadSharding) are unchanged.

Checks on this head

  • Head commit: 82f3be3
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 221 on the base, 221 on this head, 0 new (via python3 tools/pr_check.py --base upstream/main).
  • Tests run, with the command and pass, fail and skip counts:
    • zig build -Dfixed-cpu test-environment-host test-flashnext-compose-host -j2: test-environment-host 27 pass, 0 fail, 0 skip; test-flashnext-compose-host 41 pass, 0 fail, 0 skip.
    • The same command with only the production hunks reversed (the two table rows and the two reader bodies), new tests kept: test-environment-host 24 pass, 2 fail, 1 crash (the 33-row count, the scope refusal, and the per-switch test, which panics with "unregistered strict environment parser"); test-flashnext-compose-host 38 pass, 3 fail (both dense split tests and the head reader test).
    • zig build -Dfixed-cpu test-gradient-serving: 1 pass, 0 fail, 0 skip.
    • zig fmt --check build.zig zig and git diff --check: clean.
  • CI: on the first head, all checks passed except zig, whose only failing step was test-gradient-serving: cuda_head.zig is pinned by its bytes in zig/tests/fixtures/gradient-serving.tsv. This head updates that one row to the new hash, with a reason column (the same kind of update as Flash Next CUDA: validate chunk settings through the shared startup parser #3308's for cuda_lanes.zig). cuda_dense_split.zig and environment.zig are not pinned.
  • Not run, and why: the whole zig build -Dfixed-cpu test-cuda-host did not finish here; the host has 4 ARM cores and was shared with other builds. In the part that ran, some unrelated test binaries were reported failed with no assertion text; rerun on their own, both binaries checked passed (43/43 and 15/15). In the same run, three DeepSeek V4.1 encoder fixture prompt hashes (zig/src/server/fixtures/deepseek_v41_encoder/) did not match; this change doesn't reach that code. CI runs the full suite.

Receipt

n/a: the change only touches how two load-time switches are parsed. No arithmetic, kernel, graph or token path changes, and with a valid or unset value the engine takes the same branches as before.

  • Main against branch: n/a, as above. With a valid or unset value each reader returns what it returned before; the host tests above check that.
  • Boxes it reaches: CUDA Flash Next load at --tp 2 (dense split and head shard). The Flash Next scope check also runs on a Metal load (flashnext: refuse a malformed TF_FLASHNEXT_* setting by name before device work #2585), so a malformed value of either now stops a Metal load as well.
  • New switch? No. Both switches already existed; defaults and accepted values are unchanged (0 or 1; split on, head shard off). There is no profile row.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: af9777b base, Zig 0.17.0, Linux aarch64 host, no GPU, no checkpoint (host tests only).
  • Paths and platforms the change reaches, which I ran and which I could not: cuda_dense_split.zig setting/enabled/applies (the world-1 path still never reads the setting), cuda_head.zig setting/enabled, and env_validate.zig's .flashnext scope check, all covered by the host tests above. No CUDA or Metal device run.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: n/a, no token path changes.
  • Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): n/a, no device here and no token path changes.
  • Decode speed before and after, from tools/bench_openai.py: n/a, the readers run once at load.
  • Prompt speed before and after: n/a, the change cannot reach prompt processing.
  • Licence of any new weights or drafter, or "n/a": n/a.

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.

@devopsfortunato
devopsfortunato force-pushed the flashnext-split-head-env branch 2 times, most recently from d441f0b to 82f3be3 Compare November 18, 2026 07:49
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks @devopsfortunato. The shared parser preserves valid values and defaults, and the reader and scope regressions cover the intended change. Ready to land after applying the correct head-source pin while retaining current main's neighboring fixture row; that is the only apply conflict.

  • Synthena

devopsfortunato and others added 2 commits November 20, 2026 02:11
… at load

Both switches gain rows in the strict environment table and their readers parse through it: a malformed value is refused by name before device work, blank text reads as unset, and valid values and defaults are unchanged. Part of ashhart#2370.
@ashhart
ashhart force-pushed the flashnext-split-head-env branch from 82f3be3 to c05cdbe Compare November 20, 2026 02:11
@ashhart
ashhart merged commit 90191f7 into ashhart:main Nov 20, 2026
2 of 11 checks passed
@ashhart

ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thank you @devopsfortunato. 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.

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