Skip to content
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

[ET-VK][ez] Fix using a temporary variable when creating ComputePipeline #9405

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Mar 19, 2025

Stack from ghstack (oldest at bottom):

Context

Fix changes introduced in #8634 (D70021032).

This change decoupled local work group size from additional specialization constants. As part of this change, when creating a VkComputePipeline a temporary SpecVarList is created to merge the WorkgroupSize with additional specialization constants.

However, this can be an issue with some Vulkan drivers because the SpecVarList is a temporary, and thus will be destroyed at the end of the function call. The pointer stored in the VkSpecializationInfo will be invalidated, leading to undefined behaviour.

This diff fixes this by restoring the behaviour of ComputePipeline::Descriptor storing the specialization_constants directly.

Also fix the fact that the VkSpecializationMapEntry vector was also a temporary when creating a VkComputePipeline by storing it in ComputePipeline.

Differential Revision: D71488015

…line`

## Context

Fix changes introduced in #8634 (D70021032).

This change decoupled local work group size from additional specialization constants. As part of this change, when creating a `VkComputePipeline` a temporary `SpecVarList` is created to merge the `WorkgroupSize` with additional specialization constants.

However, this can be an issue with some Vulkan drivers because the `SpecVarList` is a temporary, and thus will be destroyed at the end of the function call. The pointer stored in the `VkSpecializationInfo` will be invalidated, leading to undefined behaviour.


This diff fixes this by restoring the behaviour of `ComputePipeline::Descriptor` storing the `specialization_constants` directly.

Also fix the fact that the `VkSpecializationMapEntry` vector was also a temporary when creating a `VkComputePipeline` by storing it in `ComputePipeline`.

Differential Revision: [D71488015](https://our.internmc.facebook.com/intern/diff/D71488015/)

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Mar 19, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit ed7e765 with merge base 6daff83 (image):

NEW FAILURE - The following job has failed:

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

SS-JIA added a commit that referenced this pull request Mar 19, 2025
…line`

## Context

Fix changes introduced in #8634 (D70021032).

This change decoupled local work group size from additional specialization constants. As part of this change, when creating a `VkComputePipeline` a temporary `SpecVarList` is created to merge the `WorkgroupSize` with additional specialization constants.

However, this can be an issue with some Vulkan drivers because the `SpecVarList` is a temporary, and thus will be destroyed at the end of the function call. The pointer stored in the `VkSpecializationInfo` will be invalidated, leading to undefined behaviour.


This diff fixes this by restoring the behaviour of `ComputePipeline::Descriptor` storing the `specialization_constants` directly.

Also fix the fact that the `VkSpecializationMapEntry` vector was also a temporary when creating a `VkComputePipeline` by storing it in `ComputePipeline`.

Differential Revision: [D71488015](https://our.internmc.facebook.com/intern/diff/D71488015/)

ghstack-source-id: 272783852
Pull Request resolved: #9405
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 19, 2025
@facebook-github-bot
Copy link
Contributor

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

Copy link

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@facebook-github-bot facebook-github-bot merged commit e9899fd into gh/SS-JIA/197/base Mar 20, 2025
80 of 84 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/SS-JIA/197/head branch March 20, 2025 19:15
SS-JIA added a commit that referenced this pull request Mar 20, 2025
…line` (#9464)

This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: #9405 by
@SS-JIA
^ Please use this as the source of truth for the PR details, comments,
and reviews
ghstack PR base:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/197/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/197/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/197/orig
@diff-train-skip-merge

Co-authored-by: Stephen Jia <[email protected]>
oscarandersson8218 pushed a commit to oscarandersson8218/executorch that referenced this pull request Mar 21, 2025
…line` (pytorch#9464)

This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: pytorch#9405 by
@SS-JIA
^ Please use this as the source of truth for the PR details, comments,
and reviews
ghstack PR base:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/197/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/197/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/main
Merge bot PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/197/orig
@diff-train-skip-merge

Co-authored-by: Stephen Jia <[email protected]>
SS-JIA added a commit that referenced this pull request Mar 26, 2025
## Context

As title; similar to #9016 since the interface for `ComputePipeline` descriptor was reverted in  #9405.

Differential Revision: [D71706868](https://our.internmc.facebook.com/intern/diff/D71706868/)

[ghstack-poisoned]
SS-JIA added a commit that referenced this pull request Mar 26, 2025
## Context

As title; similar to #9016 since the interface for `ComputePipeline` descriptor was reverted in  #9405.

Differential Revision: [D71706868](https://our.internmc.facebook.com/intern/diff/D71706868/)

ghstack-source-id: 274200673
Pull Request resolved: #9648
SS-JIA added a commit that referenced this pull request Mar 26, 2025
## Context

As title; similar to #9016 since the interface for `ComputePipeline` descriptor was reverted in  #9405.

Differential Revision: [D71706868](https://our.internmc.facebook.com/intern/diff/D71706868/)

[ghstack-poisoned]
SS-JIA added a commit that referenced this pull request Mar 26, 2025
Pull Request resolved: #9648

## Context

As title; similar to #9016 since the interface for `ComputePipeline` descriptor was reverted in  #9405.
ghstack-source-id: 274260087
@exported-using-ghexport

Differential Revision: [D71706868](https://our.internmc.facebook.com/intern/diff/D71706868/)
kirklandsign pushed a commit that referenced this pull request Mar 27, 2025
## Context

As title; similar to #9016 since the interface for `ComputePipeline` descriptor was reverted in  #9405.

Differential Revision: [D71706868](https://our.internmc.facebook.com/intern/diff/D71706868/)

[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants