Skip to content

Commit

Permalink
Merge pull request #534 from jvesely/opencl_extensions
Browse files Browse the repository at this point in the history
Check for available OpenCL extensions
  • Loading branch information
abergeron authored Sep 19, 2017
2 parents 4461ad8 + 4285e20 commit ace45c6
Show file tree
Hide file tree
Showing 2 changed files with 460 additions and 433 deletions.
19 changes: 14 additions & 5 deletions src/cluda_opencl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
#define ga_long long
#define ga_ulong ulong
#define ga_float float
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64: enable
#define ga_double double
#endif
#define ga_size ulong
#define ga_ssize long
#define GA_DECL_SHARED_PARAM(type, name) , __local type *name
Expand Down Expand Up @@ -109,6 +112,14 @@ static inline ga_half ga_float2half(ga_float f) {
#define atom_add_Il(a, b) atomic_add(a, b)
#define atom_xchg_Ig(a, b) atomic_xchg(a, b)
#define atom_xchg_Il(a, b) atomic_xchg(a, b)
/* ga_float */
gen_atom32_add(atom_add_fg, ga_float, global)
gen_atom32_add(atom_add_fl, ga_float, local)
#define atom_xchg_fg(a, b) atomic_xchg(a, b)
#define atom_xchg_fl(a, b) atomic_xchg(a, b)

#ifdef cl_khr_int64_base_atomics
#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
/* ga_long */
#define atom_add_lg(a, b) atom_add(a, b)
#define atom_add_ll(a, b) atom_add(a, b)
Expand All @@ -119,16 +130,14 @@ static inline ga_half ga_float2half(ga_float f) {
#define atom_add_Ll(a, b) atom_add(a, b)
#define atom_xchg_Lg(a, b) atom_xchg(a, b)
#define atom_xchg_Ll(a, b) atom_xchg(a, b)
/* ga_float */
gen_atom32_add(atom_add_fg, ga_float, global)
gen_atom32_add(atom_add_fl, ga_float, local)
#define atom_xchg_fg(a, b) atomic_xchg(a, b)
#define atom_xchg_fl(a, b) atomic_xchg(a, b)
/* ga_double */
#ifdef cl_khr_fp64
gen_atom64_add(atom_add_dg, ga_double, global)
gen_atom64_add(atom_add_dl, ga_double, local)
gen_atom64_xchg(atom_xchg_dg, ga_double, global)
gen_atom64_xchg(atom_xchg_dl, ga_double, local)
#endif
#endif
/* ga_half */
#define gen_atomh_add(name, aspace) \
ga_half name(volatile aspace ga_half *addr, ga_half val); \
Expand Down
Loading

0 comments on commit ace45c6

Please sign in to comment.