Results 1 to 3 of 3

Thread: How to pass complex structures to kernel?

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    10

    How to pass complex structures to kernel?

    Hi,

    1) I have a small problem while copying the data to my kernel
    I need to pass the structures NODE_ab which is the node of a tree.
    I am confused on how to pass the tree to my kernel

    Code :
    typedef struct _list
     {
    	int data;
    	struct _list *next;
     }_list;
     typedef struct _list * LIST;
     
    typedef struct NODE_ab
    {
     int count;
     LIST marks;
     char data;
     struct NODE_ab* right;
     struct NODE_ab* left;
    } NODE_ab;

    2) Is it possible to do a clCreateBuffer with in the kernel?
    because the data is dynamic in nature and i don't want to create a large buffer
    and also my structures are complex as defined above.



    Regards

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

    Re: How to pass complex structures to kernel?

    Instead of pointers, use offsets from the start of the buffer.

    For more details, please see these previous replies:

    viewtopic.php?f=37&t=2900

    viewtopic.php?f=37&t=3777
    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
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: How to pass complex structures to kernel?

    2) Is it possible to do a clCreateBuffer with in the kernel?
    because the data is dynamic in nature and i don't want to create a large buffer
    and also my structures are complex as defined above.
    No, it's not possible to allocate memory dynamically inside a kernel. People will usually allocate one large buffer and divide it into smaller pieces inside the kernel.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. Replies: 1
    Last Post: 10-09-2009, 04:53 PM
  2. Passing arrays of complex structures
    By onegin in forum OpenCL
    Replies: 4
    Last Post: 07-21-2009, 11:32 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
  •