llvm-project

Форк
0
/
atomics-cas-remarks-gfx90a.cl 
43 строки · 2.4 Кб
1
// RUN: %clang_cc1 %s -cl-std=CL2.0 -O0 -triple=amdgcn-amd-amdhsa -target-cpu gfx90a \
2
// RUN:     -Rpass=atomic-expand -S -o - 2>&1 | \
3
// RUN:     FileCheck %s --check-prefix=REMARK
4

5
// RUN: %clang_cc1 %s -cl-std=CL2.0 -O0 -triple=amdgcn-amd-amdhsa -target-cpu gfx90a \
6
// RUN:     -Rpass=atomic-expand -emit-llvm -o - 2>&1 | \
7
// RUN:     FileCheck %s --check-prefix=GFX90A-CAS
8

9
// REQUIRES: amdgpu-registered-target
10

11
typedef enum memory_order {
12
  memory_order_relaxed = __ATOMIC_RELAXED,
13
  memory_order_acquire = __ATOMIC_ACQUIRE,
14
  memory_order_release = __ATOMIC_RELEASE,
15
  memory_order_acq_rel = __ATOMIC_ACQ_REL,
16
  memory_order_seq_cst = __ATOMIC_SEQ_CST
17
} memory_order;
18

19
typedef enum memory_scope {
20
  memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
21
  memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
22
  memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE,
23
  memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
24
#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
25
  memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
26
#endif
27
} memory_scope;
28

29
// REMARK: remark: A compare and swap loop was generated for an atomic fadd operation at workgroup-one-as memory scope [-Rpass=atomic-expand]
30
// REMARK: remark: A compare and swap loop was generated for an atomic fadd operation at agent-one-as memory scope [-Rpass=atomic-expand]
31
// REMARK: remark: A compare and swap loop was generated for an atomic fadd operation at one-as memory scope [-Rpass=atomic-expand]
32
// REMARK: remark: A compare and swap loop was generated for an atomic fadd operation at wavefront-one-as memory scope [-Rpass=atomic-expand]
33
// GFX90A-CAS-LABEL: @atomic_cas
34
// GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("workgroup-one-as") monotonic
35
// GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("agent-one-as") monotonic
36
// GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("one-as") monotonic
37
// GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("wavefront-one-as") monotonic
38
float atomic_cas(__global atomic_float *d, float a) {
39
  float ret1 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_work_group);
40
  float ret2 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_device);
41
  float ret3 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_all_svm_devices);
42
  float ret4 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_sub_group);
43
}
44

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.