Handle wrap of native buffers app-owned#8776
Draft
xFile3160 wants to merge 8 commits intohalide:mainfrom
Draft
Conversation
…ory allocator with custom Vulkan context Summary: In a situation where you'd want to set your own context (aka: you are integrating Halide in a system or app owning already Vulkan resources), the existing APIs expose the halide memory allocator as opaque handle, which does not allow an easy plug & play with a different allocator (like VMA). The changes proposed in this patch, would allow to set your own vkDevice, vkInstance, vkQueue, vkPhysicalDevice directly into Halide and use its own memory allocator, allowing integration in existing apps/systems. The behavior changed is: 1. use halide_vulkan_acquire_context with *allocator set to nullptr. (need to override the function). 2. use halide_vulkan_export_memory_allocator to retrieve the instance of the allocator and save it in your app. 3. use halide_vulkan_memory_allocator_release to properly release shader and allocator resources. (need to override). Test Plan: Simple app for testing provided in the apps folder: apps/vulkan_wrap_native_to_halide
Summary: To test out the flow of the functions and verify correctness. Test Plan: Build Halide with patch shaid: 1a6a9a7 Instructions to build: cmake -G Ninja -S . -B build \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_OSX_ARCHITECTURES=arm64 \ -DCMAKE_OSX_SYSROOT="$(xcrun --sdk macosx --show-sdk-path)" \ -DLLVM_DIR="$(brew --prefix llvm@19)/lib/cmake/llvm" \ -DHalide_WASM_BACKEND=wabt \ -DWITH_PYTHON_BINDINGS=OFF \ -DWITH_TUTORIALS=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DHalide_BUNDLE_STATIC=ON Then build: cmake --build build -j32 Then install: cmake --install build --prefix "$PWD/install" Then build the test app but first modify hardcoded paths in CMakeLists.txt cd apps/external_vk_demo mkdir build cd build cmake ../ make ./demo_main
Member
|
Why are a bunch of my commits in this branch? |
Author
|
I don't knew |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following patches include changes onto Halide for exporting the halide vulkan memory allocator such that an existing app could just override vkInstance, vkQueue, vkDevice, vkPhysicalDevice without worrying about custom memory allocator (see #8715).
I wrote also a demo application to prove the idea and flow.