halide / Halide

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

[vulkan] Add runtime checks for shared memory usage #8288

Open derek-gerstmann opened 2 weeks ago

derek-gerstmann commented 2 weeks ago

nlmeans and stencil_chain_process appear to use too much shared memory on certain GPU configs with the current gpu tile size:

nlmeans: VUID-RuntimeSpirv-Workgroup-06530(ERROR / SPEC): msgNum: -1405964136 - Validation Error: [ VUID-RuntimeSpirv-Workgroup-06530 ] Object 0: handle = 0xfab64d0000000002, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0xac32b098 | vkCreateComputePipelines(): pCreateInfos[0].stage SPIR-V uses 89088 bytes of shared memory, which is more than maxComputeSharedMemorySize (49152). The Vulkan spec states: The sum of size in bytes for variables and padding in the Workgroup Storage Class in the GLCompute Execution Model must be less than or equal to maxComputeSharedMemorySize (https://vulkan.lunarg.com/doc/view/1.3.283.0/linux/1.3-extensions/vkspec.html#VUID-RuntimeSpirv-Workgroup-06530)

Add a runtime check for shared memory size and error out, and modify the gpu tile size for those apps.