Skip to content

Change default of torchgen headeronly-install-dir to depend on install-dir - #181434

Closed
janeyx99 wants to merge 1 commit into
gh/janeyx99/360/basefrom
gh/janeyx99/360/head
Closed

janeyx99 wants to merge 1 commit into
gh/janeyx99/360/basefrom
gh/janeyx99/360/head

Conversation

@janeyx99

@janeyx99 janeyx99 commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

This is a "forward fix" of #181161 and will need to be cherrypicked to make sure xpu builds still work. To describe the issue:

  • torch-xpu-ops has its own version of tags.yaml
  • the natural default of headeronly-install-dir had the XPU build overriding the enum_tags.h, and since their tag.yaml weren't the same as ours, we get build issues
  • I tried fixing this before by just aligning the torch-xpu-ops version of tags.yaml but we're still adding more tags so that problem will come back
  • I finally decided the fix is just to make the the default doesn't have the install locations colliding even if it makes the default for torchgen a tad more complicated.

Test plan:
make sure the XPU build on the PR stacked on top of this one passes.

Stack from ghstack (oldest at bottom):

@pytorch-bot

pytorch-bot Bot commented Apr 24, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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 ad8331b with merge base 96ddb61 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Apr 24, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #181437

5 similar comments
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #181437

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #181437

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #181437

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #181437

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #181437

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #181437

