Skip to content

Limitations of automatic differentiation #3279

Answered by csyonghe
chenzhekl asked this question in Q&A
Discussion options

You must be logged in to vote

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 call InterlockedAdd to natively accumulate the value from all threads into a single buffer location.

This certainly leads to high contention (and…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@chenzhekl
Comment options

@csyonghe
Comment options

@chenzhekl
Comment options

Answer selected by chenzhekl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants