-
Thanks for releasing this great shader language! I would like to use slang for GPGPU tasks but have a few questions:
It would be greatly appreciated if you could help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Thank you for your interest in trying out Slang for your project! The tutorial might be a little misleading in that Slang does support auto-diffing the box filter. It is just that Slang cannot differentiate through a global memory access operation. In the case where you are accessing a global buffer/texture, you need to wrap that with a function, e.g. the This certainly leads to high contention (and therefore low performance), and this is exactly the reason why Slang does not do it automatically for you. By providing a custom derivative to If you wish to use Slang code in Vulkan, just write a normal compute shader entry point can call your existing Slang functions. You can then compile your compute shader into glsl / spirv and use it in Vulkan. You can use the
|
Beta Was this translation helpful? Give feedback.
Thank you for your interest in trying out Slang for your project! The tutorial might be a little misleading in that Slang does support auto-diffing the box filter. It is just that Slang cannot differentiate through a global memory access operation. In the case where you are accessing a global buffer/texture, you need to wrap that with a function, e.g. the
getInputElement
function in the example, and through the custom derivative of that function, specify how you want the gradients to be accumulated in the target buffer. In the example, we simply callInterlockedAdd
to natively accumulate the value from all threads into a single buffer location.This certainly leads to high contention (and…