Commit 24b5bce
Fix NaN in gated_deltanet_chunk_fwd_o reference and submission
The reference kernel computed exp(g_i - g_j) before applying the causal
mask. When g values are very negative (cumulative sums of negative
increments), the upper-triangle differences g_i - g_j overflow exp() to
inf, and inf * 0 (causal mask) produces NaN.
Fix: zero out g_diff in the upper triangle before calling exp(), so we
never compute exp(large_positive). Apply the same fix in the submission
kernel which had a similar issue with exp(-g) overflowing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5465b80 commit 24b5bce
2 files changed
Lines changed: 16 additions & 9 deletions
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
| |||
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
59 | 60 | | |
60 | | - | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
0 commit comments