Go to the documentation of this file.
8 static const char source_common_func[] = R
"(
11 // memory bank conflict-free address and local buffer size
12 #ifdef LM_NUM_MEM_BANKS
13 #define LM_ADDR(address) (address + ((address) / LM_NUM_MEM_BANKS))
14 #define LM_SIZE(size) (size + (size) / LM_NUM_MEM_BANKS)
17 #define SWAP_KEYS(x, y) \
22 #define SWAP_VALUES(x, y) \
27 // nearest power of two number greater equals n
28 uint ceil_to_pow2(uint n) {
34 // find first element in a sorted array such x <= element
35 uint lower_bound(const uint x,
38 __global const uint* array) {
42 if (array[first + step] < x) {
43 first = first + step + 1;
52 // find first element in a sorted array such x <= element
53 uint lower_bound_local(const uint x,
56 __local const uint* array) {
60 if (array[first + step] < x) {
61 first = first + step + 1;