cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

ctwang_thomas
Journeyman III

How to reduce register using when global memory accessing

__kernel  code().................

{..................

for (i=0;i<1000000;i++)

{........................

    //generating B

    if   (some condition) then    {__global A=_private B}

....................}

....................}

----------------------------------------------------------------

the GPR in kernelanalyzer is 25.

mark the if statement, the GPR in kernelanalyzer is 11.

How to reduce the register using? THX

0 Likes
3 Replies
maximmoroz
Journeyman III

The reason here is most probably the same as it was in your other thread. If you comment "if" statement the compiler sees that it doesn't need to generate B at all and doesn't produce code which occupies registers.

0 Likes
ctwang_thomas
Journeyman III

but the new situation is that the if condition will hold for some unique work-item, so I can't delete the if statement since I do need the "answer in __private" copy to " __global area"  and then send to "host memory".

THX

0 Likes

So you have a kernel which consumes 25 registers. If you need help with reducing register usage you better copy the code of the kernel right here.

The fact that if you remove part of code you get less registers used by the kernel is irrelevant here - as far as the modified kernel doesn't do what you need.

And, by the way, could you tell me why do you need to reduce register usage? 25 registers looks fine.

0 Likes