halide / Halide

a language for fast, portable data-parallel computation
https://halide-lang.org
Other
5.78k stars 1.07k forks source link

[vulkan] Dynamically load Vulkan loader library. Avoid Validation Layer crash on exit. #8289

Closed derek-gerstmann closed 1 week ago

derek-gerstmann commented 2 weeks ago

As suggested by @abadams , we should dynamically load the Vulkan loader library methods, and then use those to create an instance, rather than requiring a link-time dependency.

Also added runtime checks to verify the amount of shared memory required by the compiled pipeline is supported by the device. See https://github.com/halide/Halide/issues/8288

Detect if VK_LAYER_KHRONOS_validation is enabled, and bypass the module destructor which calls halide_vulkan_device_release() to avoid a segfault (at the cost of leaking!). See: https://github.com/halide/Halide/issues/8290.

Add vk_validate_shader_for_device() method to check shader bindings against device limits prior to compiling to verify shader compatibility. See: #8297 #8296 #8295 #8294 #8288

abadams commented 1 week ago

Is this good to merge? I don't remember the conclusion from the dev meeting.

derek-gerstmann commented 1 week ago

Yes, this is good to merge and fixes most of the issues we were seeing.