Repository navigation
Idol CUDA decoder contract: tile-max P rounding in the reference, quicker self-attention gate 4 - #4508
Conversation
e1c97e0 to
8ce4741
Compare
|
Retested exact head zig build compile-cuda-tests -Dnvcc=/usr/local/cuda/bin/nvcc -Dsm=120 -Doptimize=ReleaseSafe -j2 --summary all
timeout 360s /path/to/tf-cuda-test idol-decoder-contractThe build passed 183/183 steps. On M5 Max the host target Igor Lessio - AIFLOW LABS |
8ce4741 to
1ad99b1
Compare
…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).
1ad99b1 to
b57d141
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. |
Follow-up to #1858, which merged at eea88db before this fix reached its branch. Thanks to @AIFlowML for the RTX 5090 run (#1858 (comment)). They showed that the tiled
tf_idol_dec_attentionfailed the shapes gate at16×1000×65: output 73111 was 1.35× the bound. They traced it to P being rounded at each 64-key tile's running maximum. Their run also timed out (exit 124 undertimeout 360s) after the self-attention shapes gate.Tiled rounding is the contract
The kernel is unchanged. The float64 reference now follows it.
Changes
zig/tests/cuda/contract_idol_dec_attn.zig: the reference's newweighwalks the keys in the spec's 64-key tiles. Each P is rounded to fp16 at the running maximum through its tile and carried to the final maximum. The midpoint allowance is taken at that running maximum. The few-row form keeps fp32 P.zig/tests/cuda/contract_idol_attn.zig, the timeout: gate 4 for the decoder's self attention runs at 8,192×8,192 and computed float64 outputs for every token ten times (a reference plus nine simulations), about 4e10 float64 steps. Its 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, and a host test checks the copies against the full computation.Needs a GPU
I couldn't run or time this without a GPU. @AIFlowML or @ashhart, could one of you rerun
timeout 360s tf-cuda-test idol-decoder-contractand confirm two things: that16×1000×65passes, and that the run reaches its SUMMARY within 360 s? I couldn't rebuild that exact fixture on the host, because its inputs come through the GPU rig.Checks
On 8ce4741, over main c35d9f7:
zig fmt --check,git diff --checkand lean (0 new) are clean.pr_check --pr 4508gives 0 errors and 0 warnings.cuda_common_check,cuda_fragment_checkand thecuda_common_check_testunittest pass.zig build -Dfixed-cpu test-gradient-serving test-idol-cuda-host test-kernel-contract compile-cuda-testspasses 61/61 steps and 320/320 tests.zig build compile-cuda-tests -Dtarget=aarch64-linux-gnu -Doptimize=ReleaseSafepasses 10/10.CHANGELOG.md, as on main.No GPU run yet: see above.