Repository navigation
Conversation
…reference case tool
Every pipeline of idol.metal and idol_attention.metal is registered: id_linear's eight forms (plain and GELU), id_split's two, id_gemm32, id_norm (plain, affine, modulated), id_norm32 (affine, modulated), id_norm_split, id_repo, id_qk, id_gate_add, id_embed, id_cond, id_bias32 and the attention's four forms. Each output is checked at idol-sdk's fp16 points as the range its fp32 steps allow; the NAX projections against the tensor unit's 16-deep step bound, the attention against attention_ref's formula with P at the tensor unit's fp32. Inputs at the large served shapes repeat at periods prime to every tile, so float64 stays cheap and every output is checked. 19 controls: rounding points dropped or added (gate 3), fp16 sums in id_norm32, id_repo, id_qk, id_embed and id_gemm32, and the NAX fp32 path in id_gemm32's place (gate 4), and the attention's tail keys unmasked. Gate 5 holds the 24 launches, each reserved by its source. Known finding: id_qk gives a head holding a NaN +-inf in its other outputs where F.normalize gives NaN, as Metal's max drops the NaN norm that clamp_min keeps.
…the values the units multiply
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), joined to the family sets; nvcc 13.0 records for sm_80/86/89/120/121; image in contract_limits - host tests for the family and the contract's range references
…f-idol-vae and its case Builds the denoiser's feature2 [4101, 128] from the preprocessed picture as idol-sdk's ImageEncoder does: the encoder, quant_conv, the posterior's sample with the SDK's noise as an input, the 2 x 2 patches, the batch norm's statistics and five zero rows. fp32 throughout on the SDK's bf16 weights (FLUX.2-klein-4B, or FLUX.2-dev rounded): Winograd 3x3s, implicit-GEMM downsamples and 1x1s, two-pass GroupNorm, single-head attention. idol_case.py vae records the SDK's MPS rows, its noise and a float64 ruler; tf-idol-vae gates worst row and 1 - cosine within twice the SDK's distance from float64 (ours 5.1e-5 and 5.0e-11 against 2.7e-2 and 5.1e-5), and repeat bytes. All eight kernels register with the contract: 13 forms pass gates 1-4, 12 controls red.
…d on GB10) Port Idol's image encoder (ashhart#1774) to CUDA under the same float64 gate, fp32 throughout on the SDK's bf16 weights. Compiles and passes host tests; never run on a GPU; GB10 qualification pending. - idol_vae.cu / idol_vae.cuh: every convolution as an fp32 implicit GEMM of FMAs (same-size 3x3, stride-2 3x3 padded right and below, 1x1; no Winograd, no tensor cores, no TF32), conv_in, two-pass GroupNorm, GroupNorm + SiLU, bias epilogues, the attention's softmax and the condition rows (NaN-keeping clamp); glue flags. The mid block's q/k/v/out and P.V run on cuBLASLt in true fp32 (cuda_gemm.zig, CUBLAS_COMPUTE_32F), inside free picture tensors. - cuda_vae*.zig: encoder, launchers, weights; admits sm_120/sm_121 alone and refuses others by name; posterior noise stays an input. - vae_config.zig: geometry, config check, bf16 rounding and the gate shared with Metal; tf-idol-vae's driver shared too (idol_vae_run.zig), the Metal tool's output unchanged; tf-idol-vae on CUDA (idol-vae-cuda step). - kernel contract: idol-vae-contract, 16 forms through gates 1-4 and eleven controls built from idol_vae.cuh with one planted flaw each, joined to the family sets; nvcc 13.0 records for sm_80/86/89/120/121; image in contract_limits; host tests for geometry, scratch, admission and references. - contract_controls.cu: restore the closing brace of tf_ctl_pocket_in_fmax that the MOSS-Image CUDA commit dropped (as on main), so the controls build.
9 tasks done
Owner
|
Thanks @jayleaton. Plain fp32 implicit GEMMs and true-fp32 cuBLASLt with no TF32 keep the CUDA side simple. This waits on #1774 and #1767. It has the same |
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.
Stacked on #1774 and #1767 (Idol's VAE encoder on Metal, and the denoiser on CUDA). This branch is #1774 with #1767 merged in. Its own change is
7f68bb85f. 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 FLUX.2 VAE image encoder on CUDA, the CUDA side of #1774. For #1757. Details: the "VAE encoder" part of
docs/recipes/idol-cuda.md.zig/kernels/cuda/idol_vae.cuandidol_vae.cuh(glue flags): every convolution as an fp32 implicit GEMM of FMAs (same-size 3x3, stride-2 3x3 padded right and below, 1x1),conv_in, two-pass GroupNorm, GroupNorm with SiLU, bias epilogues, the attention's softmax, and the condition rows with the NaN-keeping clamp.CUBLAS_COMPUTE_32F, fp32 inputs, no TF32), through idol: Idol's denoiser on CUDA (stacked on #1766; not yet run on a GPU) #1767'scuda_gemm.zig.vae_config.zigholds the geometry, config check, bf16 rounding and the gate, shared with Metal.tf-idol-vaeis one driver (zig/tests/idol_vae_run.zig) with thin Metal and CUDA mains; the CUDA build step isidol-vae-cuda.Precision
fp32 throughout on the SDK's bf16 weights, as on Metal, and the same gate against float64. No Winograd and no tensor cores: the plain fp32 implicit GEMM keeps every sum an fp32 FMA chain, so it needs none of the Metal port's float64-made transforms. Whether it meets the float64 gate on a device is for GB10 qualification.
Kernel contract
tf-cuda-test idol-vae-contract: 16 forms through gates 1-4 and eleven controls built fromidol_vae.cuhwith one planted flaw each. It is in the full contract's family sets andcontract_limits.zig. Gate-5 records (idol_vae_cuda_records.zig) are nvcc 13.0's for sm_80, 86, 89, 120 and 121. No SUMMARY line yet: it needs a GPU.Receipt
idol_vae.cuand the controls compile for sm_80, 86, 89, 120 and 121.zig build test-cuda-hostpasses;zig build(Linux) exit 0, 367 s;zig build fatbins -Dnvcc=... -Dsm=121,120: 220 of 220 steps.tf-idol-vaefor CUDA builds on the merged tree (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; not yet run on a GPU) #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 -Dcpu=apple_m1: 589 of 589 steps, 8,958 of 9,011 tests pass, 53 skipped. The pre-change and newtf-idol-vaeon the VAE case:rows.f32byte-identical, the JSON identical apart from timings, against float64 our worst row 5.144e-5 and the SDK's 2.729e-2: 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.)