Repository navigation
[docs] AWS Trainium: rewrite guide for native TorchNeuron support - #15138
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
JingyaHuang
force-pushed
the
refactor-neuron-doc
branch
from
October 27, 2026 14:07
6032598 to
f8cdceb
Compare
JingyaHuang
marked this pull request as ready for review
October 27, 2026 15:43
stevhliu
approved these changes
Oct 27, 2026
sayakpaul
reviewed
Oct 28, 2026
| `pipe.transformer.compile_repeated_blocks(backend="neuron", fullgraph=True, dynamic=False)` compiles one block and | ||
| reuses it for the others, which cuts the warmup time considerably. | ||
|
|
||
| ## Tensor parallelism |
Member
There was a problem hiding this comment.
We should refer the readers to the dedicated TP section and show Neuron-relevant stuff here?
sayakpaul
reviewed
Oct 28, 2026
| | Mode | Constant | How to activate | Notes | | ||
| |---|---|---|---| | ||
| | Strict eager (default) | `EagerMode.DEFER_NEVER` | `pipe.to("tpu")` | Operations dispatched one at a time, asynchronous | | ||
| | Optimized eager | `EagerMode.DEFER_AND_FUSE` | `TORCH_TPU_DEFER_AND_FUSE=1` | Operations deferred and fused into larger graphs; faster than strict eager, longer compile | |
Member
There was a problem hiding this comment.
Have we tested for this mode?
Contributor
Author
There was a problem hiding this comment.
Yes we did, actually there are 3 eager modes... (there's a debug mode as well), I did not put in the beginning since I found it confusing and one should use torch.compile for deployment anyway, but indeed the semi-compiled mode is faster in between strict compile and compiled...
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
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.
What does this PR do?
Rewrites the Neuron guide (
docs/source/en/optimization/neuron.md) for native TorchNeuron support and gives it the same layout as the TPU guide.AWS Trainium page
torch_neuronxbackend:pipe.to("neuron")andtorch.compile(backend="neuron").compile_repeated_blocks)TensorParallelConfig; text encoder stays on CPU; fixed-seed CPU generator)TORCH_NEURONX_NEFF_CACHE_DIR.Google TPU page
EagerMode.DEFER_AND_FUSE, enabled withTORCH_TPU_DEFER_AND_FUSE=1) to the execution-mode table.Both pages
_toctree.ymlrenamed to match.Validation
All Neuron snippets were run unmodified on trn2 (Neuron SDK 2.33 / torch-neuronx 2.14.3), and each produced a correct 1024² image:
compile_repeated_blocksThe TPU snippets weren't run; only the mode table changed there.
Before submitting
self-reviewskill on the diff?documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.