Skip to content

[ET-VK] Add missing VMA flush/invalidate calls in StagingBuffer copy methods#17341

Merged
meta-codesync[bot] merged 1 commit intogh/SS-JIA/416/basefrom
gh/SS-JIA/416/head
Feb 10, 2026
Merged

[ET-VK] Add missing VMA flush/invalidate calls in StagingBuffer copy methods#17341
meta-codesync[bot] merged 1 commit intogh/SS-JIA/416/basefrom
gh/SS-JIA/416/head

Conversation

@SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Feb 10, 2026

Stack from ghstack (oldest at bottom):

copy_from correctly calls vmaFlushAllocation after writing to the staging buffer, and copy_to correctly calls vmaInvalidateAllocation before reading, but the cast-and-copy variants were missing these calls. On devices with non-coherent memory, this could cause the GPU to read stale data (missing flush) or the CPU to read stale data (missing invalidate). This change adds the missing vmaFlushAllocation to cast_and_copy_from and cast_half_to_float_and_copy_from, and the missing vmaInvalidateAllocation to cast_and_copy_to. cast_float_to_half_and_copy_to already had the invalidate call and was not changed.

Authored with Claude.

Differential Revision: D92843801

…methods

`copy_from` correctly calls `vmaFlushAllocation` after writing to the staging buffer, and `copy_to` correctly calls `vmaInvalidateAllocation` before reading, but the cast-and-copy variants were missing these calls. On devices with non-coherent memory, this could cause the GPU to read stale data (missing flush) or the CPU to read stale data (missing invalidate). This change adds the missing `vmaFlushAllocation` to `cast_and_copy_from` and `cast_half_to_float_and_copy_from`, and the missing `vmaInvalidateAllocation` to `cast_and_copy_to`. `cast_float_to_half_and_copy_to` already had the invalidate call and was not changed.

Authored with Claude.

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

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 10, 2026

🔗 Helpful Links

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

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

❌ 8 New Failures, 1 Pending, 3 Unrelated Failures

As of commit 1c96f11 with merge base ba89c69 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were 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.

SS-JIA pushed a commit that referenced this pull request Feb 10, 2026
…methods

`copy_from` correctly calls `vmaFlushAllocation` after writing to the staging buffer, and `copy_to` correctly calls `vmaInvalidateAllocation` before reading, but the cast-and-copy variants were missing these calls. On devices with non-coherent memory, this could cause the GPU to read stale data (missing flush) or the CPU to read stale data (missing invalidate). This change adds the missing `vmaFlushAllocation` to `cast_and_copy_from` and `cast_half_to_float_and_copy_from`, and the missing `vmaInvalidateAllocation` to `cast_and_copy_to`. `cast_float_to_half_and_copy_to` already had the invalidate call and was not changed.

Authored with Claude.

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

ghstack-source-id: 339903807
Pull Request resolved: #17341
@meta-cla meta-cla 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 Feb 10, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

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

@meta-codesync meta-codesync bot merged commit 3261839 into gh/SS-JIA/416/base Feb 10, 2026
179 of 195 checks passed
@meta-codesync meta-codesync bot deleted the gh/SS-JIA/416/head branch February 10, 2026 21:43
metascroy pushed a commit that referenced this pull request Feb 12, 2026
…methods (#17352)

This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: #17341 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/416/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/416/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/416/orig
Differential Revision:
[D92843801](https://our.internmc.facebook.com/intern/diff/D92843801/)
@diff-train-skip-merge

Co-authored-by: ssjia <ssjia@devvm26340.ftw0.facebook.com>
chizkiyahu pushed a commit to chizkiyahu/executorch that referenced this pull request Feb 23, 2026
…methods (pytorch#17352)

This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: pytorch#17341 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/416/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/416/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/416/orig
Differential Revision:
[D92843801](https://our.internmc.facebook.com/intern/diff/D92843801/)
@diff-train-skip-merge

Co-authored-by: ssjia <ssjia@devvm26340.ftw0.facebook.com>
chizkiyahu pushed a commit to chizkiyahu/executorch that referenced this pull request Feb 23, 2026
…methods (pytorch#17352)

This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: pytorch#17341 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/416/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/416/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/416/orig
Differential Revision:
[D92843801](https://our.internmc.facebook.com/intern/diff/D92843801/)
@diff-train-skip-merge

Co-authored-by: ssjia <ssjia@devvm26340.ftw0.facebook.com>
chizkiyahu pushed a commit to chizkiyahu/executorch that referenced this pull request Feb 23, 2026
…methods (pytorch#17352)

This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: pytorch#17341 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/416/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/SS-JIA/416/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/416/orig
Differential Revision:
[D92843801](https://our.internmc.facebook.com/intern/diff/D92843801/)
@diff-train-skip-merge

Co-authored-by: ssjia <ssjia@devvm26340.ftw0.facebook.com>
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 meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants