cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

billyc59
Journeyman III

OpenCL pipes communication: Parent and Child kernels

Jump to solution

Hi, I'm trying to get 2 kernels to communicate with each other using pipes.

1 parent kernel writes to a pipe, and enqueues a child kernel.
Meanwhile a child kernel reads from the pipe, and writes to another pipe, that will be read by the parent.
There are 2 different pipes. 
One is:  write end -> parent, read-end -> child.  The other is write-end -> child, read-end -> parent.  
The call for the parent kernel to read from the child kernel write pipe is placed directly after the enqueue is performed.  The child does not enqueue the parent.
My reserve ID is failing to return back a valid ID for the read.  What am I doing wrong? 

Am I wrong to assume that the control flow returns back to the parent kernel after the child kernels finish executing? 
If so, then what is the control flow?

0 Likes
1 Solution

Accepted Solutions
jtrudeau
Staff
Staff

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

Yes, that is correct.

View solution in original post

0 Likes
7 Replies
billyc59
Journeyman III

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

I will post my kernel as soon as I get into work tomorrow. 

0 Likes
jtrudeau
Staff
Staff

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

Just FYI - have you seen the blog on Pipes? http://developer.amd.com/community/blog/2014/10/31/opencl-2-0-pipes/

Let me know if you do not find your answer there.

0 Likes
jtrudeau
Staff
Staff

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

>>Am I wrong to assume that the control flow returns back to the parent kernel after the child kernels finish executing?

The blog author reviewed your post. Hope this helps.

Yes, that is an incorrect assumption. The design of parent kernel should not assume waiting for results of child kernel. They are completely asynchronous and there is no way in current OpenCL specification to ensure sync point between them. The Breadth-First-Search sample in 3.0 Beta demonstrates the use of pipes read/write that are passed between parent and child kernels.

billyc59
Journeyman III

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

Thanks for the reply.

So if I were to understand this correctly, in order to pass the child pipe's information back to the parent kernel, a new instance of the parent kernel must be made, using enqueue_kernel. 

The instance of the parent kernel used to call the child kernel is destroyed after its termination. 

Is this correct?

0 Likes
billyc59
Journeyman III

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

That particular blog entry didn't illustrate what I wanted to do, which was to test out the communication schemes between a parent kernel, and an instantiated child kernel.  If I recall correctly, "pipes producer consumer" had 2 kernels called from the host.
Hence, why I decided to experiment and see what pipes and device-side enqueues were capable (and not capable) of doing, by testing out my initial assumption. 

0 Likes
jtrudeau
Staff
Staff

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

Yes, that is correct.

View solution in original post

0 Likes
billyc59
Journeyman III

Re: OpenCL pipes communication: Parent and Child kernels

Jump to solution

Thank you!

0 Likes