• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as %s -o %t.bc
2; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
3; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
4; RUN: llvm-spirv %t.bc -o %t.spv
5; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
6; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
7
8; work_group_barrier with the default scope (memory_scope_work_group)
9; CHECK-LLVM: call spir_func void @_Z18work_group_barrierji(i32 2, i32 1) #{{[0-9]+}}
10; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 1, i32 1) #{{[0-9]+}}
11; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 4, i32 1) #{{[0-9]+}}
12; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 3, i32 1) #{{[0-9]+}}
13; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 5, i32 1) #{{[0-9]+}}
14; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 7, i32 1) #{{[0-9]+}}
15
16; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 2, i32 0) #{{[0-9]+}}
17; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 2, i32 1) #{{[0-9]+}}
18; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 2, i32 2) #{{[0-9]+}}
19; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 2, i32 3) #{{[0-9]+}}
20
21; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 1, i32 0) #{{[0-9]+}}
22; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 1, i32 1) #{{[0-9]+}}
23; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 1, i32 2) #{{[0-9]+}}
24; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 1, i32 3) #{{[0-9]+}}
25
26; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 4, i32 0) #{{[0-9]+}}
27; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 4, i32 1) #{{[0-9]+}}
28; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 4, i32 2) #{{[0-9]+}}
29; CHECK-LLVM-NEXT: call spir_func void @_Z18work_group_barrierji(i32 4, i32 3) #{{[0-9]+}}
30
31
32; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema1:[0-9]+]] 512
33; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema2:[0-9]+]] 256
34; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema3:[0-9]+]] 2048
35; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema4:[0-9]+]] 768
36; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema5:[0-9]+]] 2304
37; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema6:[0-9]+]] 2816
38
39; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeWorkItem:[0-9]+]] 4
40; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeWorkGroup:[0-9]+]] 2
41; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeDevice:[0-9]+]] 1
42; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeCrossDevice:[0-9]+]] 0
43
44; CHECK-SPIRV: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema1]]
45; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema2]]
46; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema3]]
47; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema4]]
48; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema5]]
49; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema6]]
50
51; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkItem]] [[MemSema1]]
52; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema1]]
53; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeDevice]] [[MemSema1]]
54; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeCrossDevice]] [[MemSema1]]
55
56; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkItem]] [[MemSema2]]
57; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema2]]
58; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeDevice]] [[MemSema2]]
59; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeCrossDevice]] [[MemSema2]]
60
61; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkItem]] [[MemSema3]]
62; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema3]]
63; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeDevice]] [[MemSema3]]
64; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeCrossDevice]] [[MemSema3]]
65
66
67; ModuleID = 'work_group_barrier.cl'
68target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
69target triple = "spir-unknown-unknown"
70
71; Function Attrs: nounwind
72define spir_kernel void @test() #0 {
73entry:
74  call spir_func void @_Z18work_group_barrierj(i32 2) ; global mem fence
75  call spir_func void @_Z18work_group_barrierj(i32 1) ; local mem fence
76  call spir_func void @_Z18work_group_barrierj(i32 4) ; image mem fence
77
78  call spir_func void @_Z18work_group_barrierj(i32 3) ; global | local
79  call spir_func void @_Z18work_group_barrierj(i32 5) ; local | image
80  call spir_func void @_Z18work_group_barrierj(i32 7) ; global | local | image
81
82  call spir_func void @_Z18work_group_barrierji(i32 2, i32 0) ; global mem fence + memory_scope_work_item
83  call spir_func void @_Z18work_group_barrierji(i32 2, i32 1) ; global mem fence + memory_scope_work_group
84  call spir_func void @_Z18work_group_barrierji(i32 2, i32 2) ; global mem fence + memory_scope_device
85  call spir_func void @_Z18work_group_barrierji(i32 2, i32 3) ; global mem fence + memory_scope_all_svm_devices
86
87  call spir_func void @_Z18work_group_barrierji(i32 1, i32 0) ; local mem fence + memory_scope_work_item
88  call spir_func void @_Z18work_group_barrierji(i32 1, i32 1) ; local mem fence + memory_scope_work_group
89  call spir_func void @_Z18work_group_barrierji(i32 1, i32 2) ; local mem fence + memory_scope_device
90  call spir_func void @_Z18work_group_barrierji(i32 1, i32 3) ; local mem fence + memory_scope_all_svm_devices
91
92  call spir_func void @_Z18work_group_barrierji(i32 4, i32 0) ; image mem fence + memory_scope_work_item
93  call spir_func void @_Z18work_group_barrierji(i32 4, i32 1) ; image mem fence + memory_scope_work_group
94  call spir_func void @_Z18work_group_barrierji(i32 4, i32 2) ; image mem fence + memory_scope_device
95  call spir_func void @_Z18work_group_barrierji(i32 4, i32 3) ; image mem fence + memory_scope_all_svm_devices
96
97  ret void
98}
99
100declare spir_func void @_Z18work_group_barrierj(i32) #1
101declare spir_func void @_Z18work_group_barrierji(i32, i32) #1
102
103attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
104attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
105attributes #2 = { nounwind }
106
107!opencl.kernels = !{!0}
108!opencl.enable.FP_CONTRACT = !{}
109!opencl.spir.version = !{!6}
110!opencl.ocl.version = !{!7}
111!opencl.used.extensions = !{!8}
112!opencl.used.optional.core.features = !{!8}
113!opencl.compiler.options = !{!8}
114
115!0 = !{void ()* @test, !1, !2, !3, !4, !5}
116!1 = !{!"kernel_arg_addr_space"}
117!2 = !{!"kernel_arg_access_qual"}
118!3 = !{!"kernel_arg_type"}
119!4 = !{!"kernel_arg_base_type"}
120!5 = !{!"kernel_arg_type_qual"}
121!6 = !{i32 1, i32 2}
122!7 = !{i32 2, i32 0}
123!8 = !{}
124