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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
//! Original PTX specification:
//!
//! mbarrier.test_wait{.sem}{.scope}{.state}.b64 waitComplete, [addr], state;
//! mbarrier.test_wait.parity{.sem}{.scope}{.state}.b64 waitComplete, [addr], phaseParity;
//! mbarrier.try_wait{.sem}{.scope}{.state}.b64 waitComplete, [addr], state {, suspendTimeHint};
//! mbarrier.try_wait.parity{.sem}{.scope}{.state}.b64 waitComplete, [addr], phaseParity {, suspendTimeHint};
//! .sem = { .acquire, .relaxed };
//! .scope = { .cta, .cluster };
//! .state = { .shared, .shared::cta}
#![allow(unused)]
use crate::lexer::PtxToken;
use crate::unparser::{PtxUnparser, common::*};
pub mod section_0 {
use super::*;
use crate::r#type::instruction::mbarrier_test_wait::section_0::*;
impl PtxUnparser for MbarrierTestWaitSemScopeStateB64 {
fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
push_opcode(tokens, "mbarrier");
push_directive(tokens, "test_wait");
if let Some(sem_0) = self.sem.as_ref() {
match sem_0 {
Sem::Acquire => {
push_directive(tokens, "acquire");
}
Sem::Relaxed => {
push_directive(tokens, "relaxed");
}
}
}
if let Some(scope_1) = self.scope.as_ref() {
match scope_1 {
Scope::Cluster => {
push_directive(tokens, "cluster");
}
Scope::Cta => {
push_directive(tokens, "cta");
}
}
}
if let Some(state_2) = self.state.as_ref() {
match state_2 {
State::SharedCta => {
push_directive(tokens, "shared::cta");
}
State::Shared => {
push_directive(tokens, "shared");
}
}
}
push_directive(tokens, "b64");
self.waitcomplete.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.addr.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.state2.unparse_tokens(tokens);
tokens.push(PtxToken::Semicolon);
}
}
impl PtxUnparser for MbarrierTestWaitParitySemScopeStateB64 {
fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
push_opcode(tokens, "mbarrier");
push_directive(tokens, "test_wait");
push_directive(tokens, "parity");
if let Some(sem_3) = self.sem.as_ref() {
match sem_3 {
Sem::Acquire => {
push_directive(tokens, "acquire");
}
Sem::Relaxed => {
push_directive(tokens, "relaxed");
}
}
}
if let Some(scope_4) = self.scope.as_ref() {
match scope_4 {
Scope::Cluster => {
push_directive(tokens, "cluster");
}
Scope::Cta => {
push_directive(tokens, "cta");
}
}
}
if let Some(state_5) = self.state.as_ref() {
match state_5 {
State::SharedCta => {
push_directive(tokens, "shared::cta");
}
State::Shared => {
push_directive(tokens, "shared");
}
}
}
push_directive(tokens, "b64");
self.waitcomplete.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.addr.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.phaseparity.unparse_tokens(tokens);
tokens.push(PtxToken::Semicolon);
}
}
impl PtxUnparser for MbarrierTryWaitSemScopeStateB64 {
fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
push_opcode(tokens, "mbarrier");
push_directive(tokens, "try_wait");
if let Some(sem_6) = self.sem.as_ref() {
match sem_6 {
Sem::Acquire => {
push_directive(tokens, "acquire");
}
Sem::Relaxed => {
push_directive(tokens, "relaxed");
}
}
}
if let Some(scope_7) = self.scope.as_ref() {
match scope_7 {
Scope::Cluster => {
push_directive(tokens, "cluster");
}
Scope::Cta => {
push_directive(tokens, "cta");
}
}
}
if let Some(state_8) = self.state.as_ref() {
match state_8 {
State::SharedCta => {
push_directive(tokens, "shared::cta");
}
State::Shared => {
push_directive(tokens, "shared");
}
}
}
push_directive(tokens, "b64");
self.waitcomplete.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.addr.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.state2.unparse_tokens(tokens);
if self.suspendtimehint.is_some() { tokens.push(PtxToken::Comma); }
if let Some(opt_9) = self.suspendtimehint.as_ref() {
opt_9.unparse_tokens(tokens);
}
tokens.push(PtxToken::Semicolon);
}
}
impl PtxUnparser for MbarrierTryWaitParitySemScopeStateB64 {
fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
push_opcode(tokens, "mbarrier");
push_directive(tokens, "try_wait");
push_directive(tokens, "parity");
if let Some(sem_10) = self.sem.as_ref() {
match sem_10 {
Sem::Acquire => {
push_directive(tokens, "acquire");
}
Sem::Relaxed => {
push_directive(tokens, "relaxed");
}
}
}
if let Some(scope_11) = self.scope.as_ref() {
match scope_11 {
Scope::Cluster => {
push_directive(tokens, "cluster");
}
Scope::Cta => {
push_directive(tokens, "cta");
}
}
}
if let Some(state_12) = self.state.as_ref() {
match state_12 {
State::SharedCta => {
push_directive(tokens, "shared::cta");
}
State::Shared => {
push_directive(tokens, "shared");
}
}
}
push_directive(tokens, "b64");
self.waitcomplete.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.addr.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.phaseparity.unparse_tokens(tokens);
if self.suspendtimehint.is_some() { tokens.push(PtxToken::Comma); }
if let Some(opt_13) = self.suspendtimehint.as_ref() {
opt_13.unparse_tokens(tokens);
}
tokens.push(PtxToken::Semicolon);
}
}
}