Repository navigation
Reduction TMA store, scoped to add at rank 2 (#42 route 3): the fallback the accumulate epilogue asked for - #187
Merged
Merged
Conversation
…cumulate epilogue asked for The pinned cuda-oxide rev carries all 64 cp.async.bulk.tensor.reduce records in intrinsics/imported.json and admits none of them to the generated crate, so the family is a generation-list change upstream (the preferred end state, #42) and this is the sanctioned bridge: one ptx_asm intrinsic (cp_reduce_async_bulk_tensor_2d_s2g_add), SharedTile::tma_store_add_2d over it, StoreRing::commit_add_2d for ring discipline, and TensorMapElement for F32 so an fp32 C can be mapped at all. Gated by device-tests' 'tma reduce-add store': a seeded destination reduce-stored twice must read back seed + 2·tile, which no overwrite can fake.
This was referenced Aug 4, 2026
Owner
Author
|
Downstream consumer landed as feitreim/oxide-train#82, pinning this branch at 969d7f4 — measured on B200: the fp32 weight-gradient fold premium collapsed from +25–29% to +0.3…+9.8% (negative on the worst shape), the four f32 acc-T model rows moved 0.666/0.588/0.881/0.892 → ~0.89/0.78/0.95/0.94 of cuBLASLt, and the same-container full-step A/B is −17.3 ms (dW rows −10.4 ms, plus −6.5 ms from the store kernel shedding the fold's 120 regs/512 B frame to 102/0; the reduce kernel itself is 80/0). Do not delete this branch until oxide-train swaps to a main rev. |
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.
Takes #42's sanctioned route 3: the moment a kernel asked for reduction stores (oxide-train#80's accumulate epilogue, remedy 1), the scoped local fallback lands —
add, rank 2, tile mode, nothing else.The #42 decision tree, resolved
20a5616, HEAD verified before reading): all 64int_nvvm_cp_async_bulk_tensor_reduce_*records are inintrinsics/imported.json, zero are generated intocuda-device, and neitherintrinsics/overlay.tomlnorintrinsics/abi-v1.tomlmentions the family at all — the plaincp_async_bulk_tensor_*_{g2s,s2g}catalog entries sit inabi-v1.tomland the reduce family simply never made the admission list. A generation-list gap, not a policy. This confirms the correction already recorded on Reduction TMA stores (cp.reduce.async.bulk.tensor): upstream to cuda-oxide rather than ptx_asm! locally #42.ptx_asm!body here shrinks to a call.What lands
shared::cp_reduce_async_bulk_tensor_2d_s2g_add— oneptx_asm!intrinsic (cp.reduce.async.bulk.tensor.2d.global.shared::cta.add.tile.bulk_group), thestmatrixprecedent's shape. The element type lives in the tensor map, so the one intrinsic covers fp32 and bf16 alike.SharedTile::tma_store_add_2d— mirrorstma_store_2d(TMA store path #9's store path), same subtile walk, same bulk-group completion, sotma_store_commitand both waits govern it unchanged.StoreRing::commit_add_2d— the ring discipline (lcsf and the rest of the prototype layer #15) over the reduction, one line different fromcommit_2d.TensorMapElement for F32— an fp32Cwas previously unmappable; the reduction store is the first consumer.add/rank-2 cell filled, everything else still upstream.Scope note: bf16 needs no second intrinsic (the dtype is the map's), but no bf16 caller exists — oxide-train's bf16 acc-T row is already at 0.937× cuBLASLt with a 0.3 ms/step gap, so nothing asked for it.
Gates
build(Modal, sm_100a codegen): green — the inline PTX lowers.device_tests(Modal B200): 51 of 51 cases passed, including the newtma reduce-add store: an fp32[16, 64]tile (two stacked 32-column subtiles, so the subtile walk is exercised) TMA'd in and reduce-stored twice onto a destination seeded with a constant, against a host-computed two-pass answer. Expected isseed + 2·valuebit-exactly (every term an exact small integer): a plain store (value), a single add (seed + value) and a dropped seed (2·value) each produce a distinct wrong value, and the pitched destination's poisoned margins catch a stray box.scripts/fmt, clippy-D warnings, 81 host tests + doctests green.The
[16, 64]fp32 tile shape is deliberate: 4096 bytes, byte-for-byte one bf16[32, 64]staging buffer, which is how the downstream accumulate epilogue reuses its existing shared plan without movingSHARED_BYTES.Downstream consumer: oxide-train#80 remedy 1 (PR to follow) pins this branch until it reaches main.