Repository navigation
Sync upstream v1.3.0 into the fork - #50
Merged
Merged
Conversation
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.
…g on, with its GPQA Diamond result (ashhart#3323)
… positive to replace the flag (ashhart#3373)
…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.
…ttention.zig within 600 lines
…r fields are refused by name
…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>
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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で、親はフォークの main477c4604と上流のd3d0bf11です。#48 がこの取り込みの対象です。そこに書かれた、マージ済みの変更は v1.3.0 に入っています。
/v1/messages・/v1/responsesで空にせず、その文字を答えとして返す。トークン ID とtoken_sha256は変わらない。thinking のまま終わった返答が空になる不具合の修正(upstream #3699、#3687 を解決)を取り込む:GLM をエージェントから使うと、think を閉じずに終わったターンの答えが空で返り、ログにも出ない #47 の件で、cherry-pick は不要です。TF_ROCE・TF_GLM_DSEL・TF_GLM_PDL・TF_GLM_KDA_PADごとに分ける。TF_GLM_L2PFの先読みが、MoE 層の共有エキスパートの gate-up も読む。TF_KV_SHAREを使い--prompt-cache-gibを指定しないとき、保持できる状態の数が少なくなる不具合の修正。#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 に入っています。
TF_DSV41_*の検査 DeepSeek-V4.1 on CUDA: refuse a malformed TF_DSV41_* setting by name before loading, and register the ones that change outputs ashhart/TensorFold#2379・DeepSeek settings: MHC_DEFER and COEF_LATE refuse "no" (follow-up to #2379) ashhart/TensorFold#2516 は v1.2.4 / v1.2.5 に入っています。--prompt-cache-gibを TP>1 の全ランクの保持状態の上限にする)は v1.2.3 に入っています。deepseek: bound index scratch before planning and pricing ashhart/TensorFold#1681・deepseek: list the forward's 2,048-row prefill variants under TF_DSV41_PF_4K ashhart/TensorFold#1683・deepseek_v41: Pack.open reads a shard's header length with core's headerSize ashhart/TensorFold#1903 は v1.2.1 / v1.2.2 です。各 Issue の「実機で測る」「コンテナを作って確かめる」は、コードの取り込みとは別の作業です。Issue 本文が求めているコードは v1.3.0 に揃うので、Closes から外したものはありません。
GLM の既定値の変化
長いプロンプト向けに、既定がオンになる設定が2つあります。どちらも
=0で前の動きに戻せます。トークンは変わらない、とリリースノートにあります。TF_GLM_INDEX_CUDA(glm cuda: TF_GLM_INDEX_CUDA's kernels by default, 0 keeps tf_glm_scores ashhart/TensorFold#3159、v1.2.9): プロンプトが index 用の CUDA カーネルを既定で使います。0はtf_glm_scoresのままです。GB10・TP=2 では 1,000,000 トークンの cold なプロンプトの最初のトークンが 6.7% 早く、短いプロンプトは前後約 2% 以内です。TF_GLM_DSEL(GLM-5.3-Flash on CUDA: a decode window's DSA select on many CTAs ashhart/TensorFold#2722、v1.2.9): decode 窓の DSA の選択が、1行を1ブロックで行う代わりに多くのブロックに広げます。0は1ブロックのままです。4台の GB10・TP=4 で、1,040,384 トークンのプロンプトのあとの decode が 1/4/8 本で 5.05%/9.36%/11.36% 短くなっています。--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% 速く、返答は変わらない、とリリースノートにあります。ほかに、既定で変わるもの:
TF_GLM_L2PFがオンのとき(レシピの既定)、共有エキスパートの gate-up も先読みします(glm cuda: the L2 prefetch's ffn-head site also reads a MoE layer's shared gate-up, after its router ashhart/TensorFold#3156)。TF_CACHE_EVICT=decayed_resumeとTENSORFOLD_REQUEST_JOURNALは、設定しないかぎりオフのままです。衝突の解消
6ファイルが衝突しました。
web/tensorfold_web/data/native-version.jsonbuild.zig.zonは 1.3.0 なので、{"version":"1.3.0"}にしました。web/ui/scripts/sync-theme.mjsが書き出す形と同じです。前回(#45)は 1.2.4 のまま残って Python の版テストが落ちました。zig/src/server/root.zigextra_eos.zigと、上流のdrafter_test.zigの両方をテストの一覧に残しました。zig/src/server/server.zigTF_EXTRA_EOSの読み取りはextra_eos.withEnvのままです。import を呼び出し側に置き、600 行ちょうどにしました(上流は 600 行、import を足すと 601 行)。zig/src/server/logprobs_test.zigpub 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.zigprompt_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 固定です。チェック
6c53bc1d2f3a13e5025172bbaf71385f9c11d192zig fmt --check build.zig zig(Zig 0.17.0): 成功cuda_copy.zigの getenv 2 件とextra_eos.zigのTF_EXTRA_EOS1 件です。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 はありません。Stacked on
main