Skip to content

[mps] Turn on inductor dynamic shapes tests #159456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from

Conversation

[ghstack-poisoned]
@angelayi angelayi requested a review from a team as a code owner July 30, 2025 07:27
Copy link

pytorch-bot bot commented Jul 30, 2025

🔗 Helpful Links

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

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:

✅ You can merge normally! (3 Unrelated Failures)

As of commit 9d6cebf with merge base aeb5321 (image):

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

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

@pytorch-bot pytorch-bot bot added ciflow/inductor ciflow/mps Run MPS tests (subset of trunk) module: inductor labels Jul 30, 2025
angelayi added a commit that referenced this pull request Jul 30, 2025
ghstack-source-id: 35ecbd2
Pull-Request-resolved: #159456
@angelayi angelayi added the keep-going Don't stop on first failure, keep running tests until the end label Jul 30, 2025
[ghstack-poisoned]
@angelayi angelayi added the topic: not user facing topic category label Jul 30, 2025
angelayi added a commit that referenced this pull request Jul 30, 2025
ghstack-source-id: e38c1fd
Pull-Request-resolved: #159456
@angelayi angelayi changed the title [aoti][mps] Turn on dynamic shapes tests [mps] Turn on inductor dynamic shapes tests Jul 30, 2025
@angelayi angelayi requested review from malfet and desertfire July 30, 2025 16:32
[ghstack-poisoned]
angelayi added a commit that referenced this pull request Jul 31, 2025
ghstack-source-id: 8d0bb39
Pull-Request-resolved: #159456
[ghstack-poisoned]
angelayi added a commit that referenced this pull request Jul 31, 2025
ghstack-source-id: a575c17
Pull-Request-resolved: #159456
[ghstack-poisoned]
angelayi added a commit that referenced this pull request Aug 1, 2025
ghstack-source-id: 3dc75a0
Pull-Request-resolved: #159456
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@angelayi
Copy link
Contributor Author

angelayi commented Aug 4, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 4, 2025
@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

@davidberard98
Copy link
Contributor

@pytorchbot revert -c ghfirst -m "Sorry - this causes a merge conflict with #159798, which I'm trying to land with co-dev to resolve a sev"

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

pytorchmergebot added a commit that referenced this pull request Aug 4, 2025
This reverts commit 19f1f99.

Reverted #159456 on behalf of https://github.com/davidberard98 due to Sorry - this causes a merge conflict with #159798, which I'm trying to land with co-dev to resolve a sev ([comment](#159456 (comment)))
@pytorchmergebot
Copy link
Collaborator

@angelayi your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Aug 4, 2025
[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Starting merge as part of PR stack under #159695

pytorchmergebot pushed a commit that referenced this pull request Aug 5, 2025
Pull Request resolved: #159695
Approved by: https://github.com/malfet
ghstack dependencies: #159456
pytorchmergebot pushed a commit that referenced this pull request Aug 6, 2025
In some cases we have mps kernels which are reused across higher-order-op subgraphs and the toplevel code. However, currently we initialize the variable for the mps kernel the first time we use it, which runs into an issue if we run into the mps kernel within a subgraph since the kernel will only be initialized within the subgraph scope. For instance:
```
if ...
    auto mps_lib_0_func = ...
    mps_lib_0_func->run()

// since we already used mps_lib_0 once, we don't re-initialize it
mps_lib_0_func->run()  // error, mps_lib_0_func not initialized
```

So the solution we took here is to initialize all the kernels at the beginning:
```
const std::shared_ptr<at::native::mps::MetalKernelFunction> get_mps_lib_0() {
    static const auto func = mps_lib_0.getKernelFunction("generated_kernel");
    return func;
}
AOTIMetalKernelFunctionHandle get_mps_lib_0_handle() {
    static const auto handle = AOTIMetalKernelFunctionHandle(get_mps_lib_0().get());
    return handle;
}
...
if ...
    get_mps_lib_0()->run()

get_mps_lib_0()->run()  // success
```

Pull Request resolved: #159753
Approved by: https://github.com/malfet
ghstack dependencies: #159456, #159695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-no-td Do not run TD on this PR ciflow/inductor ciflow/mps Run MPS tests (subset of trunk) ciflow/trunk Trigger trunk jobs on your pull request keep-going Don't stop on first failure, keep running tests until the end Merged module: inductor Reverted topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants