Skip to content

Instantly share code, notes, and snippets.

@jszuppe
Created July 6, 2016 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jszuppe/989a2df43429fbdc9a4e68dacaa6fdce to your computer and use it in GitHub Desktop.
Save jszuppe/989a2df43429fbdc9a4e68dacaa6fdce to your computer and use it in GitHub Desktop.
// 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