KEMBAR78
[PyTorch][Vulkan] Allow 0-size tensors to be represented in PyTorch Vulkan by SS-JIA · Pull Request #111512 · pytorch/pytorch · GitHub
Skip to content

Conversation

@SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Oct 18, 2023

Summary:
0-size tensors are allowed in PyTorch (e.g. a tensor with size {2, 1, 0}). However, this currently causes issues with PyTorch Vulkan as the Vulkan API would raise an error when attempting to allocate a resource with no memory.

This diff fixes the behaviour by adding support for VulkanImage and VulkanBuffer objects that do not have any associated memory.

Test Plan:
Tested locally with vulkan_api_test on Mac as a sanity test.

buck run //xplat/caffe2:pt_vulkan_api_test_bin --target-platforms ovr_config//platform/macos:x86_64-fbsource -- --gtest_filter="*"

But given how foundational of a change this is, more extensive testing should be done in order to be safe.

Reviewed By: yipjustin

Differential Revision: D50030659

@pytorch-bot pytorch-bot bot added ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR module: vulkan labels Oct 18, 2023
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 18, 2023

🔗 Helpful Links

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

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 ee668b8 with merge base 675df75 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

@pytorch-bot pytorch-bot bot added the release notes: vulkan release notes category label Oct 18, 2023
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

…ulkan (pytorch#111512)

Summary:

0-size tensors are allowed in PyTorch (e.g. a tensor with size {2, 1, 0}). However, this currently causes issues with PyTorch Vulkan as the Vulkan API would raise an error when attempting to allocate a resource with no memory.

This diff fixes the behaviour by adding support for `VulkanImage` and `VulkanBuffer` objects that do not have any associated memory.

Test Plan:
Tested locally with `vulkan_api_test` on Mac as a sanity test.
```
buck run //xplat/caffe2:pt_vulkan_api_test_bin --target-platforms ovr_config//platform/macos:x86_64-fbsource -- --gtest_filter="*"
```

But given how foundational of a change this is, more extensive testing should be done in order to be safe.

Reviewed By: yipjustin

Differential Revision: D50030659
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

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

xuhancn pushed a commit to xuhancn/pytorch that referenced this pull request Nov 7, 2023
…ulkan (pytorch#111512)

Summary:
0-size tensors are allowed in PyTorch (e.g. a tensor with size {2, 1, 0}). However, this currently causes issues with PyTorch Vulkan as the Vulkan API would raise an error when attempting to allocate a resource with no memory.

This diff fixes the behaviour by adding support for `VulkanImage` and `VulkanBuffer` objects that do not have any associated memory.

Test Plan:
Tested locally with `vulkan_api_test` on Mac as a sanity test.
```
buck run //xplat/caffe2:pt_vulkan_api_test_bin --target-platforms ovr_config//platform/macos:x86_64-fbsource -- --gtest_filter="*"
```

But given how foundational of a change this is, more extensive testing should be done in order to be safe.

Reviewed By: yipjustin

Differential Revision: D50030659

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

Labels

ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged module: vulkan release notes: vulkan release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants