Skip to content

[CudaTarget] Why do we need to cast the SPMD grid keywords? #656

Answered by inducer
kaushikcfd asked this question in Q&A
Discussion options

You must be logged in to vote

Loopy codegen expects integer math to be signed. (It'll generate a - b as a + (-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

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@inducer
Comment options

@kaushikcfd
Comment options

kaushikcfd Aug 3, 2022
Collaborator Author

Answer selected by kaushikcfd
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