Drop the unsupported window_size argument from attention backend queries - #3479
Open
Anai-Guo wants to merge 1 commit into
Open
Drop the unsupported window_size argument from attention backend queries#3479Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
get_available_attention_backends() in tests/pytorch/utils.py has no window_size parameter and no **kwargs, so both call sites that pass window_size=config.window_size raise TypeError before any backend is queried. The helper already reads config.window_size internally when it builds the DotProductAttention kwargs, so the argument is redundant as well as invalid; every other call site omits it. Signed-off-by: Anai-Guo <antai12232931@outlook.com>
Contributor
Greptile SummaryRemoves an unsupported and redundant
Confidence Score: 5/5The PR appears safe to merge with no actionable regressions identified. Both changed calls now match the helper signature, and the helper still reads the intended window size from each caller’s configuration. Important Files Changed
Reviews (1): Last reviewed commit: "Drop the unsupported window_size argumen..." | Re-trigger Greptile |
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.
Description
get_available_attention_backends()(tests/pytorch/utils.py:335) does not accept awindow_sizeargument and has no**kwargs:Two call sites still pass it, so both raise
TypeErrorbefore a single backend is queried:benchmarks/attention/benchmark_attention.py:198docs/examples/attention/example_attention.py:93The second one is the script the attention documentation tells readers to run —
docs/examples/attention/attention.ipynbexecutes!NVTE_DEBUG=1 NVTE_DEBUG_LEVEL=1 python example_attention.py— so the documented example currently cannot run.The argument is redundant as well as invalid:
get_available_attention_backendsalready reads the window size off the config itself when it assembles theDotProductAttentionkwargs (tests/pytorch/utils.py:392,window_size=config.window_size). Every one of the ~20 other call sites (tests/pytorch/attention/test_attention.py,test_attention_with_cp.py,test_flex_attention.py,test_kv_cache.py, …) omits it.Fix
Drop the
window_size=config.window_size,line from the two offending calls. No behaviour change — the helper derives the same value fromconfig.Verification
No GPU is required to see the failure; it is argument binding, before any CUDA work. Reconstructed the real signature out of
tests/pytorch/utils.pywithastand replayed both call shapes throughinspect.Signature.bind:After the patch both call sites bind cleanly.
black 24.4.2 --line-length=100 --preview --enable-unstable-feature=string_processingreports both files unchanged.🤖 Generated with Claude Code