Revision 3e2cb34bf112722368c296130b1424de267d2b3c authored by Tim Foley on 17 September 2020, 00:45:07 UTC, committed by GitHub on 17 September 2020, 00:45:07 UTC
The logic we use to compute `SV_DispatchThreadID` and friends for CUDA makes use of the `gridDim` and `blockDim` built-in variables in CUDA. These variables have type `dim3` which is similar to `uint3` but is considered a distinct type for some reason.

The logic for computing the `SV`s currently pretends that `gridDim` and `blockDim` are `uint3`s, and this means that the code they emit doesn't always compile cleanly (although it does in our existing test cases...).

This change adds a few overloads that work on `dim3` to the CUDA prelude and that seem to make the code we emit work again.

Note: This change should be seen as a somewhat hacky quick fix rather than a real resolution to the underlying issue. It is probably better if we emit code that replaces uses of `gridDim` with `uint3(gridDim.x, gridDim.y, gridDim.z)` instead, to ensure that we get the typing correct, even if the result looks less idiomatic.
1 parent 8dd0d26
History

back to top