I'm writing an OpenCL program that - among other things - needs to check a calculated (int
) value against a whitelist. My plan was to store the whitelist in constant or shared memory, and then have each thread run a Binary Search using this shared whitelist.
Then I read about things like bank conflicts, where threads are slowed down because they're accessing memory on the same bank, which causes a serialization of access to occur.
Is a binary search going to result in a larger performance loss on OpenCL due to issues like this? Would I be better off with some other search algorithm, like a hash?
Edit Let me clarify my program a bit:
Each thread will do a parralel calculation, but with a different input value. Thus, each thread will get a different output. Each output needs to be checked against the same whitelist.
The kernel will return a bool value that indicates the result of the search.
My concern is that, since each thread is doing an independent binary search, multiple threads will wind up accessing the same bank of the whitelist, causing a serial slowdown.