Repository navigation
Vulkan: fix the shared-device test and Windows builds after #23151 - #24843
Conversation
…3151 Summary: pytorch#23151 broke several Buck builds: `vulkan_shared_device_test` compares Vulkan queue handles with `VK_NULL_HANDLE`, which some Vulkan headers define as `0`, so gtest compares a pointer with an int and the test does not compile. Compare with `nullptr`. The `_no_volk` variants of that test link `libvulkan`, which the Linux, Android and Apple test hosts do not have. Keep only the volk variant. `vulkan_compute_api` exported `vulkan_shared:runtime`, which pulls in the ExecuTorch runtime. A Windows binary that links the compute API with `link_style = "shared"` then builds `portable_type` as a DLL, which fails to link. The compute API only needs `SharedVulkanDevice`, so move it into its own `vulkan_shared:device` target with no runtime deps and export that instead. On Windows, callers declared the shared API `dllimport`, so a binary that links the static build of the library cannot resolve it. Drop `dllimport` for callers; a plain declaration links against both the import library and the static library. Authored with Metamate (agentcloud). Reviewed By: shoumikhin Differential Revision: D130716215
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24843
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@SS-JIA has exported this pull request. If you are a Meta employee, you can view the originating Diff in D130716215. |
This PR needs a
|
There was a problem hiding this comment.
🔵 Needs a closer look
The Windows static/shared-linking fix requires native Buck validation of exports across the newly separated device and runtime libraries, but the internal Buck wrapper and Windows toolchain are unavailable in this review snapshot.
No open issues 🎉
What changed in this PR
This PR addresses Buck build regressions introduced by #23151’s shared Vulkan context integration, covering test compilation, dependency isolation, and Windows linking.
Changes:
- Use
nullptrfor queue-handle assertions and retain only the volk-based shared-device test. - Split
SharedVulkanDeviceinto a runtime-independent target for the Vulkan compute API. - Remove Windows caller-side
dllimportto support both static and import-library linking.
| File | Description |
|---|---|
backends/vulkan/test/shared_device/SharedDeviceAdapterTest.cpp |
Replace null-handle assertion operands with nullptr. |
backends/vulkan/targets.bzl |
Export the device-only dependency and remove the no-volk test variant. |
backends/vulkan_shared/targets.bzl |
Separate the shared device from runtime-dependent components. |
backends/vulkan_shared/runtime/export.h |
Use plain API declarations for Windows callers. |
Review effort: Balanced
Summary:
#23151 broke several Buck builds:
vulkan_shared_device_testcompares Vulkan queue handles withVK_NULL_HANDLE, which some Vulkan headers define as0, so gtest compares a pointer with an int and the test does not compile. Compare withnullptr.The
_no_volkvariants of that test linklibvulkan, which the Linux, Android and Apple test hosts do not have. Keep only the volk variant.vulkan_compute_apiexportedvulkan_shared:runtime, which pulls in the ExecuTorch runtime. A Windows binary that links the compute API withlink_style = "shared"then buildsportable_typeas a DLL, which fails to link. The compute API only needsSharedVulkanDevice, so move it into its ownvulkan_shared:devicetarget with no runtime deps and export that instead.On Windows, callers declared the shared API
dllimport, so a binary that links the static build of the library cannot resolve it. Dropdllimportfor callers; a plain declaration links against both the import library and the static library.Authored with Metamate (agentcloud).
Reviewed By: shoumikhin
Differential Revision: D130716215
cc @manuelcandales @digantdesai @cbilgin