Skip to content

[xpu][feature] [1/2] Introduce XPUPluggableAllocator in cpp part - #168966

Closed
guangyey wants to merge 20 commits into
gh/guangyey/250/basefrom
gh/guangyey/250/head
Closed

guangyey wants to merge 20 commits into
gh/guangyey/250/basefrom
gh/guangyey/250/head

Conversation

@guangyey

@guangyey guangyey commented Nov 24, 2025 •

Copy link
Copy Markdown
Collaborator

Stack from ghstack (oldest at bottom):

Motivation

This PR aims to introduce XPUPluggableAllocator and we make it as simple as possible. The follow-up PR would introduce the code related to the Python frontend part.

@pytorch-bot

pytorch-bot Bot commented Nov 24, 2025 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit d87c03f with merge base c6ae757 (image):

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

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.

guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: 2698d75
Pull Request resolved: #168966
@guangyey guangyey added ciflow/trunk Trigger trunk jobs on your pull request ciflow/xpu Run XPU CI tasks release notes: xpu release notes category labels Nov 24, 2025
guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: 3c64244
Pull Request resolved: #168966
guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: 603ed17
Pull Request resolved: #168966
guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: 89918a9
Pull Request resolved: #168966
@guangyey guangyey changed the title [1/2] Introduce XPUPluggableAllocator in cpp part [xpu][feature] [1/2] Introduce XPUPluggableAllocator in cpp part Nov 24, 2025
guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: 89918a9
Pull Request resolved: #168966
guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: 455dfca
Pull Request resolved: #168966
guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: 8fdb22a
Pull Request resolved: #168966
guangyey added a commit that referenced this pull request Nov 24, 2025
ghstack-source-id: feecedd
Pull Request resolved: #168966
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
guangyey added a commit that referenced this pull request Nov 25, 2025
ghstack-source-id: c708aed
Pull Request resolved: #168966
Comment thread c10/xpu/XPUCachingAllocator.h Outdated

C10_XPU_API void resetPeakStats(DeviceIndex device);
inline void emptyCache(MempoolId_t mempool_id = {0, 0}) {
get()->emptyCache();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

missed the mempool_id?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, added.

guangyey added a commit that referenced this pull request Nov 25, 2025
ghstack-source-id: ec44ee4
Pull Request resolved: #168966
guangyey added a commit that referenced this pull request Nov 25, 2025
ghstack-source-id: 741b19a
Pull Request resolved: #168966
@guangyey

Copy link
Copy Markdown
Collaborator Author

@ezyang @albanD May I know if you could help review this stack of PR? They are intended to introduce XPUPluggableAllocator.

@albanD
albanD requested a review from eellison November 26, 2025 20:47
[ghstack-poisoned]
@guangyey

guangyey commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator Author

@ezyang @albanD @eellison When you have a moment, I’d appreciate any feedback on this PR stack.

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@guangyey

guangyey commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator Author

Thanks @eellison
@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: xpu / linux-noble-xpu-n-py3.10 / test (default, 6, 12, linux.idc.xpu)

Details for Dev Infra team Raised by workflow job

@guangyey

guangyey commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator Author

"log upload time out"
@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 2 checks: trunk / linux-jammy-rocm-py3.10 / test (default, 1, 6, linux.rocm.gpu.gfx942.1, unstable), xpu / linux-noble-xpu-n-py3.10 / test (default, 6, 12, linux.idc.xpu)

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 pushed a commit that referenced this pull request Dec 4, 2025
…#169043)

# Motivation
This PR aims to introduce `torch.xpu.memory.XPUPluggableAllocator` and focus on the frontend part. Meanwhile, we introduce an API `torch.xpu.memory.change_current_allocator` that used to change the current `XPUAllocator`. Both APIs has the CUDA counterpart.

# Additional Context
This API would be used in popular repos such as https://github.com/search?q=repo%3Avllm-project%2Fvllm%20cudapluggableallocator&type=code

Pull Request resolved: #169043
Approved by: https://github.com/EikanWang, https://github.com/gujinghui, https://github.com/eellison
ghstack dependencies: #168966
JacobSzwejbka pushed a commit that referenced this pull request Dec 8, 2025
JacobSzwejbka pushed a commit that referenced this pull request Dec 8, 2025
…#169043)

# Motivation
This PR aims to introduce `torch.xpu.memory.XPUPluggableAllocator` and focus on the frontend part. Meanwhile, we introduce an API `torch.xpu.memory.change_current_allocator` that used to change the current `XPUAllocator`. Both APIs has the CUDA counterpart.

# Additional Context
This API would be used in popular repos such as https://github.com/search?q=repo%3Avllm-project%2Fvllm%20cudapluggableallocator&type=code

Pull Request resolved: #169043
Approved by: https://github.com/EikanWang, https://github.com/gujinghui, https://github.com/eellison
ghstack dependencies: #168966
tiendatngcs pushed a commit to tiendatngcs/pytorch-Dec25 that referenced this pull request Dec 9, 2025
@github-actions
github-actions Bot deleted the gh/guangyey/250/head branch January 4, 2026 02:21
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 ciflow/xpu Run XPU CI tasks Merged open source release notes: xpu release notes category

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants