I’m getting a CL_BUILD_PROGRAM_FAILURE error, and a CL_INVALID_PROGRAM_EXECUTABLE error when using atomic_compare_exchange_strong in my OpenCL kernel. It runs if I comment out the atomic_compare_exchange_strong call. I’m not sure if there is also an error with my code that is also causing an error. This is how I’m using the function:
__kernel void RemoveInvalidNodeMods(
__global int *AllNodeModIndices,
){
int all_node_mods_index = get_global_id(0);
atomic_compare_exchange(&AllNodeModIndices[all_node_mods_index], &all_node_mods_index, -1);
}
I removed all the irrelevant code.
Also, I’m using the opencl.hpp header if that makes a difference.
Any help would be greatly appreciated.
I read that I need to add __opencl_c_generic_address_space, __opencl_c_atomic_order_seq_cst, and __opencl_c_atomic_scope_device features, but I’m not sure how to do that. I’ve tried to add #define for each in my c++ code and in the cl file, but neither worked.