- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
My openCL project produced wrong output in hardware run, and after several days debug, I finally found out the reason. The index in one of my nested loop structure is messed up and I really don't why this would ever happen. I have a nest loop structure like this: ****----------------------------------------------------------------------**** __kernel void some_kernel() { ........ ........ for (uint m = 0; m < m_bound; m++) { for(uint n = 0; n < n_bound; n++) { ........ printf("m = %d, n = %d", m, n); } } } ........ ........ ****-------------------------------------------------------------------------**** Of course the actual code is much more complicated than this simplified version. At the the beginning of this nested loop structure, m got incremented before n reaches its loop bound!! the output is like this: ****-------------------------------------------------------------------------**** m = 0, n = 0 m = 1, n = 0 m = 0, n = 1 m = 1, n = 1 m = 0, n = 2 m = 1, n = 2 ............. ............. ****-----------------------------------------------------------------------**** And this only happens at the first few iterations(Only when m is 0 or 1). This is extremly weird, since in simulation it worked perfectly. Any advice would be greatly appreciated!! Best regards, LancerLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming this is a single work-item kernel, oop pipelining, performed by aoc, will launch the next iteration of the outer loop, and subsequently the inner loop as soon as it can if there are no dependencies. That seems to be the case here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply! Do you have any idea how can I remove such pipelining?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And I believe I have loop dependency. In the inner most loop (controlled by n), I assigned m to a variable.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page