Results 1 to 5 of 5

Thread: clGetKernelWorkGroupInfo does not return correct local mem

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    2

    clGetKernelWorkGroupInfo does not return correct local mem

    I am trying to query the local memory usage of a kernel.
    The kernel takes a local memory argument.
    I am setting the size of the local memory with clSetKernelArg.
    Then simple try to use the function clGetKernelWorkGroupInfo with CL_KERNEL_LOCAL_MEM_SIZE to get the local mem usage.
    It gives me incorrect number.
    I am using cuda OpenCL.
    Any ideas?
    Thanks,
    Sunil Sathe

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: clGetKernelWorkGroupInfo does not return correct local m

    Can you show us the source code you are using to query the local memory size? Please include the calls to clSetKernelArg() and the source code of the kernel (at least we need to see the kernel arguments and all variable declarations).

    What value did you expect? What value was returned? Did you check whether the call to clGetKernelWorkGroupInfo() returned an error code?
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    2

    Re: clGetKernelWorkGroupInfo does not return correct local m

    Here is the kernel function

    __kernel void jacobi_local(int rows, __global int *ia, __global int *ja,
    __global float *diag, __global float *off_diag,
    __global float *x, __global float *b,
    __global float *y, __local int *lja,
    __local float *loff_diag)
    ......
    ......

    Here is the kernel argument setting and local mem query

    err = clSetKernelArg(*smooth_kr, 8, sizeof(int)*maxnz, NULL);
    err = clSetKernelArg(*smooth_kr, 9, sizeof(float)*maxnz, NULL);
    err = clGetKernelWorkGroupInfo(*smooth_kr, *device_id, CL_KERNEL_LOCAL_MEM_SIZE , sizeof(cl_ulong), &local_mem, NULL);

    maxnz ~ 1500, err returned is CL_SUCCESS.
    The value of local_mem is always 48 no matter what maxnz is.

    Thanks,

    Sunil

  4. #4
    Member
    Join Date
    Oct 2010
    Location
    Vancouver, Canada
    Posts
    66

    Re: clGetKernelWorkGroupInfo does not return correct local m

    Sounds like a bug in the implementation, I would report it to your vendor.

    Before checking the spec, I didn't realize that CL_KERNEL_LOCAL_MEM_SIZE was supposed to include the dynamically set arg sizes in the total. It may be that the driver implementor didn't either.

  5. #5

    Re: clGetKernelWorkGroupInfo does not return correct local m

    I had a similar problem with an earlier release of the Intel OpenCL implementation, posted this issue earlier, turned out to be an incorrect return value from CL_DEVICE_MAX_MEM_ALLOC_SIZE .

    I guess we can only hope these drawbacks will stabilize with updates...

    http://www.khronos.org/message_board...hp?f=28&t=3236

Similar Threads

  1. Replies: 1
    Last Post: 01-17-2012, 09:29 AM
  2. Register and local mem problems
    By arthur.sw in forum OpenCL
    Replies: 4
    Last Post: 05-09-2011, 07:12 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
  •