# Total Number of Registers

I have a program with two kernels.
The first kernel call the second.
In profiler i have for the first kernel 48 registers and for the second 30 registers.
What does this mean?

1. The total number of registers are 48 of which 30 are used for the second kernel?
or
2. The total number of registers are 48 + 30 = 78?

Thanks to all.

child kernels may launch aside parent kernels, in which case you would view this as a concurrent kernel scenario - the new kernel will have threadblocks deposited if/when the SM resources are available for it.

Otherwise, the runtime may, at its discretion, and under unpublished rules/specifications, arrange for threadblocks of the parent to allow child threadblocks to be deposited.

In neither of those cases can you simply view the resource utlization as the sum (or not) of the kernels used by each thread (child/parent). Even considering a single kernel, a threadblock can be deposited if and when there are sufficient registers available for it. This is not to a first order determined by the number of registers per thread, but by the number of registers per threadblock, which depends on the registers per thread but also the threads per block.

The total number of registers used by a threadblock are the number of registers per thread times the number of threads per block. Period. Does not matter if it is a threadblock belonging to a parent kernel, or to a child kernel.

Thank you for your answer.
But its still unclear for me.
I have a parent kernel which call with <<<1,1>>>.
This kernel call a child kernel with <<<blocks,threads>>>.

The first kernel use 48 registers and the second one 30.
I want to calculate the occupancy in excel calculator.
In “Registers Per Thread” filed which value should i use, to choose the optimal threads per block value?
48, 30 or 48 + 30.

Thank you again.

You can only calculate (this kind of) occupancy for a single kernel at a time. Since your first kernel is just a single block, if it were me, I would just calculate occupancy for the 2nd kernel, as if it were launched by itself.

Thank you very much.