CUDA "warpSize"?
- 1 min read
In CUDA C, the built-in variable warpSize is initially treated as a
variable at compile-time and doesn’t appear to be recognized as a
constant until the PTX generation phase. This could be an issue if the
warp width is part of some tricky preprocessing early in the
compilation.
The simple line:
const unsigned int w99 = warpSize * 99;`
is resolved to the following PTX:
mov.u32 %r5, WARP_SZ;
mul.lo.s32 %r6, %r5, 99;
Yes, the stage after PTX will do a great job folding/propagating away
WARP_SZ but sometimes you need to resolve logic in the preprocessor.
Including a #define WARP_SIZE 32 in your kernel is a workaround
until NVIDIA tells us otherwise.