Repository navigation
idol: the octree and Gaussian decoders on CUDA (stacked on #1773, #1767; not yet run on a GPU) - #1858
Conversation
|
Thanks @jayleaton. Sharing the host steps and one |
da5e1bd to
96b9ac4
Compare
96b9ac4 to
0f77798
Compare
|
#1773 and #1767 are both on main now, so I rebased this onto main
Host checks (Linux): |
b7d49e1 to
0b8f39c
Compare
|
Independent check on The trial merge against Igor Lessio - AIFLOW LABS |
0b8f39c to
9e6f0d0
Compare
|
Rebased onto main
Host checks (Linux x86-64), all passing:
@ashhart, we can't get time on a GB10, so yes please to your offer. The open receipts are the |
|
Thanks for the rebase. While it was in flight I ran the decoder contract on the previous public head Linux x86-64, GeForce RTX 5090 Laptop GPU (SM 12.0, driver 595.99.02), Zig 0.17.0, nvcc 13.1.115. The tiled I isolated output 73111, query row 71, head 6, channel 23, using the contract's This isolates a rounding-order difference on the failing fixture. If tiled rounding is the intended contract, the reference should simulate the tile maxima and the matching midpoint allowance. The GB10 run and release-checkpoint parity are still needed to decide which behavior to keep. Igor Lessio - AIFLOW LABS |
9e6f0d0 to
b8db377
Compare
b8db377 to
fc6b95f
Compare
… pending) Port Idol's decoders from Metal to CUDA under the same precision contract, sharing the host steps (decode.zig now takes either decoder) and the case driver (tf-idol-decode: idol_decode_run.zig, thin Metal and CUDA mains; the Metal tool's gate lines, JSON and PLY are unchanged on both Mac cases). - idol_decoder.cu: dec_embed, dec_half, dec_kv, dec_heads (MultiHeadRMSNorm in place, NaN norm kept), the tiled cross attention (full<64, 8>'s row arithmetic from query rows to the latent's keys, P rounded to nearest fp16 as torch's CUDA kernels do) and the fp32 short form for <= 8 query rows; each a template whose BREAK 0 ships - self attention reuses idol.cu's tf_idol_attention; blocks reuse its cuBLASLt fp16 linears, norms and gated adds; stem and head in true fp32 - admission: sm_120/sm_121 only, others refused by name - contract: idol-decoder-contract (gates 1-4 over the six kernels and tf_idol_attention at anchor shapes, 13 controls as other BREAK values), joined to the family sets; image in contract_limits - host tests: launch geometry, scratch sizing, contract range references Not yet compiled with nvcc (the Linux box was unreachable): gate-5 records and the sm_120/121 fatbin build are pending. Never run on a GPU.
… call was left one argument short
fc6b95f to
eea88db
Compare
|
Thank you @jayleaton. 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 @AIFlowML for the RTX 5090 run and for isolating output 73111 down to the tile maxima. Pushed 15e93b9 on top of Ash's eea88db. It is a fast-forward and doesn't touch Ash's commits. Behaviour chosen: tiled rounding is the contract, and the reference now simulates it. The kernel stays as it is. torch's CUDA flash and memory-efficient attention also round P to fp16 at the running maximum of each key tile and then rescale. Release-checkpoint parity on CUDA therefore means matching that, and the changelog already describes the kernel as rounding P "as torch's CUDA kernels do". Moving the kernel to final-max rounding would need a second pass over the keys and would depart from torch. The Metal decoders (#1773) are unaffected: they feed P·V as fp16 P hi + lo halves (about 22 bits), and their short form uses fp32 P, so where P rounds within a tile doesn't move them. CUDA and Metal both stay within their own references.
Timeout: gate 4 runs on the largest served shape, 8,192×8,192 at one head. The self-attention sums gate computed float64 outputs for all 8,192 tokens ten times (a reference plus nine fp32/fp16/bf16 simulations, each over all 8,192 keys), about 4e10 float64 steps. The stress inputs make every key alike, so every token's outputs equal token 0's. It now computes token 0's once and copies them to the rest. A host test checks that the copies match the full computation. This is untimed here (no GPU), so please say if it still runs past 360 s. Checks on 15e93b9: fmt, @ashhart, the #1858 changelog line from |
…ter ashhart#1858) The tiled decoder attention rounds P to fp16 at each 64-key tile's running maximum and rescales the sums, as torch's CUDA online-softmax kernels do. The float64 reference rounded at the final maximum, so a later tile with a larger score moved where P rounds and the shapes gate went red at 16x1000x65 (reported on an RTX 5090). The reference now follows the tile maxima, with the midpoint allowance at the running maximum, and a host test checks a fp32 online-softmax simulation against both. Gate 4's self attention over 8,192 anchors computed every token's outputs in float64 nine times, though alike keys make every token's outputs token 0's; it computes those once and copies them (about 4e10 float64 steps fewer, untimed here: no GPU).
…ter ashhart#1858) The tiled decoder attention rounds P to fp16 at each 64-key tile's running maximum and rescales the sums, as torch's CUDA online-softmax kernels do. The float64 reference rounded at the final maximum, so a later tile with a larger score moved where P rounds and the shapes gate went red at 16x1000x65 (reported on an RTX 5090). The reference now follows the tile maxima, with the midpoint allowance at the running maximum, and a host test checks a fp32 online-softmax simulation against both. Gate 4's self attention over 8,192 anchors computed every token's outputs in float64 nine times, though alike keys make every token's outputs token 0's; it computes those once and copies them (about 4e10 float64 steps fewer, untimed here: no GPU).
…ter ashhart#1858) The tiled decoder attention rounds P to fp16 at each 64-key tile's running maximum and rescales the sums, as torch's CUDA online-softmax kernels do. The float64 reference rounded at the final maximum, so a later tile with a larger score moved where P rounds and the shapes gate went red at 16x1000x65 (reported on an RTX 5090). The reference now follows the tile maxima, with the midpoint allowance at the running maximum, and a host test checks a fp32 online-softmax simulation against both. Gate 4's self attention over 8,192 anchors computed every token's outputs in float64 nine times, though alike keys make every token's outputs token 0's; it computes those once and copies them (about 4e10 float64 steps fewer, untimed here: no GPU).
…ter #1858) The tiled decoder attention rounds P to fp16 at each 64-key tile's running maximum and rescales the sums, as torch's CUDA online-softmax kernels do. The float64 reference rounded at the final maximum, so a later tile with a larger score moved where P rounds and the shapes gate went red at 16x1000x65 (reported on an RTX 5090). The reference now follows the tile maxima, with the midpoint allowance at the running maximum, and a host test checks a fp32 online-softmax simulation against both. Gate 4's self attention over 8,192 anchors computed every token's outputs in float64 nine times, though alike keys make every token's outputs token 0's; it computes those once and copies them (about 4e10 float64 steps fewer, untimed here: no GPU).
Stacked on #1773 and #1767 (Idol's decoders on Metal, and the denoiser on CUDA). This branch is #1773 with #1767 merged in. Its own change is
ad8501a8aandda5e1bdf1. Review after them.Compiles and passes host tests; never run on a GPU; GB10 qualification pending. The Sparks are busy, so nothing in this PR has run on an NVIDIA device.
What this changes
Idol's octree and Gaussian decoders on CUDA, the CUDA side of #1773. For #1757. Details: the "Decoders" part of
docs/recipes/idol-cuda.md.zig/kernels/cuda/idol_decoder.cu(glue flags):tf_idol_dec_embed,_half,_kv,_heads, the tiled cross attention_attentionand an fp32 short form_fewfor 8 query rows or fewer.input_layerand the head.tf-idol-decodeis one driver (zig/tests/idol_decode_run.zig) with thin Metal and CUDA mains; the CUDA build step isidol-decode-cuda.Decoder.loadadmits sm_121 and sm_120 and refuses any other GPU by name.Precision
tf_idol_dec_headskeeps a NaN norm, and an infinity stays infinite wherever its fp16 P is nonzero.Kernel contract
tf-cuda-test idol-decoder-contract: the six kernels and #1767's self attention at the decoders' shapes, with 13 planted controls (an fp16 sum, a rounding moved earlier, P V in fp16, the tail keys unmasked,fmaxfdropping a NaN). It is in the full contract's family sets andcontract_limits.zig. Gate-5 records (idol_decoder_cuda_records.zig) are nvcc 13.0's for sm_80, 86, 89, 120 and 121. There is no SUMMARY line yet: it needs a GPU.Receipt
idol_decoder.cuand the controls image compile for sm_80, 86, 89, 120 and 121, exit 0. The records come fromcuobjdump -res-usageof that build. This branch's kernel and the merged tree's give the same usage.zig build test-cuda-host: 4,137 of 4,154 passed, 8 failed (see below).test-idol-cuda-host: 37 of 37.zig build fatbins -Dnvcc=... -Dsm=121,120and the CUDA tools build on the merged tree (226 of 226 and 173 of 173 steps).zig build test-cuda-hostfailed the same 8 tests with and without this change: 6 inrecall_store_test, plusrecall_routes("the record's state and size…") andlate_system_test("GET and DELETE /v1/recall…"). The tree with only idol: Idol's denoiser on CUDA (stacked on #1766) #1767 merged into the Metal branch fails the same 8 (4,117 of 4,134 passed, 8 failed). The recall store reads back nothing ("found 0") on a box whose disk was nearly full. None of them touches Idol. The final run on the merged CUDA tree (idol-e2e-cuda) passed with no failures (282 of 282 steps).zig build test test-golden -Dcpu=apple_m1: 589 of 589 steps, 8,980 of 9,033 tests pass, 53 skipped. The pre-change and newtf-idol-decodeon decode262k and decode32k: gate logs,tf-idol-decode.plyandcamera.jsonbyte-identical, the JSON identical apart from timings, all gates pass.zig fmt --check build.zig zig: clean.lean_check.py: 424, the same as main.tools/zig/idol_gb10_qualify.sh(in the CUDA end-to-end PR) runs this component's contract and case on a Spark with the rest; its section indocs/recipes/idol-cuda.mdlists the case files to copy from the Mac.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (n/a.)SUMMARYline is in the receipt. (CUDA: registered; no SUMMARY line until a GPU runs it.)