Skip to content

Commit ab8e250

Browse files
committed
Update on "[ET-VK] Enable dynamic operator registration"
This change follows 1. in the footsteps of #2222 for static initialization and 2. the popular `TorchLibraryImpl` for wrapping with macros. https://www.internalfb.com/code/fbsource/[b6860acf0fd7a95224f2ed3f6fe48f699a9a45c0]/fbcode/caffe2/torch/library.h?lines=1004%2C1012-1026 Contributors can now write their operator and register them within the same file using `REGISTER_OPERATORS` + `VK_REGISTER_OP()`, as shown in `Arithmetic.h/cpp`. Typically in Linux/Android C++ environments, the symbols corresponding to `OperatorRegisterInit` static instances are discarded since they aren't used for anything other than static initialization. Hence, we need to `link_whole = True` for the `vulkan_graph_runtime` library. We update our Compute API tests to verify we can go through `OperatorRegistry` with proper static initialization. Differential Revision: [D54641117](https://our.internmc.facebook.com/intern/diff/D54641117/) [ghstack-poisoned]
1 parent f8bb45c commit ab8e250

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

backends/vulkan/targets.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ def define_common_targets():
8585
# VulkanBackend.cpp needs to compile with executor as whole
8686
# @lint-ignore BUCKLINT: Avoid `link_whole=True` (https://fburl.com/avoid-link-whole)
8787
link_whole = True,
88+
# Define an soname that can be used for dynamic loading in Java, Python, etc.
89+
soname = "libvulkan_graph_runtime.$(ext)",
8890
)

0 commit comments

Comments
 (0)