Skip to content

[inductor] Hold GPU lock across multi-kernel comparison - #192876

Closed
eellison wants to merge 1 commit into
pytorch:mainfrom
eellison:review/multi-kernel-atomic-lock-20260810
Closed

eellison wants to merge 1 commit into
pytorch:mainfrom
eellison:review/multi-kernel-atomic-lock-20260810

Conversation

@eellison

@eellison eellison commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Benchmark all candidates in a runtime multi-kernel comparison under one registered GPU benchmark lock. This prevents concurrent compile workers from interleaving candidate measurements on the same GPU. Existing per-candidate benchmark locking remains nested through the reentrant lock contract.

Candidate ordering, forced and cached choices, and benchmark failure behavior are unchanged.

Test plan

  • python -m pytest -q test/inductor/test_multi_kernel.py -k "benchmark_sub_kernels_holds_gpu_lock_across_candidates or benchmark_sub_kernels_releases_gpu_lock_on_failure"
  • Existing multi-kernel softmax variants on B200

The focused lock tests verify one lock scope covers all candidates and that exceptions release the lock.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

@pytorch-bot

pytorch-bot Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ You can merge normally! (3 Unrelated Failures)

As of commit 21ae04f with merge base b8392fb (image):

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

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

@eellison eellison added the topic: not user facing topic category label Aug 11, 2026
@eellison
eellison marked this pull request as ready for review August 11, 2026 22:27
@eellison

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -i

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 28, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: inductor / unit-test / inductor-cpu-test / test (inductor_amx, 1, 2, mt-l-x86iamx-8-64)

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

@eellison

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -f "taking a while"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@pytorchmergebot

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

orrangetabby17 pushed a commit to orrangetabby17/pytorch that referenced this pull request Sep 2, 2026
## Summary

Benchmark all candidates in a runtime multi-kernel comparison under one registered GPU benchmark lock. This prevents concurrent compile workers from interleaving candidate measurements on the same GPU. Existing per-candidate benchmark locking remains nested through the reentrant lock contract.

Candidate ordering, forced and cached choices, and benchmark failure behavior are unchanged.

## Test plan

- `python -m pytest -q test/inductor/test_multi_kernel.py -k "benchmark_sub_kernels_holds_gpu_lock_across_candidates or benchmark_sub_kernels_releases_gpu_lock_on_failure"`
- Existing multi-kernel softmax variants on B200

The focused lock tests verify one lock scope covers all candidates and that exceptions release the lock.

Pull Request resolved: pytorch#192876
Approved by: https://github.com/zou3519
Sanskaaar1 pushed a commit to Sanskaaar1/pytorch that referenced this pull request Sep 8, 2026
## Summary

Benchmark all candidates in a runtime multi-kernel comparison under one registered GPU benchmark lock. This prevents concurrent compile workers from interleaving candidate measurements on the same GPU. Existing per-candidate benchmark locking remains nested through the reentrant lock contract.

Candidate ordering, forced and cached choices, and benchmark failure behavior are unchanged.

## Test plan

- `python -m pytest -q test/inductor/test_multi_kernel.py -k "benchmark_sub_kernels_holds_gpu_lock_across_candidates or benchmark_sub_kernels_releases_gpu_lock_on_failure"`
- Existing multi-kernel softmax variants on B200

The focused lock tests verify one lock scope covers all candidates and that exceptions release the lock.

Pull Request resolved: pytorch#192876
Approved by: https://github.com/zou3519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request Merged module: inductor topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants