Skip caching_allocator_warmup on Neuron (no reuse pool to warm; currently OOMs)#47029
Draft
dacorvo wants to merge 2 commits into
Draft
Skip caching_allocator_warmup on Neuron (no reuse pool to warm; currently OOMs)#47029dacorvo wants to merge 2 commits into
dacorvo wants to merge 2 commits into
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. |
Contributor
Author
|
Pushed without my consent by an overzealous agent, sorry about that. |
caching_allocator_warmup pre-allocates get_total_byte_count bytes per device in a single torch.empty(). The cuda/xpu branch clamps that with mem_get_info and mps is skipped (#46239); every other accelerator, including neuron (a PrivateUse1 backend), falls through to the unclamped allocation. On Neuron this OOMs the NeuronCore during from_pretrained, before any weight is placed, and provides no benefit: Neuron keeps no CUDA-style reuse pool for the warmup to fill (torch_neuronx.memory_stats() reports reserved_bytes == 0 even while memory is allocated, and pre-warming shows no measured speedup), and torch.neuron exposes no mem_get_info so the allocation cannot be bounded. Skip warmup on neuron, mirroring the mps skip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1b8b78b to
5987414
Compare
Remove outdated comments regarding Neuron device warmup.
Contributor
CI recapDashboard: View test results in Grafana |
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?
caching_allocator_warmuppre-allocatesget_total_byte_countbytes per device in a singletorch.empty(...). Thecuda/xpubranch bounds that allocation against device capacity viamem_get_info;mpsis skipped (#46239). Every other accelerator device — includingneuron(AWS Trainium/Inferentia, a PrivateUse1 backend) — falls through to the unclamped allocation, which
OOMs the NeuronCore during
from_pretrained, before any weight is loaded:This happens because since
torch.neuronexposes nomem_get_info, the allocation can't be bounded.Incidentally, the warmup provides no benefit. on Neuron, since the backend keeps no CUDA-style reuse pool for a warm-up to fill:
torch_neuronx.memory_stats()reportsreserved_bytes = 0even while 2 GB is allocated.Skipping therefore costs nothing and fixes the OOM — the same trade-off as the MPS skip (#46239).
Before submitting
sweep with the skip applied — the warmup allocations are gone, models load up to their real footprint,
and TP>1 models that previously passed still pass (no regression). transformers CI has no Neuron runner,
as with the MPS skip.
Who can review?
@Cyrilvallez @SunMarc (reviewed the related warmup PRs #36380 / #46145; cf. the MPS skip #46239)