The keyword "register" in CUDA

I have a large program that uses all the registers allocated for the stream (64) and spills into local memory. I would like to tell the compiler which variables should remain in registers at all costs, and which of them I really do not need. Is the C / C ++ "register" keyword running in nvcc? Is another mechanism possible?

Thanks!

+6
source share
1 answer

You can use register in CUDA C / C ++ if you want. In any context, this is just a hint to the compiler. It can be ignored. There is no guarantee that she does anything at all.

I think these statements are pretty much true for most language implementations of register .

I also think that it is likely that the compiler can do a better job than you can decide what should be in the registries, and the corresponding priority.

Typical CUDA C / C ++ mechanisms for managing register use operate at a higher level:

+10
source

Source: https://habr.com/ru/post/982709/


All Articles