[CudaTarget] Why do we need to cast the SPMD grid keywords? #656
Answered
by
inducer
kaushikcfd
asked this question in
Q&A
-
For example an // Grid size: (10, 1)
extern "C" __global__ void __launch_bounds__(1) arange(__global__ int *__restrict__ y)
{
y[((int32_t) blockIdx.x)] = ((int32_t) blockIdx.x);
} Notice the |
Beta Was this translation helpful? Give feedback.
Answered by
inducer
Aug 3, 2022
Replies: 1 comment 2 replies
-
Loopy codegen expects integer math to be signed. (It'll generate https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#dim3 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
kaushikcfd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Loopy codegen expects integer math to be signed. (It'll generate
a - b
asa + (-1)*b
for instance.)dim3
(the type of these{block,grid}{Dim,Idx}
variables) is based on unsigned integers:https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#dim3