@@ -232,16 +232,50 @@ void namedBarrier() {
232
232
fence::team (atomic::release);
233
233
}
234
234
235
+ // sema checking of amdgcn_fence is aggressive. Intention is to patch clang
236
+ // so that it is usable within a template environment and so that a runtime
237
+ // value of the memory order is expanded to this switch within clang/llvm.
235
238
void fenceTeam (atomic::OrderingTy Ordering) {
236
- return __scoped_atomic_thread_fence (Ordering, atomic::workgroup);
239
+ switch (Ordering) {
240
+ default :
241
+ __builtin_unreachable ();
242
+ case atomic::aquire:
243
+ return __builtin_amdgcn_fence (atomic::aquire, " workgroup" );
244
+ case atomic::release:
245
+ return __builtin_amdgcn_fence (atomic::release, " workgroup" );
246
+ case atomic::acq_rel:
247
+ return __builtin_amdgcn_fence (atomic::acq_rel, " workgroup" );
248
+ case atomic::seq_cst:
249
+ return __builtin_amdgcn_fence (atomic::seq_cst, " workgroup" );
250
+ }
237
251
}
238
-
239
252
void fenceKernel (atomic::OrderingTy Ordering) {
240
- return __scoped_atomic_thread_fence (Ordering, atomic::device_);
253
+ switch (Ordering) {
254
+ default :
255
+ __builtin_unreachable ();
256
+ case atomic::aquire:
257
+ return __builtin_amdgcn_fence (atomic::aquire, " agent" );
258
+ case atomic::release:
259
+ return __builtin_amdgcn_fence (atomic::release, " agent" );
260
+ case atomic::acq_rel:
261
+ return __builtin_amdgcn_fence (atomic::acq_rel, " agent" );
262
+ case atomic::seq_cst:
263
+ return __builtin_amdgcn_fence (atomic::seq_cst, " agent" );
264
+ }
241
265
}
242
-
243
266
void fenceSystem (atomic::OrderingTy Ordering) {
244
- return __scoped_atomic_thread_fence (Ordering, atomic::system );
267
+ switch (Ordering) {
268
+ default :
269
+ __builtin_unreachable ();
270
+ case atomic::aquire:
271
+ return __builtin_amdgcn_fence (atomic::aquire, " " );
272
+ case atomic::release:
273
+ return __builtin_amdgcn_fence (atomic::release, " " );
274
+ case atomic::acq_rel:
275
+ return __builtin_amdgcn_fence (atomic::acq_rel, " " );
276
+ case atomic::seq_cst:
277
+ return __builtin_amdgcn_fence (atomic::seq_cst, " " );
278
+ }
245
279
}
246
280
247
281
void syncWarp (__kmpc_impl_lanemask_t ) {
0 commit comments