Skip to content

Sync upstream v1.3.0 into the fork - #50

Merged
cursor[bot] merged 1384 commits into
mainfrom
sync-upstream-1.3.0
Nov 22, 2026
Merged

cursor[bot] merged 1384 commits into
mainfrom
sync-upstream-1.3.0

Conversation

@GarupanOjisan

Copy link
Copy Markdown
Owner

upstream(ashhart/TensorFold)の v1.3.0 タグ(d3d0bf110d57161edfbd20234a84833f14548b57)を、このフォークの main(477c4604、v1.2.7 の取り込み)へ merge commit で取り込みました。rebase も squash もしていません。上流 ashhart/TensorFold へは push も PR もしていません。

Closes #48
Closes #47
Closes #46
Closes #41
Closes #39
Closes #37
Closes #35
Closes #49
Closes #40
Closes #38
Closes #36

取り込んだ主な変更

v1.2.7(93a2e93e)から v1.3.0(d3d0bf11)までの 1,383 コミットです。v1.2.8、v1.2.9、v1.2.10 を含みます。マージコミットは 6c53bc1d で、親はフォークの main 477c4604 と上流の d3d0bf11 です。

#48 がこの取り込みの対象です。そこに書かれた、マージ済みの変更は v1.3.0 に入っています。

#46 の v1.2.9、#41 の v1.2.6、#39 の v1.2.5、#37 の v1.2.3、#35 の v1.2.2 は、どれも v1.3.0 より前の版が目標です。#35・#37・#39・#41 に書かれた変更は v1.2.7 の取り込み(#45)で既に main にあり、#46・#47 の変更は今回の範囲に入ります。

DeepSeek-V4.1-Flash の参考 Issue も、土台として求めていた変更が v1.3.0 に入っています。

各 Issue の「実機で測る」「コンテナを作って確かめる」は、コードの取り込みとは別の作業です。Issue 本文が求めているコードは v1.3.0 に揃うので、Closes から外したものはありません。

GLM の既定値の変化

長いプロンプト向けに、既定がオンになる設定が2つあります。どちらも =0 で前の動きに戻せます。トークンは変わらない、とリリースノートにあります。

