Results 1 to 3 of 3

Thread: Dive into Registers

  1. #1
    Senior Member
    Join Date
    Oct 2012
    Posts
    165

    Dive into Registers

    Hi there,

    I'm still not very shure about the registers. A little example:

    Code :
    __kernel void foo(const float param)
    {
      unit id = get_global_id(0);
      float val = param * id;
    }

    Ignoring that this code will be completely optimized to nothing, how many registers would this kernel need? Two for the two internal values? 3 for the internals + the constant parameter?
    I know that it is not that easy, because many operations need additional registers and i think even get_global_id needs some (after seeing the asm generated after compiling that kernel)
    And what about that param. Is it in the constant memory (and therefor cached global mem with register speed) or somewhere locally? And if i have 30 Kernelparameters, will they all fit into that same cached memory?
    Last Question: Does the Compiler recycle registers? does he test if it wont beneeded anymore and the registers can be reused for further local variables.

    Thanks to all for any help.
    Clint3112

  2. #2

    Re: Dive into Registers

    The answer to this question depends entirely on the hardware vendor and the compiler they ship with their OpenCL implementation. The vendors are free to allocate registers using whatever scheme they choose.

  3. #3
    Senior Member
    Join Date
    Oct 2012
    Posts
    165

    Re: Dive into Registers


    Sad to hear. But i think on NVidia it should be the same as the way they do it in cuda? Am i right?

Similar Threads

  1. reduce the number of registers used
    By opencl_beginner in forum OpenCL
    Replies: 0
    Last Post: 12-16-2010, 05:08 AM
  2. Replies: 4
    Last Post: 08-13-2009, 06:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •