Commit fbe14ed
committed
[None][test] ltx2: self-attn unit tests pass valid pe to match fused contract
LTX2Attention now hardcodes fuse_qk_norm_rope=True in __init__, which makes
forward() route every self-attn call through the FUSE_QKV branch that
unpacks `cos, sin = pe` unconditionally. The four self-attn sanity / backend-
equivalence tests previously passed pe=None, which silently fell into the
_forward_unfused path back when fuse_qk_norm_rope defaulted to False. That
implicit reliance is gone, so the tests now hit a TypeError at line 265.
Fix: build an identity-rotation RoPE tuple (cos=1, sin=0, shape [B,T,H,D])
in a `_make_pe` helper and pass it through pe= on the four self-attn
testcases. cos/sin layout mirrors what `_split_freqs_cis` produces in
production, so the tests exercise the same fused norm+RoPE kernel path
without needing real RoPE angles. Identity rotation keeps the resulting
shape and norm checks meaningful (q*1 + rotate_half(q)*0 = q).
Cross-attention tests are unaffected — they go through SEPARATE_QKV and
apply_split_norm_or_norm_rope, which already accepts pe=None as norm-only.
E2E LTX-2 nvfp4 single-stage smoke test still passes (32.7s, 12.13 MB mp4).
All six tests in test_ltx2_attention.py PASS after the change.
Signed-off-by: Yiyun Lu <yiyunl@nvidia.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>1 parent db27b43 commit fbe14ed
1 file changed
Lines changed: 30 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
55 | 76 | | |
56 | 77 | | |
57 | 78 | | |
| |||
86 | 107 | | |
87 | 108 | | |
88 | 109 | | |
| 110 | + | |
89 | 111 | | |
90 | 112 | | |
91 | | - | |
| 113 | + | |
92 | 114 | | |
93 | 115 | | |
94 | 116 | | |
| |||
122 | 144 | | |
123 | 145 | | |
124 | 146 | | |
| 147 | + | |
125 | 148 | | |
126 | 149 | | |
127 | | - | |
| 150 | + | |
128 | 151 | | |
129 | 152 | | |
130 | 153 | | |
| |||
248 | 271 | | |
249 | 272 | | |
250 | 273 | | |
| 274 | + | |
251 | 275 | | |
252 | 276 | | |
253 | | - | |
| 277 | + | |
254 | 278 | | |
255 | 279 | | |
256 | 280 | | |
| |||
308 | 332 | | |
309 | 333 | | |
310 | 334 | | |
| 335 | + | |
311 | 336 | | |
312 | 337 | | |
313 | | - | |
314 | | - | |
| 338 | + | |
| 339 | + | |
315 | 340 | | |
316 | 341 | | |
317 | 342 | | |
| |||
0 commit comments