boostorg / compute

A C++ GPU Computing Library for OpenCL
http://boostorg.github.io/compute/
Boost Software License 1.0
1.56k stars 333 forks source link

Fix duplicates using custom compare with bitonic block sort #803

Closed rosenrodt closed 5 years ago

rosenrodt commented 5 years ago

I have modified test case to reproduce the issue as described in #774. And a fix is proposed

Tested on:

jszuppe commented 5 years ago

Thanks! I'll look into today or later this week and merge.

jszuppe commented 5 years ago

It would be great if you can change the order of commits: first test which shows the bug, then commit with a fix. Please reference issue id in the fix commit. If you have problems with doing that, or don't know how to do it using git, don't worry, I'll do that for you. Thanks again for submitting a fix and testing it on two platforms!

rosenrodt commented 5 years ago

I’ll do that once I get back to my computer. Do I simply force-push to rewrite the git history?

jszuppe commented 5 years ago

Yes, force push will work.

rosenrodt commented 5 years ago

@jszuppe thanks. i've rearranged the commits

jszuppe commented 5 years ago

After looking at it.

  1. Will it work correctly if we do opposite: force them not to do the swap if they are equal? This is always one local memory operation less. I think the bug is/was that if there are equal values one is swapped and one is not.
  2. If 1. does not work, then I think we can at least limit your fix to sort_by_key situation only.

But in generally fix is ok.

rosenrodt commented 5 years ago
  1. That will do too. I have pushed them too in the PR
  2. The fix concerns bitonic_block_sort with sort_by_key = false. So I am not sure what you mean by that. Although I haven't looked into it but does the CPU equivalent or bitonic_block_sort with sort_by_key = true could possibly repro issue #774 too?

btw the Travis build server seems to complain about missing CL.h

jszuppe commented 5 years ago
  1. Ok
  2. Yeah, you're right. I think it can apply sort-by-key situation too with keys, but of course this fixes also that problem.
jszuppe commented 5 years ago

btw the Travis build server seems to complain about missing CL.h

Yeah, I'll have to fix Travis CI script someday.... Too much work at work ;)