Skip to content

Commit 4285e20

Browse files
committed
cluda_opencl: cl_khr_int64_base_atomics is optional extension
Signed-off-by: Jan Vesely <[email protected]>
1 parent df0fb2b commit 4285e20

File tree

2 files changed

+236
-223
lines changed

2 files changed

+236
-223
lines changed

src/cluda_opencl.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ static inline ga_half ga_float2half(ga_float f) {
112112
#define atom_add_Il(a, b) atomic_add(a, b)
113113
#define atom_xchg_Ig(a, b) atomic_xchg(a, b)
114114
#define atom_xchg_Il(a, b) atomic_xchg(a, b)
115+
/* ga_float */
116+
gen_atom32_add(atom_add_fg, ga_float, global)
117+
gen_atom32_add(atom_add_fl, ga_float, local)
118+
#define atom_xchg_fg(a, b) atomic_xchg(a, b)
119+
#define atom_xchg_fl(a, b) atomic_xchg(a, b)
120+
121+
#ifdef cl_khr_int64_base_atomics
122+
#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
115123
/* ga_long */
116124
#define atom_add_lg(a, b) atom_add(a, b)
117125
#define atom_add_ll(a, b) atom_add(a, b)
@@ -122,18 +130,14 @@ static inline ga_half ga_float2half(ga_float f) {
122130
#define atom_add_Ll(a, b) atom_add(a, b)
123131
#define atom_xchg_Lg(a, b) atom_xchg(a, b)
124132
#define atom_xchg_Ll(a, b) atom_xchg(a, b)
125-
/* ga_float */
126-
gen_atom32_add(atom_add_fg, ga_float, global)
127-
gen_atom32_add(atom_add_fl, ga_float, local)
128-
#define atom_xchg_fg(a, b) atomic_xchg(a, b)
129-
#define atom_xchg_fl(a, b) atomic_xchg(a, b)
130133
/* ga_double */
131134
#ifdef cl_khr_fp64
132135
gen_atom64_add(atom_add_dg, ga_double, global)
133136
gen_atom64_add(atom_add_dl, ga_double, local)
134137
gen_atom64_xchg(atom_xchg_dg, ga_double, global)
135138
gen_atom64_xchg(atom_xchg_dl, ga_double, local)
136139
#endif
140+
#endif
137141
/* ga_half */
138142
#define gen_atomh_add(name, aspace) \
139143
ga_half name(volatile aspace ga_half *addr, ga_half val); \

0 commit comments

Comments
 (0)