File: runtime.mlir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (167 lines) | stat: -rw-r--r-- 5,302 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// RUN: mlir-opt %s | FileCheck %s --dump-input=always

// CHECK-LABEL: @create_token
func.func @create_token() -> !async.token {
  // CHECK: %0 = async.runtime.create : !async.token
  %0 = async.runtime.create : !async.token
  // CHECK: return %0 : !async.token
  return %0 : !async.token
}

// CHECK-LABEL: @create_value
func.func @create_value() -> !async.value<f32> {
  // CHECK: %0 = async.runtime.create : !async.value<f32>
  %0 = async.runtime.create : !async.value<f32>
  // CHECK: return %0 : !async.value<f32>
  return %0 : !async.value<f32>
}

// CHECK-LABEL: @create_group
func.func @create_group() -> !async.group {
  // CHECK: %[[C:.*]] = arith.constant 10 : index
  %c = arith.constant 10 : index
  // CHECK: %[[V:.*]] = async.runtime.create_group %[[C]] : !async.group
  %0 = async.runtime.create_group %c : !async.group
  // CHECK: return %[[V]] : !async.group
  return %0 : !async.group
}

// CHECK-LABEL: @set_token_available
func.func @set_token_available(%arg0: !async.token) {
  // CHECK: async.runtime.set_available %arg0 : !async.token
  async.runtime.set_available %arg0 : !async.token
  return
}

// CHECK-LABEL: @set_value_available
func.func @set_value_available(%arg0: !async.value<f32>) {
  // CHECK: async.runtime.set_available %arg0 : !async.value<f32>
  async.runtime.set_available %arg0 : !async.value<f32>
  return
}

// CHECK-LABEL: @set_token_error
func.func @set_token_error(%arg0: !async.token) {
  // CHECK: async.runtime.set_error %arg0 : !async.token
  async.runtime.set_error %arg0 : !async.token
  return
}

// CHECK-LABEL: @set_value_error
func.func @set_value_error(%arg0: !async.value<f32>) {
  // CHECK: async.runtime.set_error %arg0 : !async.value<f32>
  async.runtime.set_error %arg0 : !async.value<f32>
  return
}

// CHECK-LABEL: @is_token_error
func.func @is_token_error(%arg0: !async.token) -> i1 {
  // CHECK: %[[ERR:.*]] = async.runtime.is_error %arg0 : !async.token
  %0 = async.runtime.is_error %arg0 : !async.token
  return %0 : i1
}

// CHECK-LABEL: @is_value_error
func.func @is_value_error(%arg0: !async.value<f32>) -> i1 {
  // CHECK: %[[ERR:.*]] = async.runtime.is_error %arg0 : !async.value<f32>
  %0 = async.runtime.is_error %arg0 : !async.value<f32>
  return %0 : i1
}

// CHECK-LABEL: @is_group_error
func.func @is_group_error(%arg0: !async.group) -> i1 {
  // CHECK: %[[ERR:.*]] = async.runtime.is_error %arg0 : !async.group
  %0 = async.runtime.is_error %arg0 : !async.group
  return %0 : i1
}

// CHECK-LABEL: @await_token
func.func @await_token(%arg0: !async.token) {
  // CHECK: async.runtime.await %arg0 : !async.token
  async.runtime.await %arg0 : !async.token
  return
}

// CHECK-LABEL: @await_value
func.func @await_value(%arg0: !async.value<f32>) {
  // CHECK: async.runtime.await %arg0 : !async.value<f32>
  async.runtime.await %arg0 : !async.value<f32>
  return
}

// CHECK-LABEL: @await_group
func.func @await_group(%arg0: !async.group) {
  // CHECK: async.runtime.await %arg0 : !async.group
  async.runtime.await %arg0 : !async.group
  return
}

// CHECK-LABEL: @await_and_resume_token
func.func @await_and_resume_token(%arg0: !async.token,
                             %arg1: !async.coro.handle) {
  // CHECK: async.runtime.await_and_resume %arg0, %arg1 : !async.token
  async.runtime.await_and_resume %arg0, %arg1 : !async.token
  return
}

// CHECK-LABEL: @await_and_resume_value
func.func @await_and_resume_value(%arg0: !async.value<f32>,
                             %arg1: !async.coro.handle) {
  // CHECK: async.runtime.await_and_resume %arg0, %arg1 : !async.value<f32>
  async.runtime.await_and_resume %arg0, %arg1 : !async.value<f32>
  return
}

// CHECK-LABEL: @await_and_resume_group
func.func @await_and_resume_group(%arg0: !async.group,
                             %arg1: !async.coro.handle) {
  // CHECK: async.runtime.await_and_resume %arg0, %arg1 : !async.group
  async.runtime.await_and_resume %arg0, %arg1 : !async.group
  return
}

// CHECK-LABEL: @resume
func.func @resume(%arg0: !async.coro.handle) {
  // CHECK: async.runtime.resume %arg0
  async.runtime.resume %arg0
  return
}

// CHECK-LABEL: @store
func.func @store(%arg0: f32, %arg1: !async.value<f32>) {
  // CHECK: async.runtime.store %arg0, %arg1 : <f32>
  async.runtime.store %arg0, %arg1 : <f32>
  return
}

// CHECK-LABEL: @load
func.func @load(%arg0: !async.value<f32>) -> f32 {
  // CHECK: %0 = async.runtime.load %arg0 : <f32>
  // CHECK: return %0 : f32
  %0 = async.runtime.load %arg0 : <f32>
  return %0 : f32
}

// CHECK-LABEL: @add_to_group
func.func @add_to_group(%arg0: !async.token, %arg1: !async.value<f32>,
                   %arg2: !async.group) {
  // CHECK: async.runtime.add_to_group %arg0, %arg2 : !async.token
  async.runtime.add_to_group %arg0, %arg2 : !async.token
  // CHECK: async.runtime.add_to_group %arg1, %arg2 : !async.value<f32>
  async.runtime.add_to_group %arg1, %arg2 : !async.value<f32>
  return
}

// CHECK-LABEL: @add_ref
func.func @add_ref(%arg0: !async.token) {
  // CHECK: async.runtime.add_ref %arg0 {count = 1 : i64}
  async.runtime.add_ref %arg0 {count = 1 : i64} : !async.token
  return
}

// CHECK-LABEL: @drop_ref
func.func @drop_ref(%arg0: !async.token) {
  // CHECK: async.runtime.drop_ref %arg0 {count = 1 : i64}
  async.runtime.drop_ref %arg0 {count = 1 : i64} : !async.token
  return
}