Repository navigation
cuda: cp.async commit and wait from common/cp_async.cuh, SASS unchanged (#1409 step 5) - #1588
Conversation
|
Thank you, this is a nice cleanup, and the SASS receipt with the planted control is just what we need. There is one thing to fix before we can land it. You can reproduce it with template <int N> inline void cp_wait() {}With that change the emulator builds and passes (0 failures) on our side. Could you add it to this PR? Everything else looks good to land. |
ashhart#1409 step 6, the copies that are the same instruction: - prefill_attention.cu and qwen35_attn_tc.cuh kept their own ldmatrix4t, qmm_frag's text: both take qmm_frag::ldmatrix4t. - the exl3 kernels' ldsm4 (x3gm.cu, pfdense.cuh), ldsm2 (x3gm2.cuh) and ldmatrix_x4 (exl3_prompt.cuh) are qmm_frag's ldmatrix4 and ldmatrix2 with their own address cast; they take qmm_frag's, and their callers (x3gm, x3gm2, x3gm3, pfdense, exl3_prompt) the names. - experts_grouped.cuh's f16 mma16816 is exl3_decode.cuh's text: tf_exl3x takes tf_exl3's through a using declaration. Not here: mma_z (nvfp4_experts, flashnext_fexp) and experts.cuh's mma take scalar operands where qmm_frag's take arrays; pfdense's mma16816_bf16 is asm volatile where qmm_frag::mma is not; the glm glue copies follow ashhart#1564. cuobjdump -sass is identical for every function of the 14 images this reaches (1,935 functions, sm_80/86/89/120/121, nvcc 13.0), base ashhart#1588. The tool's warp_sum control goes red; a planted control in exl3_decode.cuh (the f16 mma as bf16) changes 2,238 of 2,803 functions.
#1409 step 6, the copies that are the same instruction: - prefill_attention.cu and qwen35_attn_tc.cuh kept their own ldmatrix4t, qmm_frag's text: both take qmm_frag::ldmatrix4t. - the exl3 kernels' ldsm4 (x3gm.cu, pfdense.cuh), ldsm2 (x3gm2.cuh) and ldmatrix_x4 (exl3_prompt.cuh) are qmm_frag's ldmatrix4 and ldmatrix2 with their own address cast; they take qmm_frag's, and their callers (x3gm, x3gm2, x3gm3, pfdense, exl3_prompt) the names. - experts_grouped.cuh's f16 mma16816 is exl3_decode.cuh's text: tf_exl3x takes tf_exl3's through a using declaration. Not here: mma_z (nvfp4_experts, flashnext_fexp) and experts.cuh's mma take scalar operands where qmm_frag's take arrays; pfdense's mma16816_bf16 is asm volatile where qmm_frag::mma is not; the glm glue copies follow #1564. cuobjdump -sass is identical for every function of the 14 images this reaches (1,935 functions, sm_80/86/89/120/121, nvcc 13.0), base #1588. The tool's warp_sum control goes red; a planted control in exl3_decode.cuh (the f16 mma as bf16) changes 2,238 of 2,803 functions.
|
Thanks @ashhart. Done in |
…t as a template argument
6c92b26 to
31bcd66
Compare
|
Thank you @jschmied. This is in TensorFold 1.2.0, released today: https://github.com/ashhart/TensorFold/releases/tag/v1.2.0 It landed with your commits under your own name, so you're listed as a TensorFold contributor, and it's credited to you in the release notes and the changelog. |
#1409, step 5: the cp.async group fences. This is independent of #1550, #1555, #1556 and #1564, and based on current main.
What
Eleven files each kept their own
cp.async.commit_groupandcp.async.wait_group N, under five names (cp_commit/cp_wait,cp_async_commit/cp_async_wait,wait_group,wait_all). The newcommon/cp_async.cuhholds onetf_common::cp_commit()andcp_wait<N>(), and the files take them withusingdeclarations, as in #1440:exl3_block/pfdense.cuh,exl3_block/x3gm.cu,experts.cuh:usingonly, no caller changes.exl3_prompt.cuh:cp_async_commit/cp_async_waitare renamed tocp_commit/cp_wait.glm_index_scores.cuh:cp_wait()(a hard-codedwait_group 0) becomescp_wait<0>().prefill_attention.cuandprefill_attention_rows.cuh, plustree_attention.cu,window_attention.cu,window_rows.cuh:wait_group<N>becomescp_wait<N>.block_attention.cu:wait_all()becomescp_wait<0>().experts.cuh's gradient-serving pin takes the new bytes. The twoprefill_attentionpins already differ on main and are left as they are.Not here:
qmm_frag'scommit/wait<N>and the copies that mirror them (h3_attention.cuh,glm_glue_attn.cuh,glm_glue_bmm.cuh,glm_qmm_frag.cuh). These follow once cuda: glm_mm takes common/qmm_frag.cuh, and its 117-line copy glm_qmm_frag.cuh goes, SASS unchanged #1564 lands, which removesglm_qmm_frag.cuh."memory"clobber, so they aren't the same asm.Checks
tools/zig/cuda_sass_identity.py origin/main HEAD: identicalcuobjdump -sassfor every function of the 27 images this change reaches. That is 2,245 functions over sm_80/86/89/120/121 with nvcc 13.0.warp_sumcontrol goes red.fp4paircontrol changes nothing here, because none of these images usesfp4pair; that is why the tool exits 1.cp_async.cuh(cp_wait<N>waiting for N − 1 groups) changes 1,190 functions, so the comparison can see this header.zig build test: passes.