Add OSS regression test for GDN channelwise_gated_delta_rule chunked-prefill NaN (#21439) - #21439
Merged
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21439
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit de35da7 with merge base 2a64e2d ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
|
@YIWENX14 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D113943464. |
Contributor
Author
|
@pytorchbot label "release notes: none" |
YIWENX14
added a commit
to YIWENX14/executorch
that referenced
this pull request
Jul 28, 2026
…prefill NaN (pytorch#21439) Summary: Adds an OSS unit test that guards the GDN2 chunked-prefill overflow NaN fixed in D113866825. The fused `torch.ops.llama.channelwise_gated_delta_rule` chunked-prefill kernel (`op_sdpa.cpp`) forms `eg_inv = exp(-cumsum(log decay))` per CHUNK_SIZE (32) tokens; for tiny positive decay the within-chunk cumulative `-log(decay)` exceeds the float `expf` overflow limit (~88.7), so `eg_inv` overflows to `+inf` and `eg * eg_inv` becomes `0 * inf = NaN`, poisoning the whole head's output. The `channelwise_gated_delta_rule_chunked_is_safe` guard routes such inputs to the exact (numerically stable) recurrence. `test_channelwise_gated_delta_rule_prefill_tiny_decay_is_finite` builds a prefill (T=64 > CHUNK_SIZE) input with tiny positive decay (1e-12) and asserts the op output and final_state are finite and match the token-by-token reference. Without the guard the `isfinite` assertions fail. Reviewed By: JakeStevens Differential Revision: D113943464
YIWENX14
force-pushed
the
export-D113943464
branch
from
July 28, 2026 20:20
7ccaf51 to
3e90b91
Compare
…prefill NaN (pytorch#21439) Summary: Adds an OSS unit test that guards the GDN2 chunked-prefill overflow NaN fixed in D113866825. The fused `torch.ops.llama.channelwise_gated_delta_rule` chunked-prefill kernel (`op_sdpa.cpp`) forms `eg_inv = exp(-cumsum(log decay))` per CHUNK_SIZE (32) tokens; for tiny positive decay the within-chunk cumulative `-log(decay)` exceeds the float `expf` overflow limit (~88.7), so `eg_inv` overflows to `+inf` and `eg * eg_inv` becomes `0 * inf = NaN`, poisoning the whole head's output. The `channelwise_gated_delta_rule_chunked_is_safe` guard routes such inputs to the exact (numerically stable) recurrence. `test_channelwise_gated_delta_rule_prefill_tiny_decay_is_finite` builds a prefill (T=64 > CHUNK_SIZE) input with tiny positive decay (1e-12) and asserts the op output and final_state are finite and match the token-by-token reference. Without the guard the `isfinite` assertions fail. Reviewed By: JakeStevens Differential Revision: D113943464
YIWENX14
force-pushed
the
export-D113943464
branch
from
July 28, 2026 21:29
3e90b91 to
de35da7
Compare
JakeStevens
approved these changes
Jul 28, 2026
billmguo
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Adds an OSS unit test that guards the GDN2 chunked-prefill overflow NaN fixed
in D113866825. The fused
torch.ops.llama.channelwise_gated_delta_rulechunked-prefill kernel (
op_sdpa.cpp) formseg_inv = exp(-cumsum(log decay))per CHUNK_SIZE (32) tokens; for tiny positive decay the within-chunk cumulative
-log(decay)exceeds the floatexpfoverflow limit (~88.7), soeg_invoverflows to
+infandeg * eg_invbecomes0 * inf = NaN, poisoning thewhole head's output. The
channelwise_gated_delta_rule_chunked_is_safeguardroutes such inputs to the exact (numerically stable) recurrence.
test_channelwise_gated_delta_rule_prefill_tiny_decay_is_finitebuilds aprefill (T=64 > CHUNK_SIZE) input with tiny positive decay (1e-12) and asserts
the op output and final_state are finite and match the token-by-token
reference. Without the guard the
isfiniteassertions fail.Reviewed By: JakeStevens
Differential Revision: D113943464