Created
July 6, 2016 07:59
-
-
Save jszuppe/989a2df43429fbdc9a4e68dacaa6fdce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This kernel DOES NOT WORK | |
#define boost_pair_type(t1, t2) _pair_ ## t1 ## _ ## t2 ## _t | |
#define boost_pair_get(x, n) (n == 0 ? x.first ## x.second) | |
#define boost_make_pair(t1, x, t2, y) (boost_pair_type(t1, t2)) { x, y } | |
#define boost_tuple_get(x, n) (x.v ## n) | |
inline int ret42(){ return 42; } | |
__kernel void copy(__global int* _buf0, const uint count) | |
{ | |
uint block = (uint)ceil(((float)count)/get_global_size(0)); | |
uint start = get_global_id(0) * block; | |
uint end = min(count, start + block); | |
while(start < end){ | |
_buf0[start]=ret42(); | |
start++; | |
} | |
} | |
//Build log: | |
//CVMS_ERROR_COMPILER_FAILURE: CVMS compiler has crashed or hung building an element. | |
// ----------------------------------------------------------------------- | |
// This kernel works | |
#define boost_pair_type(t1, t2) _pair_ ## t1 ## _ ## t2 ## _t | |
#define boost_pair_get(x, n) (n == 0 ? x.first ## x.second) | |
#define boost_make_pair(t1, x, t2, y) (boost_pair_type(t1, t2)) { x, y } | |
#define boost_tuple_get(x, n) (x.v ## n) | |
__kernel void copy(__global int* _buf0, __global int* _buf1, const uint count) | |
{ | |
uint block = (uint)ceil(((float)count)/get_global_size(0)); | |
uint start = get_global_id(0) * block; | |
uint end = min(count, start + block); | |
while(start < end){ | |
_buf0[start]=_buf1[start]; | |
start++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment