Skip to content

[PyTorch Pinned Allocator] Add support of background thread to process events#135524

Closed
banitag1 wants to merge 1 commit intopytorch:mainfrom
banitag1:export-D62396585
Closed

[PyTorch Pinned Allocator] Add support of background thread to process events#135524
banitag1 wants to merge 1 commit intopytorch:mainfrom
banitag1:export-D62396585

Conversation

@banitag1
Copy link
Contributor

@banitag1 banitag1 commented Sep 9, 2024

Summary: Currently we process events in the regular allocation path and we call cudaEventQuery to check on the events and this path can take some locks in libcuda driver. Its not entirely needed to do process events in the allocation path, we could move this to a background thread and keep processing events regularly and put the freed block to the free list.

Differential Revision: D62396585

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 9, 2024

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit fbb1062 with merge base b76d1b7 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62396585

@banitag1
Copy link
Contributor Author

@pytorchbot label "topic: not user facing

@banitag1
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

@pytorch pytorch deleted a comment from pytorch-bot bot Sep 11, 2024
@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Sep 11, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62396585

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62396585

…s events (pytorch#135524)

Summary:
Pull Request resolved: pytorch#135524

Currently we process events in the regular allocation path and we call cudaEventQuery to check on the events and this path can take some locks in libcuda driver. Its not entirely needed to do process events in the allocation path, we could move this to a background thread and keep processing events regularly and put the freed block to the free list.

Reviewed By: mrajpal

Differential Revision: D62396585
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D62396585

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 17, 2024
@facebook-github-bot
Copy link
Contributor

@pytorchbot merge -f 'Landed internally'

(Initiating merge automatically since Phabricator Diff has merged, using force because this PR might not pass merge_rules.json but landed internally)

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

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

Chao1Han pushed a commit to Chao1Han/pytorch that referenced this pull request Sep 20, 2024
…s events (pytorch#135524)

Summary: Currently we process events in the regular allocation path and we call cudaEventQuery to check on the events and this path can take some locks in libcuda driver. Its not entirely needed to do process events in the allocation path, we could move this to a background thread and keep processing events regularly and put the freed block to the free list.

Differential Revision: D62396585

Pull Request resolved: pytorch#135524
Approved by: https://github.com/zyan0
pytorchmergebot pushed a commit that referenced this pull request Aug 14, 2025
# Motivation
#135524 only introduces the support of background thread for CUDA, this PR intends to support it for other backend such as XPU as well.

Pull Request resolved: #160505
Approved by: https://github.com/albanD
chuanhaozhuge pushed a commit that referenced this pull request Aug 14, 2025
# Motivation
#135524 only introduces the support of background thread for CUDA, this PR intends to support it for other backend such as XPU as well.

Pull Request resolved: #160505
Approved by: https://github.com/albanD
chuanhaozhuge pushed a commit that referenced this pull request Aug 18, 2025
# Motivation
#135524 only introduces the support of background thread for CUDA, this PR intends to support it for other backend such as XPU as well.

Pull Request resolved: #160505
Approved by: https://github.com/albanD
can-gaa-hou pushed a commit to can-gaa-hou/pytorch that referenced this pull request Aug 22, 2025
…160505)

# Motivation
pytorch#135524 only introduces the support of background thread for CUDA, this PR intends to support it for other backend such as XPU as well.

Pull Request resolved: pytorch#160505
Approved by: https://github.com/albanD
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
…160505)

# Motivation
pytorch#135524 only introduces the support of background thread for CUDA, this PR intends to support it for other backend such as XPU as well.

Pull Request resolved: pytorch#160505
Approved by: https://github.com/albanD
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 fb-exported Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants