Results 1 to 2 of 2

Thread: Confusion about task vs NDRange implementaions

  1. #1
    Join Date
    Dec 2014
    Posts
    10
    Rep Power
    1

    Default Confusion about task vs NDRange implementaions

    I'm attempting to implement a simple barrel shifter. I'm able to get it to work using a task based approach but am unable to do so using an NDRange based kernel. I've posted both kernels below. I'd appreciate some insight into how the implementation of the NDRange approach differs from the task.

    __kernel
    __attribute__((reqd_work_group_size(360,1,1)))
    __attribute__((max_work_group_size(360)))
    void barrelShifter_nd(
    __global unsigned char * restrict dataIn,
    const uint shift,
    __global unsigned char * restrict dataOut
    )
    {
    char __attribute((register)) din[720];

    uint gid = get_global_id(0);

    din[gid] = dataIn[gid] & 0x1;
    din[360+gid] = dataIn[gid] & 0x1;


    dataOut[gid] = din[shift+gid];

    }




    __kernel
    __attribute__((task))
    void barrelShifter_task(
    __global unsigned char * restrict dataIn,
    const uint shift,
    __global unsigned char * restrict dataOut
    )
    {
    char __attribute((register)) din[720];

    for(uint i=0; i<360; i++)
    {
    din[i] = dataIn[i] & 0x1;
    din[360+i] = dataIn[i] & 0x1;
    }

    #pragma unroll
    for(uint i=0; i<360; i++)
    {
    dataOut[i] = din[shift+i];
    }

    }

  2. #2
    Join Date
    Jan 2017
    Posts
    335
    Rep Power
    1

    Default Re: Confusion about task vs NDRange implementaions

    It is not possible to infer shift registers of any type in NDRange kernels. As per OpenCL's specification, there is no guarantee of thread ordering in this kernel type, and local memory consistency is only guaranteed at barriers. It is not possible to describe a shift register in NDRange kernels, while conforming to both of these conditions.

Similar Threads

  1. Replies: 11
    Last Post: July 20th, 2017, 01:04 AM
  2. Compile kernel as task not as NDRange
    By L30nardoSV in forum OpenCL
    Replies: 5
    Last Post: March 20th, 2017, 11:57 AM
  3. NDRange Channel Implementation
    By amaier17 in forum OpenCL
    Replies: 4
    Last Post: October 3rd, 2016, 08:54 AM
  4. DMA memtest.c confusion
    By fpganewbie in forum General Software Forum
    Replies: 5
    Last Post: November 10th, 2009, 07:27 PM

Bookmarks

Posting Permissions

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