wdvr added a commit to wdvr/pytorch that referenced this pull request Apr 26, 2026
When a ghstack PR fails to merge because a parent PR in the stack lacks
required approvals, the error surfaced from `find_matching_merge_rule`
gives no hint about which PR in the stack is missing approval. The user
sees "Approvers from one of the following sets are needed: ..." on the
top PR even though the parent is the one missing reviewers, which makes
it confusing to debug (e.g. PR pytorch#181437 hit this where the parent PR
pytorch#181434 was the one without core approval).

Wrap the per-PR `find_matching_merge_rule` call in `merge_ghstack_into`
to re-raise with the failing PR number prefixed, preserving the original
exception type so callers that distinguish `MandatoryChecksMissingError`
from `MergeRuleFailedError` keep working.

Authored with Claude.
pytorchmergebot pushed a commit that referenced this pull request Apr 26, 2026
## Summary

When a ghstack PR fails to merge because a parent PR in the stack lacks required approvals (or required checks), the error surfaced by `merge_ghstack_into` gives no hint about which PR in the stack is the problem. The user sees something like:

> Approvers from one of the following sets are needed:
> - superuser (pytorch/metamates)
> - Core Reviewers (...)
> - Core Maintainers (...)

…posted on the top PR — even though it's actually a parent that needs the approval.

This just hit #181437: the top PR only changes `.github/workflows/pull.yml` (covered by the OSS CI rule, fully approved), but the parent #181434 only changes `torchgen/gen.py`, which has no specific merge rule and falls through to the catch-all `*` rules requiring Core Reviewers / Core Maintainers / superuser. None of the parent's reviewers were in those sets, but the merge bot only ever named the top PR.

## Change

Wrap the per-PR `find_matching_merge_rule` call inside `merge_ghstack_into` to re-raise with the failing PR number prefixed, preserving the original exception subclass (so callers that distinguish `MandatoryChecksMissingError` from `MergeRuleFailedError` keep working — that distinction drives retry behavior at trymerge.py:2391/2444).

After this PR, the same failure surfaces as:

> Merge rule check failed for stacked PR #181434:
>
> Approvers from one of the following sets are needed: …

## Test plan

- [x] Added `test_merge_ghstack_into_wraps_parent_rule_error` — verifies the failing parent's PR number appears in the message and the exception is `MergeRuleFailedError` but **not** the `MandatoryChecksMissingError` subclass.
- [x] Added `test_merge_ghstack_into_preserves_mandatory_checks_subclass` — verifies a `MandatoryChecksMissingError` from a parent stays a `MandatoryChecksMissingError` so retry behavior keeps working.
- [x] `pytest .github/scripts/test_trymerge.py::TestGitHubPRGhstackDependencies` — 4 passed, 1 skipped (pre-existing).

Authored with Claude.
Pull Request resolved: #181506
Approved by: https://github.com/huydhn
zxd1997066 added a commit to daisyden/pytorch that referenced this pull request Apr 27, 2026
… to depend on install-dir

This is a cherry-pick of upstream commit 1539d69 to fix XPU build issues.

The problem:
- torch-xpu-ops has its own version of tags.yaml
- the natural default of headeronly-install-dir had the XPU build overriding enum_tags.h
- since their tags.yaml weren't the same as ours, we get build issues

The solution:
- Make headeronly-install-dir default to <install-dir>/core when --install-dir is set
- This prevents the install locations from colliding

This commit will ensure XPU builds work correctly.

Related: pytorch#181434
malfet pushed a commit that referenced this pull request Apr 28, 2026
* [pytorch][PR] Reland D100546620: Move at::Tag to headeronly, add library.def override to allow tags (#181161)

Summary:
Reland of D100546620 which was reverted by D101431332 due to breaking libhammer.so.

Custom ops benefit from using tags. This PR moves at::Tag to torch::headeronly::Tag and adds a shim for stable Library.def to be able to take in tags.

Note: The two BUILD.bazel changes from the original diff were already present on master (the revert did not touch them), so this reland omits those files.

Old PR was: #180190

Differential Revision: D102031366

Pull Request resolved: #181161
Approved by: https://github.com/seemethere, https://github.com/atalman

* Change default of torchgen headeronly-install-dir to depend on install-dir (#181434)

This is a "forward fix" of #181161 and will need to be cherrypicked to make sure xpu builds still work. To describe the issue:
- torch-xpu-ops has its own version of tags.yaml
- the natural default of headeronly-install-dir had the XPU build overriding the enum_tags.h, and since their tag.yaml weren't the same as ours, we get build issues
- I tried fixing this before by just aligning the torch-xpu-ops version of tags.yaml but we're still adding more tags so that problem will come back
- I finally decided the fix is just to make the the default doesn't have the install locations colliding even if it makes the default for torchgen a tad more complicated.

Test plan:
make sure the XPU build on the PR stacked on top of this one passes.

Pull Request resolved: #181434
Approved by: https://github.com/EikanWang, https://github.com/wdvr
@janeyx99

Copy link
Copy Markdown
Contributor Author

Reverted uncleanly by #181788

@github-actions
github-actions Bot deleted the gh/janeyx99/360/head branch May 30, 2026 02:27
aperson30 pushed a commit to aperson30/pytorch that referenced this pull request Jun 20, 2026
…l-dir (pytorch#181434)

This is a "forward fix" of pytorch#181161 and will need to be cherrypicked to make sure xpu builds still work. To describe the issue:
- torch-xpu-ops has its own version of tags.yaml
- the natural default of headeronly-install-dir had the XPU build overriding the enum_tags.h, and since their tag.yaml weren't the same as ours, we get build issues
- I tried fixing this before by just aligning the torch-xpu-ops version of tags.yaml but we're still adding more tags so that problem will come back
- I finally decided the fix is just to make the the default doesn't have the install locations colliding even if it makes the default for torchgen a tad more complicated.

Test plan:
make sure the XPU build on the PR stacked on top of this one passes.

Pull Request resolved: pytorch#181434
Approved by: https://github.com/EikanWang, https://github.com/wdvr
aperson30 pushed a commit to aperson30/pytorch that referenced this pull request Jun 20, 2026
…81506)

## Summary

When a ghstack PR fails to merge because a parent PR in the stack lacks required approvals (or required checks), the error surfaced by `merge_ghstack_into` gives no hint about which PR in the stack is the problem. The user sees something like:

> Approvers from one of the following sets are needed:
> - superuser (pytorch/metamates)
> - Core Reviewers (...)
> - Core Maintainers (...)

…posted on the top PR — even though it's actually a parent that needs the approval.

This just hit pytorch#181437: the top PR only changes `.github/workflows/pull.yml` (covered by the OSS CI rule, fully approved), but the parent pytorch#181434 only changes `torchgen/gen.py`, which has no specific merge rule and falls through to the catch-all `*` rules requiring Core Reviewers / Core Maintainers / superuser. None of the parent's reviewers were in those sets, but the merge bot only ever named the top PR.

## Change

Wrap the per-PR `find_matching_merge_rule` call inside `merge_ghstack_into` to re-raise with the failing PR number prefixed, preserving the original exception subclass (so callers that distinguish `MandatoryChecksMissingError` from `MergeRuleFailedError` keep working — that distinction drives retry behavior at trymerge.py:2391/2444).

After this PR, the same failure surfaces as:

> Merge rule check failed for stacked PR pytorch#181434:
>
> Approvers from one of the following sets are needed: …

## Test plan

- [x] Added `test_merge_ghstack_into_wraps_parent_rule_error` — verifies the failing parent's PR number appears in the message and the exception is `MergeRuleFailedError` but **not** the `MandatoryChecksMissingError` subclass.
- [x] Added `test_merge_ghstack_into_preserves_mandatory_checks_subclass` — verifies a `MandatoryChecksMissingError` from a parent stays a `MandatoryChecksMissingError` so retry behavior keeps working.
- [x] `pytest .github/scripts/test_trymerge.py::TestGitHubPRGhstackDependencies` — 4 passed, 1 skipped (pre-existing).

Authored with Claude.
Pull Request resolved: pytorch#181506
Approved by: https://github.com/huydhn
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…l-dir (pytorch#181434)

This is a "forward fix" of pytorch#181161 and will need to be cherrypicked to make sure xpu builds still work. To describe the issue:
- torch-xpu-ops has its own version of tags.yaml
- the natural default of headeronly-install-dir had the XPU build overriding the enum_tags.h, and since their tag.yaml weren't the same as ours, we get build issues
- I tried fixing this before by just aligning the torch-xpu-ops version of tags.yaml but we're still adding more tags so that problem will come back
- I finally decided the fix is just to make the the default doesn't have the install locations colliding even if it makes the default for torchgen a tad more complicated.

Test plan:
make sure the XPU build on the PR stacked on top of this one passes.

Pull Request resolved: pytorch#181434
Approved by: https://github.com/EikanWang, https://github.com/wdvr
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…81506)

## Summary

When a ghstack PR fails to merge because a parent PR in the stack lacks required approvals (or required checks), the error surfaced by `merge_ghstack_into` gives no hint about which PR in the stack is the problem. The user sees something like:

> Approvers from one of the following sets are needed:
> - superuser (pytorch/metamates)
> - Core Reviewers (...)
> - Core Maintainers (...)

…posted on the top PR — even though it's actually a parent that needs the approval.

This just hit pytorch#181437: the top PR only changes `.github/workflows/pull.yml` (covered by the OSS CI rule, fully approved), but the parent pytorch#181434 only changes `torchgen/gen.py`, which has no specific merge rule and falls through to the catch-all `*` rules requiring Core Reviewers / Core Maintainers / superuser. None of the parent's reviewers were in those sets, but the merge bot only ever named the top PR.

## Change

Wrap the per-PR `find_matching_merge_rule` call inside `merge_ghstack_into` to re-raise with the failing PR number prefixed, preserving the original exception subclass (so callers that distinguish `MandatoryChecksMissingError` from `MergeRuleFailedError` keep working — that distinction drives retry behavior at trymerge.py:2391/2444).

After this PR, the same failure surfaces as:

> Merge rule check failed for stacked PR pytorch#181434:
>
> Approvers from one of the following sets are needed: …

## Test plan

- [x] Added `test_merge_ghstack_into_wraps_parent_rule_error` — verifies the failing parent's PR number appears in the message and the exception is `MergeRuleFailedError` but **not** the `MandatoryChecksMissingError` subclass.
- [x] Added `test_merge_ghstack_into_preserves_mandatory_checks_subclass` — verifies a `MandatoryChecksMissingError` from a parent stays a `MandatoryChecksMissingError` so retry behavior keeps working.
- [x] `pytest .github/scripts/test_trymerge.py::TestGitHubPRGhstackDependencies` — 4 passed, 1 skipped (pre-existing).

Authored with Claude.
Pull Request resolved: pytorch#181506
Approved by: https://github.com/huydhn
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…l-dir (pytorch#181434)

This is a "forward fix" of pytorch#181161 and will need to be cherrypicked to make sure xpu builds still work. To describe the issue:
- torch-xpu-ops has its own version of tags.yaml
- the natural default of headeronly-install-dir had the XPU build overriding the enum_tags.h, and since their tag.yaml weren't the same as ours, we get build issues
- I tried fixing this before by just aligning the torch-xpu-ops version of tags.yaml but we're still adding more tags so that problem will come back
- I finally decided the fix is just to make the the default doesn't have the install locations colliding even if it makes the default for torchgen a tad more complicated.

Test plan:
make sure the XPU build on the PR stacked on top of this one passes.

Pull Request resolved: pytorch#181434
Approved by: https://github.com/EikanWang, https://github.com/wdvr
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…81506)

## Summary

When a ghstack PR fails to merge because a parent PR in the stack lacks required approvals (or required checks), the error surfaced by `merge_ghstack_into` gives no hint about which PR in the stack is the problem. The user sees something like:

> Approvers from one of the following sets are needed:
> - superuser (pytorch/metamates)
> - Core Reviewers (...)
> - Core Maintainers (...)

…posted on the top PR — even though it's actually a parent that needs the approval.

This just hit pytorch#181437: the top PR only changes `.github/workflows/pull.yml` (covered by the OSS CI rule, fully approved), but the parent pytorch#181434 only changes `torchgen/gen.py`, which has no specific merge rule and falls through to the catch-all `*` rules requiring Core Reviewers / Core Maintainers / superuser. None of the parent's reviewers were in those sets, but the merge bot only ever named the top PR.

## Change

Wrap the per-PR `find_matching_merge_rule` call inside `merge_ghstack_into` to re-raise with the failing PR number prefixed, preserving the original exception subclass (so callers that distinguish `MandatoryChecksMissingError` from `MergeRuleFailedError` keep working — that distinction drives retry behavior at trymerge.py:2391/2444).

After this PR, the same failure surfaces as:

> Merge rule check failed for stacked PR pytorch#181434:
>
> Approvers from one of the following sets are needed: …

## Test plan

- [x] Added `test_merge_ghstack_into_wraps_parent_rule_error` — verifies the failing parent's PR number appears in the message and the exception is `MergeRuleFailedError` but **not** the `MandatoryChecksMissingError` subclass.
- [x] Added `test_merge_ghstack_into_preserves_mandatory_checks_subclass` — verifies a `MandatoryChecksMissingError` from a parent stays a `MandatoryChecksMissingError` so retry behavior keeps working.
- [x] `pytest .github/scripts/test_trymerge.py::TestGitHubPRGhstackDependencies` — 4 passed, 1 skipped (pre-existing).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants