PTX 2.1: Stack


I’m currently looking through the PTX 2.1 specification and noticed something strange in section 5.1.5, Local State Space. The specification says that “local memory variables declared within a function or kernel body are allocated on the stack”. What exactly does it mean with “local memory variables”? Only variables that are declared as “.local.type varname”? What about registers? Suppose I write a value into a register called d before the recursion occurs, then the recursive call is executed and than d is read again - does d contain the value written before the recursive call or the value written by the deepest recursive call? The latter appears strange to me, but this is actually what the document suggests. Unfortunately, I don’t have a Fermi available at the moment, so I’d be glad to hear from someone who can test that out.

Hmm, what about .shared/.global/.const declarations within a function? Do they point to the same address for every recursive invocation of the function?