d4aeb4e41c
D1.3: Add unnormalized debug test to isolate SMEM-P vs O round-trip error
2026-05-24 00:15:41 +00:00
b2a583a2a8
D1.3: Add SMEM-P write/read diagnostic
2026-05-24 00:13:28 +00:00
0fc6530f3f
D1.3: Add SMEM-P vs TMEM-P comparison test
2026-05-24 00:10:18 +00:00
d56e5601bb
D1.3: Fix while loop in cotiled diag - precompute num_tmem_alloc_cols
2026-05-24 00:07:22 +00:00
7bd857e5d3
D1.3: Fix cotiled diagnostic - use proper MMA construction
2026-05-24 00:06:50 +00:00
3fe17495ee
D1.3: Add make_cotiled_copy diagnostic test
2026-05-24 00:05:48 +00:00
ed539653d0
shit left dangling
2026-05-23 23:58:57 +00:00
0286d57631
D1.3: Re-enable coordinate-indexed SMEM-P write with identity tensor coords
2026-05-23 23:26:46 +00:00
3118bec420
D1.3: Revert to zero-fill for sP - need to verify sP→PV pipeline first
2026-05-23 23:26:07 +00:00
0963d949c4
D1.3: Compute (m,k) directly from thread mapping instead of identity tensor
2026-05-23 23:24:54 +00:00
fca9652719
D1.3: Add debug prints for SMEM-P coordinate mapping
2026-05-23 23:24:02 +00:00
de869c01c8
D1.3: Add SMEM-P coordinate diagnostic test
2026-05-23 23:23:05 +00:00
89393b8352
D1.3: Fix coord extraction - identity tensor stores (m,k) pairs as values
2026-05-23 23:21:15 +00:00
f74fd75054
D1.3: Fix coordinate indexing - tTMEM_LOADcS first mode is (32,1) nested tuple
2026-05-23 23:20:12 +00:00
4b8970d83c
D1.3: Direct coordinate-indexed SMEM-P write using tTMEM_LOADcS coords
...
Each softmax thread writes its P values to sP using the (m,k) coordinates
from tTMEM_LOADcS. The k coordinate is decomposed into (k0,k1,k2) to
match sP's ((128,16),1,(4,2)) layout. CuTeDSL tensor indexing handles
the swizzle automatically. No make_tiled_copy needed.
2026-05-23 23:19:21 +00:00
58b4537741
D1.3: Use make_cotiled_copy for SMEM-P — custom TV layout from TMEM-load coords to sP
...
Per CUTLASS guidance:
- make_tiled_copy_C/D encode wrong invariants for this transfer
- Build custom R→S copy where TV map comes from tTMEM_LOADcS (softmax thread
ownership) and destination addresses come from sP layout (PV A-operand swizzled SMEM)
- Use composition(sP_2d_layout, p_coord_layout) for atom_layout_tv
- Start with scalar BF16 (16-bit) stores — vectorize later
- Zero-fill source for compile test, will fill with actual P values next
2026-05-23 23:17:30 +00:00
63f662edb3
Add SMEM-P guidance request document for CUTLASS LLM consultation
2026-05-23 23:03:35 +00:00
48c1e6d7e9
D1.3: Use const_expr for lse None check
2026-05-23 22:30:55 +00:00
82179f1f61
D1.3: Fix LSE with const_expr, always create valid mLSE tensor
2026-05-23 22:30:14 +00:00
f1341ad76e
D1.3: Try make_tiled_copy_C(qk_mma) for SMEM-P copy - zero-fill source for compile test
2026-05-23 22:29:10 +00:00
bafcfa658f
D1.3: Define SMEM-P copy atoms unconditionally (CuTeDSL scoping)
2026-05-23 22:28:12 +00:00
8d226a6243
D1.3: Use full sP (4D) for make_tiled_copy_D partition
2026-05-23 22:27:11 +00:00
fa2e513168
D1.3: SMEM-P via get_smem_store_op + make_tiled_copy_D
...
Uses the CUTLASS blackwell_helpers pattern:
- get_smem_store_op creates a SMEM store atom paired with the TMEM load
- make_tiled_copy_D uses the same thread partition as the TMEM load
- Softmax warps write P to sP using the same thread mapping they use for reading S
- MMA warp reads P from sP via pv_mma.make_fragment_A(sP)
- Replaces the zero-fill stub with a proper register→SMEM copy
2026-05-23 22:26:09 +00:00
d10cab7a8e
D1.3: Enhanced diagnostic - test QK C-fragment as source for make_tiled_copy_C
2026-05-23 22:24:15 +00:00
a90fe41b6b
D1.3: Skip fragment creation in diagnostic, just print layouts
2026-05-23 22:21:31 +00:00
b871e6874b
D1.3: Fix diagnostic - use dummy ptr 0 for shape analysis
2026-05-23 22:20:16 +00:00
0b3d3bcd2b
D1.3: Fix sP allocation - p_smem_s.outer is already a layout
2026-05-23 22:19:11 +00:00
fc4106f37e
D1.3: Fix layout diagnostic - compute c_major outside kernel
2026-05-23 22:17:54 +00:00
6afa610b0d
D1.3: Layout diagnostic v2 - run inside JIT-compiled kernel
2026-05-23 22:16:57 +00:00
b185ac2080
D1.3: Fix layout diagnostic - remove JIT-dependent code
2026-05-23 22:15:47 +00:00
d265264f74
D1.3: Layout diagnostic - print all QK C-fragment and PV A-operand shapes
2026-05-23 22:14:35 +00:00
98e5b48470
Update all .md files with D5a/D5b progress, tOrP0 fix, LSE formula
...
- README.md: Updated Stage status table (D1 🟡 , D5 🟢 ), D5 section with
D5a/D5b results, tOrP0 bug fix docs, new CuTeDSL constraints #11-12
- STAGE_D1.3.md: Added progress update - TMEM-P works, SMEM-P still blocked,
recommended next steps
- STAGE_D.md was already updated
2026-05-23 22:07:53 +00:00
53efb0c95e
Update STAGE_D.md with D5b results: merge cos 0.961, LSE err=0.0
2026-05-23 21:45:22 +00:00
b1152acd88
D5b: Fix reference computation - use logsumexp for stable LSE, fix o_unnorm definition
2026-05-23 21:43:04 +00:00
4ed2b46020
D5b MILESTONE: SWA+sink merge works! cos 0.969
...
- Run FMHA twice (compressed KV + SWA KV) with normalized O + LSE
- Merge with sink weights in Python
- LSE err=0.0, merge cos=0.969 PASS
- Update STAGE_D.md: D5b done, D5c/D5d are optimizations
2026-05-23 21:36:26 +00:00
b77ad244a2
D5b: Use normalized O + LSE for merge (correct formula), always output LSE
2026-05-23 21:35:40 +00:00
84200ca557
D5b: Clean up merge test - stable formula for both ref and kernel
2026-05-23 21:33:45 +00:00
909f880cc2
D5b: Use reference per-row LSE for proper O normalization
2026-05-23 21:31:52 +00:00
fef7e90c0a
D5b: Fix kernel_obj reference
2026-05-23 21:30:59 +00:00
d245342a7a
D5b: Fix syntax error
2026-05-23 21:30:00 +00:00
4a8fd64c4e
D5b: Debug reference formula mismatch, add numerically stable merge
2026-05-23 21:19:25 +00:00
e0201e581d
D5b: Python SWA+sink merge test
...
- Run FMHA twice (compressed KV + SWA KV, normalize=False)
- Merge with sink weights in Python
- Verify end-to-end correctness vs FP32 reference
2026-05-23 21:18:06 +00:00
a629babb6a
Update STAGE_D.md: D5a done, CG-2/CG-3 status updated, tOrP0 offset rule added
2026-05-23 21:16:52 +00:00
aff208fb4c
D5a: Fix LSE formula - lse = ln(row_sum) + row_max * ln(2)
...
row_max is in scale_log2 domain, need to convert to natural log domain.
attn_max = row_max * ln(2), so lse = ln(row_sum) + row_max * ln(2).
2026-05-23 21:15:14 +00:00
a5061a24b9
D5a: Use tensor indexing for LSE write
2026-05-23 21:13:52 +00:00
7a87c634fb
D5a: Use cute.store for LSE write
2026-05-23 21:13:07 +00:00
7c38bd5522
D5a: Fix LSE - compute row_max_safe from final row_max, remove mLSE None check
2026-05-23 21:12:29 +00:00
aecf6671d9
D5a: Fix - add normalize param to __init__
2026-05-23 21:11:37 +00:00
b273d4a7e8
D5a: Add normalize flag + LSE output
...
- normalize=True (default): O = softmax(P) @ V (existing behavior)
- normalize=False: O = P @ V (un-normalized) + lse = log(row_sum) + row_max
- LSE tensor passed as optional parameter
- Test includes D5a normalize=False verification with LSE comparison
- Cleaned up SMEM-P debug prints and broken make_tiled_copy_C code
- hd=64 TMEM-P regression: cos 0.973 PASS
2026-05-23 21:10:40 +00:00
aa72779a7a
D1.3: Use const_expr if for tOrP0 compile-time selection
2026-05-23 21:07:58 +00:00