Repository navigation
core: sixteen host bf16 copies are bf16_round's, identical on all 2^32 inputs - #1864
Conversation
447dab9 to
ec1a465
Compare
|
Thanks @jschmied. This is ready to land on our side: our gate passes on current main, and a GB10 run on Qwen3.8-27B gave identical prompt tokens in all 20 rows. For the record, the speed cells read slightly lower (2K prefill 1438.6 to 1381.0 tok/s, decode 24.7 to 24.6). That run used our older base, new, new, base order, where base's first server is always fastest: base's own two runs were 1459 and 1418. The change only touches load-time host copies, so we read it as order noise, not a slowdown. It's still marked as a draft, though, so GitHub won't let us merge it. If it's finished, could you mark it ready for review? We'll land it on the next cycle. The same goes for #1853, once our Gemma run on it finishes. |
…eps the replaced spelling
ec1a465 to
a3d97d5
Compare
|
Thank you @jschmied. 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. |
|
Thanks @jschmied! This is in TensorFold 1.2.2, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.2 |
Part of #1863. Sixteen host fp32 → bf16 copies, in 14 files, become aliases of
core/bf16_round.zig. Each is identical tobits()/round32()on all 2^32 fp32 inputs (checked exhaustively in ReleaseFast), so no word changes. The callers don't change.contract/contract.zigtoBf16../bf16_round.zigtoBf16incuda_{mix,prompt_wt,attn,embed,qmm,ple,hc,gdn,moe}.zig,roundBf16incuda_mix.zigandcuda_hc.zig(→round32)@import("core")glm/cuda_weights.zigtoBf16,tests/cuda/glm_loader_gate.zigbf16corethey already importnamed.zigbf16Round@import("core")rounding_bound.zigbf64(f64 → f64, =core.bf16; also on 2^26 random f64 words)core.contract.bf16_round, which the host, Metal and CUDA facades all exportTests kept in the tree (the exhaustive run is about 1.2 s a copy in ReleaseFast, minutes in Debug):
core/bf16_round.zigkeeps the replaced spelling verbatim and compares it withbits()on all 2^25 words with exponent 0 or 255 (every zero, subnormal, infinity and NaN), every tie with both neighbours, and 2^20 random words: 1.8 s in Debug. Planted controls: without the NaN branch it fails at the first NaN (0x7f80for0x7fc0); with ties rounded away it fails at the first subnormal tie.qwen4/rounding_bound.zigkeeps the oldbf64and compares it with core's by f64 bits on every fp32 tie and its neighbours, the fp32 edges, and 2^20 random f64 words.Ten more copies are identical but don't move here, because their files can't reach
corewithout build changes:fabric/(no imports),living/affine.zig(core imports living),core/affine4_host.zigandcore/quant/convert.zig(the relative import collides with thecontractmodule), and four Metal-only files. I can list the change each would need.Checks (GB10): lean 0 new,
zig build testand the CI set pass,git diff --checkclean.