Repository navigation
[GraphTrainer][AutoDev] Accept float inputs in CUDAGraphWrapper - #2876
Merged
Merged
Conversation
…ypes The aot_fx_trace joint graph can have float-valued inputs (e.g. global_valid_tokens scaling factor). Add float to the supported input types so that CUDAGraphWrapper does not reject these inputs during recording. Spun off from PR #2868 review feedback.
SherlockNoMad
marked this pull request as ready for review
April 7, 2026 20:29
SherlockNoMad
requested review from
aditvenk,
tianyu-l,
xmfan and
yiming0416
as code owners
April 7, 2026 20:29
Contributor
Author
|
Valid fix, ready to land. |
yiming0416
approved these changes
Apr 7, 2026
TXacs
pushed a commit
to McmillanTAC/torchtitan
that referenced
this pull request
Apr 13, 2026
…rch#2876) ## Summary - Add `float` to the supported input types in `CUDAGraphWrapper._check_input_types` - The aot_fx_trace joint graph can produce float-valued inputs (e.g. `global_valid_tokens` scaling factor), which previously caused a `ValueError` during CUDA graph recording - Float inputs are treated as static constants baked into the graph at recording time (they are not in `_input_indices_to_copy`, so they won't be updated on replay) ## Context Spun off from [PR pytorch#2868](pytorch#2868) review feedback. The original error was: ``` ValueError: args must be tensor, integer (for dynamic shapes), Generator (for random number generator), or opaque object, but found <class 'float'> with value 65536.0 at index 117 ``` ## Test plan - [x] `pre-commit run --all-files` passes (all hooks green) - [x] `pytest torchtitan/experiments/graph_trainer/tests/test_passes.py -x` — 12/12 passed - [x] `pytest torchtitan/experiments/graph_trainer/tests/test_precompile.py -x` — 24/24 passed
jemitche1
pushed a commit
to jemitche1/torchtitan
that referenced
this pull request
Apr 14, 2026
…rch#2876) ## Summary - Add `float` to the supported input types in `CUDAGraphWrapper._check_input_types` - The aot_fx_trace joint graph can produce float-valued inputs (e.g. `global_valid_tokens` scaling factor), which previously caused a `ValueError` during CUDA graph recording - Float inputs are treated as static constants baked into the graph at recording time (they are not in `_input_indices_to_copy`, so they won't be updated on replay) ## Context Spun off from [PR pytorch#2868](pytorch#2868) review feedback. The original error was: ``` ValueError: args must be tensor, integer (for dynamic shapes), Generator (for random number generator), or opaque object, but found <class 'float'> with value 65536.0 at index 117 ``` ## Test plan - [x] `pre-commit run --all-files` passes (all hooks green) - [x] `pytest torchtitan/experiments/graph_trainer/tests/test_passes.py -x` — 12/12 passed - [x] `pytest torchtitan/experiments/graph_trainer/tests/test_precompile.py -x` — 24/24 passed
ACharacterInASimulation
pushed a commit
to ACharacterInASimulation/torchtitan
that referenced
this pull request
Apr 21, 2026
…rch#2876) ## Summary - Add `float` to the supported input types in `CUDAGraphWrapper._check_input_types` - The aot_fx_trace joint graph can produce float-valued inputs (e.g. `global_valid_tokens` scaling factor), which previously caused a `ValueError` during CUDA graph recording - Float inputs are treated as static constants baked into the graph at recording time (they are not in `_input_indices_to_copy`, so they won't be updated on replay) ## Context Spun off from [PR pytorch#2868](pytorch#2868) review feedback. The original error was: ``` ValueError: args must be tensor, integer (for dynamic shapes), Generator (for random number generator), or opaque object, but found <class 'float'> with value 65536.0 at index 117 ``` ## Test plan - [x] `pre-commit run --all-files` passes (all hooks green) - [x] `pytest torchtitan/experiments/graph_trainer/tests/test_passes.py -x` — 12/12 passed - [x] `pytest torchtitan/experiments/graph_trainer/tests/test_precompile.py -x` — 24/24 passed
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
floatto the supported input types inCUDAGraphWrapper._check_input_typesglobal_valid_tokensscaling factor), which previously caused aValueErrorduring CUDA graph recording_input_indices_to_copy, so they won't be updated on replay)Context
Spun off from PR #2868 review feedback. The original error was:
Test plan
pre-commit run --all-filespasses (all hooks green)pytest torchtitan/experiments/graph_trainer/tests/test_passes.py -x— 12/12 passedpytest torchtitan/experiments/graph_trainer/tests/test_precompile.py -x— 24/24 passed