Repository navigation
[graph_trainer]Remove _remove_dead_empty_strided_chains workaround - #3496
Merged
Merged
Conversation
SherlockNoMad
marked this pull request as ready for review
June 3, 2026 20:54
SherlockNoMad
requested review from
IvanKobzarev,
aditvenk,
sanketpurandare,
tianyu-l,
xmfan and
yiming0416
as code owners
June 3, 2026 20:54
sanketpurandare
approved these changes
Jun 3, 2026
DO NOT MERGE until pytorch/pytorch #185865 (or a reland) is in the CI nightly. #3480 added `_remove_dead_empty_strided_chains` as a workaround: DTensor shard propagation ran each op on fake global-shape tensors for metadata, and when make_fx captured that inference it left a dead `empty_strided`-backed "shadow" node for every DTensor op. Bounds-checked ops (`aten.embedding`, `nll_loss`) read the uninitialized `empty_strided` index/target and tripped device-side asserts for any `tensor_parallel_degree > 1` aot_fx_trace config. The proper upstream fix wraps the fake-tensor metadata inference in `disable_proxy_modes_tracing` inside `ShardingPropagator._propagate_tensor_meta_non_cached`, so the shadow nodes never enter the make_fx graph (pytorch/pytorch #185865). That makes this DCE a no-op, so remove it. Caveat: #185865 is not yet in the cu130 nightly that graph_trainer CI installs (unpinned `--pre torch`). Until it lands there, this PR's CI will fail with the shadow-node asserts (e.g. the bitwise-deterministic and AutoParallel TP tests). Hold until the nightly contains the fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
SherlockNoMad
force-pushed
the
graph_trainer/remove-empty-strided-shadow-dce
branch
from
June 4, 2026 21:07
6a03351 to
daac1a9
Compare
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
#3480 added
_remove_dead_empty_strided_chainsas a workaround for a DTensor + make_fx bug: shard propagation runs each op on fake global-shape tensors to derive metadata, and when make_fx captured that inference it left a deadempty_strided-backed "shadow" node for every DTensor op. Bounds-checked ops (aten.embedding,nll_loss) read the uninitializedempty_stridedindex/target and trippeddevice-side assertfor anytensor_parallel_degree > 1aot_fx_traceconfig.The proper upstream fix wraps the fake-tensor metadata inference in
disable_proxy_modes_tracinginsideShardingPropagator._propagate_tensor_meta_non_cached, so the shadow nodes never enter the make_fx graph — pytorch/pytorch #185865. That makes this DCE a no-op, so this PR removes it (per the workaround's own docstring: "Remove this pass once that fix lands in the graph_trainer CI nightly.").Blocking dependency
--pre torch).embedding/nll_lossOOB device-side asserts return for TPaot_fx_tracepaths — e.g.test_bitwise_deterministic.pyand the AutoParallel TP tests.Test plan
Once #185865 is in the CI nightly, the existing graph_trainer suites are the validation (no behavior change expected):
🤖 Generated with Claude Code