Skip to content

[MemTracker] Fix: Remove monkey patching DTensor dispatch#167580

Closed
sanketpurandare wants to merge 1 commit intopytorch:mainfrom
sanketpurandare:mem_tracker_fix
Closed

[MemTracker] Fix: Remove monkey patching DTensor dispatch#167580
sanketpurandare wants to merge 1 commit intopytorch:mainfrom
sanketpurandare:mem_tracker_fix

Conversation

@sanketpurandare
Copy link
Contributor

@sanketpurandare sanketpurandare commented Nov 11, 2025

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 11, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/167580

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 4 Unrelated Failures

As of commit 41725b9 with merge base 1f7e434 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: sanketpurandare / name: Sanket Jayant Purandare (41725b9)

@pytorch-bot pytorch-bot bot added oncall: distributed Add this issue/PR to distributed oncall triage queue release notes: distributed (fsdp) release notes category labels Nov 11, 2025
@sanketpurandare sanketpurandare added release notes: distributed (tools) topic: not user facing topic category ciflow/trunk Trigger trunk jobs on your pull request labels Nov 11, 2025
@sanketpurandare sanketpurandare changed the title Mem tracker fix [MemTracker] Fix: Remove monkey patching DTensor dispatch Nov 11, 2025
@swolchok
Copy link
Contributor

Seems reasonable to me, but I've never implemented one of these. Is there anyone who would be better to review?

@anshul-si anshul-si self-requested a review November 11, 2025 22:23
Copy link
Contributor

@anshul-si anshul-si left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sanketpurandare
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 2 jobs have failed, first few of them are: trunk / macos-py3-arm64 / test (mps, 1, 1, macos-m2-15), trunk / macos-py3-arm64 / test (mps, 1, 1, macos-m1-14)

Details for Dev Infra team Raised by workflow job

@pytorch pytorch deleted a comment from pytorch-bot bot Nov 12, 2025
@pytorch pytorch deleted a comment from pytorch-bot bot Nov 12, 2025
@sanketpurandare
Copy link
Contributor Author

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

swolchok added a commit that referenced this pull request Nov 12, 2025
…Python OpSchema in the DTensor dispatch fast path"

All we need to do is move a few checks around.

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Nov 12, 2025
…th for `DTensor.__torch_dispatch__`"

This patches the `__torch_dispatch__` machinery to detect DTensor and hand over control to a C++ fast path. Unlike #166370 and #166369 (which added a DTensor dispatch key and are intended to be replaced by this PR), this approach fundamentally *is* `__torch_dispatch__`, hopefully sidestepping all manner of thorny "does it work just like `__torch_dispatch__`?" that came up during development and review of #166370.

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Nov 12, 2025
…__torch_dispatch__`"

This patches the `__torch_dispatch__` machinery to detect DTensor and hand over control to a C++ fast path. Unlike #166370 and #166369 (which added a DTensor dispatch key and are intended to be replaced by this PR), this approach fundamentally *is* `__torch_dispatch__`, hopefully sidestepping all manner of thorny "does it work just like `__torch_dispatch__`?" that came up during development and review of #166370.

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Nov 12, 2025
…sor fast path to local operator dispatch"

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Nov 12, 2025
… local operator dispatch"

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Nov 12, 2025
…th: port return_and_correct_aliasing and inplace/out checks"

This seems to generate a several-microsecond performance improvement in the detach benchmark I've been using.

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Nov 12, 2025
…and_correct_aliasing and inplace/out checks"

This seems to generate a several-microsecond performance improvement in the detach benchmark I've been using.

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Nov 12, 2025
…in the DTensor dispatch fast path"

All we need to do is move a few checks around.

cc H-Huang awgu wanchaol fegin fduwjj wz337 wconstab d4l3k pragupta msaroufim dcci

[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged oncall: distributed Add this issue/PR to distributed oncall triage queue release notes: distributed (fsdp) release notes category release notes: distributed (tools) topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants