Commit 83d953e
committed
fix(path_c bwd): dseg — branchless unmasked T.Parallel body (CUDA barrier-in-mask scope bug, 2nd)
The T.Parallel(L*L) dseg rewrite STILL failed compile: 'cb_v' undefined. The
TileLang shared-mem barrier pass inserts __syncthreads() between the global cb
load and the shared dAcs_acc atomic; when that barrier lands INSIDE the
'if ss<ll' masked body it re-emits the if-guard per fragment WITHOUT hoisting the
cb_v/dseg locals -> out of scope. The unmasked dC apply / DYX build blocks above
survive the identical barrier ONLY because they carry no enclosing if.
Fix: make the dseg body BRANCHLESS (no if mask) — compute cb_v/lmat/dt_s
unconditionally (all in-bounds for any (ll,ss) in [0,L)^2; lmat for ss>ll is a
bounded small positive, no overflow) and apply the strict-lower-tri (ss<ll)
selection as a multiplicative 0/1 mask via T.if_then_else (a VALUE, not control
flow). DYX[ll,ss]=0 already for ss>ll and the mask kills the ss==ll diagonal, so
dseg=0 off the strict lower-tri -> the +/- scatter is a no-op there. Math
IDENTICAL to the Metal prim. Now structurally identical to the proven dC apply
block (unmasked T.Parallel + shared atomic_add). Metal prim untouched. RULE #1.1 parent 0db3e88 commit 83d953e
1 file changed
Lines changed: 21 additions & 18 deletions
Lines changed: 21 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
671 | 676 | | |
672 | 677 | | |
673 | 678 | | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
685 | 688 | | |
686 | 689 | | |
687 | 690 | | |
| |||
0 commit comments