--reasoning-effort(ashhart#3017、v1.2.9): thinking off の要求は、その要求が指定した effort をチャットテンプレートに渡します(GLM の先頭もそれに従い、返答にも出ます)。サーバー起動時の --reasoning-effort は、thinking off のプロンプトを変えなくなります。

--mtp-confidence(ashhart#2864、v1.2.8): フラグ自体の既定はオフのままです。MTP ヘッドと一緒に付けたとき、温度 0 のストリームは毎ラウンド 15 段の連鎖をドラフトするのではなく、受理率に見合う深さだけドラフトします。信頼度の床は、窓が検証するものをこれまでどおり切ります。--mtp-confidence 0.5 で、2台の GB10・TP=2 の1本が code で 16%、chat で 28% 速く、返答は変わらない、とリリースノートにあります。

ほかに、既定で変わるもの:

衝突の解消

6ファイルが衝突しました。

ファイル 解消
web/tensorfold_web/data/native-version.json 上流は 1.2.10、フォークは 1.2.7 でした。build.zig.zon は 1.3.0 なので、{"version":"1.3.0"} にしました。web/ui/scripts/sync-theme.mjs が書き出す形と同じです。前回(#45)は 1.2.4 のまま残って Python の版テストが落ちました。
zig/src/server/root.zig フォークの extra_eos.zig と、上流の drafter_test.zig の両方をテストの一覧に残しました。
zig/src/server/server.zig 衝突はせず、TF_EXTRA_EOS の読み取りは extra_eos.withEnv のままです。import を呼び出し側に置き、600 行ちょうどにしました(上流は 600 行、import を足すと 601 行)。
zig/src/server/logprobs_test.zig 上流の 1024 行の logprob バッファと pub fn send を採用し、フォークの cuts 引数(引用された </think> のテスト)を残しました。
zig/src/native/copy_drafts_cuda_test.zig 上流の .floor_rates = !block(--mtp-confidence が深さで切る)と、フォークの .reply_match = 16 の両方を GLM の期待値に入れました。
zig/src/families/glm/cuda_exl3.zig 上流のプロンプト scratch(prompt_rows と top_k + 1、pick 用バイトを足さない)を採用し、フォークの half_bits(3-bit は融合プロンプト経路に入らない)を残しました。呼び出し側の zig/glm_exl3_prompt_host.zig と zig/tests/cuda/glm_exl3_tests.zig は 4-bit の 8 を渡します。

web.yml は衝突せず、PR #45 で固定したアクションのコミット SHA が残っています。app.yml・no-gpu.yml・pack-compare.yml・zig-fmt.yml も、フォークが上げた checkout / setup-node / setup-python の SHA を残し、上流が足したジョブの中身は入っています。タグ指定(@v7)のアクションは残っていません。

残したフォーク独自の変更は、前回と同じ範囲です。TF_EXTRA_EOS、TF_GLM_COPY_MAX / TF_GLM_COPY_REPLY_MATCH / TF_GLM_COPY_EXTEND(未設定の copy 上限は 31)、3-bit EXL3、lane core の reply_match・strong_match・strong_copy、RUNBOOK と GLM CUDA レシピの2台の節、workflow の SHA 固定です。

チェック

  • Head: 6c53bc1d2f3a13e5025172bbaf71385f9c11d192
  • zig fmt --check build.zig zig(Zig 0.17.0): 成功
  • lean check: この head 171 件、フォークの main 171 件、新しい指摘 0 件。上流 v1.3.0 単体は 168 件で、差の 3 件はフォークに元からある cuda_copy.zig の getenv 2 件と extra_eos.zig の TF_EXTRA_EOS 1 件です。
  • zig build -Dfixed-cpu test-glm-exl3-prompt-host test-exl3-prompt-host test-glm-copies-host test-logprob-offers-host: 7/7 テスト成功(GPU なしのホストテスト)
  • atc: この環境に CLI がなく、claim と overlap は実行していません。フォークにほかの open PR はありません。
  • 実機(DGX Spark)でのビルド、起動、速度の比較はしていません。

Stacked on

main

Open in Web Open in Cursor 

jayleaton and others added 30 commits November 19, 2026 08:01
Port Idol's denoiser from Metal to CUDA under the same precision contract:
fp16 block linears via cuBLASLt with fp32 sums and one rounding after the
bias (tf_idol_bias), LayerNorm32 to fp16 with fp16 modulation, true-fp32
RePo/condition/output projections (CUBLAS_COMPUTE_32F), and a head-64 fp16
attention with fp32 softmax and accumulation in its own image (idol.cu,
idol_attention.cuh), leaving prefill_attention.cu and its SASS untouched.

- family modules zig/src/families/idol/cuda*.zig; the model refuses any GPU
  but sm_120/sm_121 by name with a log line; timing via the sys shim
- tf-idol on CUDA (idol-cuda step) sharing the case driver with Metal
  (zig/tests/idol_run.zig)
- cuBLASLt Linear.initTyped for fp16 and fp32 inputs; bf16 path unchanged
- kernel contract: idol-contract (gates 1-4 over every idol.cu kernel and
  the attention, three controls dropping an fp16 rounding, in their own
  contract_idol_controls.cuh), Idol's set after joint_schema; nvcc 13.0
  records for sm_80/86/89/120/121 joined through idol_cuda_sets.zig beside
  MOSS-Image's in registry_joins.zig; image in contract_limits
- host tests for the family and the contract's range references, beside
  MiniMax's in cuda_family_host.zig
… in every order

The kernel sums P x V and l in fp32. With odd values up to 15, each strided fp16 lane stayed below 2048, where
fp16 integers are exact, so fp16 sums missed by only 0.3x (l's rounding). Odd values up to 255 push the lane sums
past 2048 while every fp32 partial sum stays an integer below 2^24. A host test runs gate 4's three orders.
…a_common_check asks

idol.cu, idol_attention.cuh and contract_idol_controls.cuh kept their own warp_sum, 8-warp block_sum and fp16 mma.
They now use tf_common::warp_sum (the same butterfly), tf_common::block_sum_serial (the same 8 adds in warp order
at Idol's 256 threads) and qmm_frag::mma_f16_v (the same volatile instruction). Under nvcc 13.0 every kernel but the
two norms and the norm control keeps its SASS byte for byte; the norms' sm_120 registers drop to 33 and 36.
The serving pins now run on every PR, and ashhart#1767 changes two pinned files:
cublaslt.zig gains Linear.initTyped (X and W as bf16, fp16 or fp32 for
Idol's denoiser; initEpilogue passes bf16, so existing plans are unchanged)
and kernels.zig registers the idol image.

test-gradient-serving: 1/1 pass.
…on sums P

The recipe still said no CUDA kernel of this family had run on a device.
It now quotes the idol-contract SUMMARY line from the GB10 (776a333,
and the same result on c3a6c0c) and from the RTX 5090 at sm_120
(f5b88dd), which also passed the shared synthetic case. A GB10 case run
is still to come.

The attention bullet notes that CUDA sums the softmax denominator over
fp32 P and rounds P to fp16 only for P.V, where Metal's id_attention
rounds P first and sums the rounded values.
… the recipe

zig/tests/cuda/main.zig was 600 lines on main and the idol-contract usage
and dispatch lines made it 602, so the gb10-grouped and qmm-prefill-tile22
contract modules are imported at their only dispatch lines, as idol's is.
The recipe gives GustavBlack's GB10 run at 05ab199 (nvcc 13.0: contract
13 of 13 with 3 of 3 controls red, synthetic case 100 of 100, blocks 0 all
23, identical repeat, 53.04 s for 50 steps; peak memory not yet recorded)
and says the 776a333 and c3a6c0c contract runs come before 3682840.
CHANGELOG gains the line for ashhart#1767.
…ch and the filled-item prompt grid, all failed (ashhart#1603)

Squashed from the PR's three commits (the middle one a merge of main) onto today's main, so it replays one commit at a time.
…e cache were used, requests overlapped

A gate that compares two replies passes vacuously when the property it names never ran. serve_check.py's
resumed == fresh still never asserted the resumed turn cached anything (Qwen 3.5 keeps prompts from 4,096
tokens; its chat was 23-201), and the kit, lfm3's serve_check and qwen27's HTTP gate had the same gap for
drafts, sampling, overlap or empty replies. Each check now fails by name when its property was not exercised.

- conformance: a reply without a token is unverified (two empty replies hash the same); drafted == plain
  needs a draft accepted in each mode and none drafted by the plain replies; repeat asks a sampled prompt
  with the next seed and needs a different reply; concurrent polls GET /v1/load during each batch and needs
  two chat requests open at once, and at each level drafted rows that accepted and plain rows that drafted none.
- zig/tests/qwen35/serve_check.py: compares token_sha256 (reasoning included, empty never equal); drafted ==
  serial needs drafts accepted and none in plain; t0.8 must differ from greedy; the resumed turn must resume
  tokens, and its first turn carries a 900-item document so a healthy Qwen 3.5 server does.
- tools/lfm3/serve_check.py: drafts/exercised and sampled_*/sampler_ran (tensorfold.sampling == "exact").
- tools/zig/qwen27_http_gate.py: a drafted reply must accept a draft, not only propose one.
- The fake served API gains the faults undrafted, plain_drafts, sampled_drafts, unsampled, serial and empty;
  each new test is red on main's scripts and green here (test_bench*.py, found by no-gpu.yml).
…s counts them

On windows-latest every gate test failed concurrent == solo: 1 to 4 of 16 batches never showed two chat requests
open at once. A request that found a partner stayed open a fixed 25 ms, and there a GET /v1/load read can take
longer than that, so the census missed the overlap. It now stays open until a census counts two open at once (at
most 2 s). With census reads slowed to 30 ms the old fake fails the clean run and the new one passes at 100 ms.
At 2b7a41c every pair waited up to 2 s for a census, also in the serve_check and lfm3 tests, which send requests
together without reading one; both benchmark-clients jobs passed the 5 min limit. A pair now waits to be counted
only while a census was read in the last 0.25 s (and at most that long); otherwise it stays open 25 ms as before.
The listen backlog is main's FixtureHTTPServer (ba970d9).
…uest's partner

windows-latest at 72b7117 still saw 1 to 3 of 16 concurrent batches never open two requests at once. The threads
a batch releases together can start a scheduler tick apart there (about 16 ms), past the fake's 10 ms partner
window, so a pair never formed. Staggering each post by 0 to 30 ms reproduces it on macOS (1 of 16, same line).
While a client polls the census (two reads within 0.1 s, the last that recent) a request now waits 60 ms for a
partner; elsewhere it waits 10 ms as before, and a counted pair waits at most 0.5 s. Posts staggered 0 to 50 ms:
the clean gate run passes 3 of 3. Full test_bench* set merged with main 2a674b5: 199 OK in 177 s (157 s at
72b7117).
…ired page

Sessions A and B have disjoint prompts of the same length and keep states at the same positions, so a lookup that
went by position alone would hand one the other's rows. On the rows fake (rows_fake.zig) and the snapshot fake
(prompt_cache_fake.zig), the test checks:

1. A's state is spilled to disk and dropped from RAM, then B is admitted: B's first turn prefills, its next turn
   resumes its own RAM state equal to a fresh pass of B's tokens, and A's spilled file is never read for B.
2. A's next turn then resumes A's spilled state from disk, equal to a fresh pass of A's own tokens.
3. After a page is retired and reused (A's spilled state and its blocks removed and another session's written; or
   A's dropped RAM storage left spare and taken by B's save), a lookup for A's prefix matches nothing, restores
   nothing and A prefills its own tokens.

All three pass on main. With the token comparison removed from Rows.matches, the spill test (1, 2) and the disk
retire test (3) fail; removed from the store's find, all three tests fail, the RAM page test (3) too. Tests only: no engine code changes.
…_sets.zig, giving registry.zig room

registry.zig sat at 600 lines, the source limit, so any PR adding a registry entry failed the lean check. The
cuda_sets table (the 13.2 and 13.3 usage overrides, 105 lines) moves unchanged into registry_cuda_sets.zig beside
the other registry_*.zig parts; registry.zig re-exports it under the same name and keeps Override, CudaSet, setFor
and usageFor. registry.zig is 496 lines. The registered records, sets and their order are unchanged.
…HIP list

The step parsers' tests in hip_serve/protocol.zig and the Flash Next and
Nemotron HIP workers ran only in an unfiltered zig build test with -Dhip=true,
which CI does not run. test-hip-followers-host runs them on the host modules
with inert kernels, and test-host-ci-linux-hip now includes it.
mrv777 and others added 25 commits November 19, 2026 18:16
…decimal digits ('{+0}', '{-0}', '{0_0}' are Python keyword names and are refused; '{00}' is index 0), with refusal and parity probes and the changelog line
…n pool, table and slots

A follower took the first page index, page ids, copy pages, snapshot slots, Flash Next's cache slot
and Nemotron's resume row from the link as given. A page index past its table, an id past its pool or
a slot far past its list could write out of bounds or grow host lists without limit. Each is now
checked against this rank's own counts first and refused with ShortMessage. The bounds admit every
value a rank 0 with the same options sends: pages from the table's end, ids in the pool, and the
lowest free slot, which is at most the follower's slot count.
…ough bfloat

tf_dsv41_attn_pre gives each simdgroup one row and two heads, so both heads' dots
use one load of each key. Keys come straight from device memory (no window tiles
or barriers), widen through the bfloat type, and a selected run's indices load
four at a time. Each key is one step: both dots, the pair-order butterfly, a
rescale of any head whose max rose, then each head's weight and sums, the steps
of tf_attn_update. Bits equal main's and the decode kernel's.
…-stream speed

`models` now reads the machine (chip, memory, GPU limit and memory bandwidth) and lists the chat checkpoints from README's model table that fit, largest first. Each line gives the memory the engine keeps (resident weights, any drafter and the 2 GiB runtime margin `info` reports) and a one-stream decode speed with drafts as shipped: measured on this chip, or estimated from the nearest measurement on the same backend, scaled by memory bandwidth. Under it is the command that installs it. `--all` adds what needs more memory, two machines or the other backend. `--json` keeps schema 1's cached checkpoints and adds `machine` and `catalog`. The cached checkpoints still print last.

The macOS GPU-limit rule and the chip bandwidth table move from cluster/node.zig to platform/machine.zig, which cluster now calls. The table gains the M5 family and the base and Pro chips, and the smaller-GPU Max configurations get their narrower buses.
…b's quality suite

tools/quality_suite.py runs the suite's 228 items (web/tensorfold_web/quality.py, digest d21a62442423) against a served model: one request at a time, greedy, thinking off when /v1/models says the off request works, scored by the Bench's own rules. It writes a receipt with every item's verdict. docs/receipts/quality-suite holds one receipt per checkpoint measured, each with its revision checked against the Hub. The catalog carries the passed and graded counts, and a host test checks each against its receipt. `tensorfold models` prints the share in a quality column, with `-` for checkpoints not rated yet, and `--json` gives each entry's quality object or null.
…s 192

The same revision (d9d758fb) on CUDA and on Metal: three GSM8K items differ where the backends' rounding takes a long greedy calculation down different tokens. The receipts README says the catalog cites one receipt per checkpoint and how close the backends come.
The copy served is revision f84b054c, whose config.json and five safetensors shards hash the same as 81169a9b, the revision the README pins; the catalog cites the receipt.
Thirteen Qwen 3.5 settings move to environment.zig rules with their names, defaults and clamps unchanged, so a
malformed value is refused at startup by name. The HIP admission's reserve and limit texts are registered there
too; their runtime bounds stay with the admission plan. Lean findings 337 to 316.
Its lone-stream copy pricing made Qwen3.8-27B with the DFlash2 drafter verify
more drafted rows that do not land on an M3 Ultra (108 rows for 54 accepted
drafts against 99 in 1.2.10): the same tokens, decode up to 3.7% slower on a
16K prompt. 1.3.0 keeps 1.2.10's lane code; ashhart#3728 returns once it is fixed.
Keep TF_EXTRA_EOS, the copy-window knobs, 3-bit EXL3 half_bits, and the
SHA-pinned workflows. native-version.json names 1.3.0, matching
build.zig.zon, and server.zig stays at 600 lines.

Co-authored-by: GarupanOjisan <GarupanOjisan@users.noreply.github.com>
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.

upstream の v1.2.5 と、その後の main(a067d8e9)に合わせる:#37 の目標を v1.2.3 から引き上げ、GB10 の L2 先読み #2162、2チャンクのプロンプト #1423、ツール呼び出しの修正 #2313、起動の打ち切り #2512 を入れる DeepSeek-V4.1-Flash を2台で試すときの土台を v1.2.3 に上げる(参考扱い):#36 の #2056 は v1.2.3 に入った。DSML のツール呼び出しのストリーム #2191 と、起動時の設定ログ #2206 を足す upstream の v1.2.3 と、その後の main(116a0d4c)に合わせる:#35 の目標を v1.2.2 から引き上げ、TP=2 の DFlash2 のタップ修正 #1623 と GB10 の読み戻し対策 #2103 を入れる DeepSeek-V4.1-Flash を2台で試すときの土台:v1.2.2(#35)に、TP>1 で保持状態の RAM 上限を全ランクにそろえる #2056 を足す(参考扱い、コンテナを作るとき用) upstream の v1.2.2(00e7dddb)に合わせる:読み込み後にページキャッシュを手放す #1884、ストリームのリーク修正 #1945、GLM の DFlash2 ドラフタのヘッダー検査 #1904 を入れる
DeepSeek-V4.1-Flash を2台で試すときの土台を v1.2.5 に上げる(参考扱い):TP=2 で NVMe からの会話の復元を直す #2182、エンコーダーとプロンプトをそろえる #2193(#2141 を解決)、TF_DSV41_* の設定の検査 #2379 upstream の v1.2.6(6e9af930)に合わせる:#39 の目標を v1.2.5 から引き上げ、GLM の検証窓を 32 行に広げる #2257(2台の GB10 で code デコード +32%)と多エージェントのキャッシュ #2699 を入れ、DFlash2 の 4 本同時の遅れ #2720 を #2793 で防ぐ upstream の v1.2.9(2ba55ec7)に合わせる:v1.2.7 の取り込み(#45)の次。GLM の MTP の深さを当たり具合で決める #2864(2台の GB10・TP=2 で1本 +16〜28%)、EXL3 のプロンプトのエキスパートを1回で回す #2852(#2819 を解決)、thinking off のプロンプトに --reasoning-effort が効かなくなる #3017 が入る thinking のまま終わった返答が空になる不具合の修正(upstream #3699、#3687 を解決)を取り込む:GLM をエージェントから使うと、think を閉じずに終わったターンの答えが空で返り、ログにも出ない upstream の v1.3.0(d3d0bf11)に合わせる:#46 の目標を v1.2.9 から引き上げる。#47 の #3699 は v1.2.10 に入った。コードの中のツール記法を実行しない #3588、画像処理中に他ランクが通信のタイムアウトで止まらない #3675、TF_ROCE などを変えたときのドラフト窓の表の修正 #3495 が入る