Skip to main content

ptx_parser/unparser/instruction/
atom.rs

1//! Original PTX specification:
2//!
3//! // Atomic operation with scalar type:
4//! atom{.sem}{.scope}{.space}.op{.level::cache_hint}.type d, [a], b{, cache-policy};
5//! atom{.sem}{.scope}{.space}.op.type d, [a], b, c;
6//! atom{.sem}{.scope}{.space}.cas.b16 d, [a], b, c;
7//! atom{.sem}{.scope}{.space}.cas.b128 d, [a], b, c;
8//! atom{.sem}{.scope}{.space}.exch{.level::cache_hint}.b128 d, [a], b {, cache-policy};
9//! atom{.sem}{.scope}{.space}.add.noftz{.level::cache_hint}.f16     d, [a], b{, cache-policy};
10//! atom{.sem}{.scope}{.space}.add.noftz{.level::cache_hint}.f16x2   d, [a], b{, cache-policy};
11//! atom{.sem}{.scope}{.space}.add.noftz{.level::cache_hint}.bf16    d, [a], b{, cache-policy};
12//! atom{.sem}{.scope}{.space}.add.noftz{.level::cache_hint}.bf16x2  d, [a], b{, cache-policy};
13//! .space =              { .global, .shared, .shared::cta, .shared::cluster};
14//! .sem =                { .relaxed, .acquire, .release, .acq_rel };
15//! .scope =              { .cta, .cluster, .gpu, .sys };
16//! .op =                 { .and, .or, .xor, .cas, .exch, .add, .inc, .dec, .min, .max };
17//! .level::cache_hint =  { .L2::cache_hint };
18//! .type =               { .b32, .b64, .u32, .u64, .s32, .s64, .f32, .f64 };
19//! -------------------------------------------------------------
20//! // Atomic operation with vector type:
21//! atom{.sem}{.scope}{.global}.add{.level::cache_hint}.vec_32_bit.f32                  d, [a], b{, cache-policy};
22//! atom{.sem}{.scope}{.global}.op.noftz{.level::cache_hint}.vec_16_bit.half_word_type  d, [a], b{, cache-policy};
23//! atom{.sem}{.scope}{.global}.op.noftz{.level::cache_hint}.vec_32_bit.packed_type     d, [a], b{, cache-policy};
24//! .sem =               { .relaxed, .acquire, .release, .acq_rel };
25//! .scope =             { .cta, .cluster, .gpu, .sys };
26//! .op =                { .add, .min, .max };
27//! .half_word_type =    { .f16, .bf16 };
28//! .packed_type =       { .f16x2, .bf16x2 };
29//! .vec_16_bit =        { .v2, .v4, .v8 };
30//! .vec_32_bit =        { .v2, .v4 };
31//! .level::cache_hint = { .L2::cache_hint };
32
33#![allow(unused)]
34
35use crate::lexer::PtxToken;
36use crate::unparser::{PtxUnparser, common::*};
37
38pub mod section_0 {
39    use super::*;
40    use crate::r#type::instruction::atom::section_0::*;
41
42    impl PtxUnparser for AtomSemScopeSpaceOpLevelCacheHintType {
43        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
44            self.unparse_tokens_mode(tokens, false);
45        }
46        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
47            push_opcode(tokens, "atom");
48            if let Some(sem_0) = self.sem.as_ref() {
49                match sem_0 {
50                    Sem::Relaxed => {
51                        push_directive(tokens, "relaxed");
52                    }
53                    Sem::Acquire => {
54                        push_directive(tokens, "acquire");
55                    }
56                    Sem::Release => {
57                        push_directive(tokens, "release");
58                    }
59                    Sem::AcqRel => {
60                        push_directive(tokens, "acq_rel");
61                    }
62                }
63            }
64            if let Some(scope_1) = self.scope.as_ref() {
65                match scope_1 {
66                    Scope::Cluster => {
67                        push_directive(tokens, "cluster");
68                    }
69                    Scope::Cta => {
70                        push_directive(tokens, "cta");
71                    }
72                    Scope::Gpu => {
73                        push_directive(tokens, "gpu");
74                    }
75                    Scope::Sys => {
76                        push_directive(tokens, "sys");
77                    }
78                }
79            }
80            if let Some(space_2) = self.space.as_ref() {
81                match space_2 {
82                    Space::SharedCluster => {
83                        push_directive(tokens, "shared::cluster");
84                    }
85                    Space::SharedCta => {
86                        push_directive(tokens, "shared::cta");
87                    }
88                    Space::Global => {
89                        push_directive(tokens, "global");
90                    }
91                    Space::Shared => {
92                        push_directive(tokens, "shared");
93                    }
94                }
95            }
96            match &self.op {
97                Op::Exch => {
98                    push_directive(tokens, "exch");
99                }
100                Op::And => {
101                    push_directive(tokens, "and");
102                }
103                Op::Xor => {
104                    push_directive(tokens, "xor");
105                }
106                Op::Cas => {
107                    push_directive(tokens, "cas");
108                }
109                Op::Add => {
110                    push_directive(tokens, "add");
111                }
112                Op::Inc => {
113                    push_directive(tokens, "inc");
114                }
115                Op::Dec => {
116                    push_directive(tokens, "dec");
117                }
118                Op::Min => {
119                    push_directive(tokens, "min");
120                }
121                Op::Max => {
122                    push_directive(tokens, "max");
123                }
124                Op::Or => {
125                    push_directive(tokens, "or");
126                }
127            }
128            if let Some(level_cache_hint_3) = self.level_cache_hint.as_ref() {
129                match level_cache_hint_3 {
130                    LevelCacheHint::L2CacheHint => {
131                        push_directive(tokens, "L2::cache_hint");
132                    }
133                }
134            }
135            match &self.type_ {
136                Type::B32 => {
137                    push_directive(tokens, "b32");
138                }
139                Type::B64 => {
140                    push_directive(tokens, "b64");
141                }
142                Type::U32 => {
143                    push_directive(tokens, "u32");
144                }
145                Type::U64 => {
146                    push_directive(tokens, "u64");
147                }
148                Type::S32 => {
149                    push_directive(tokens, "s32");
150                }
151                Type::S64 => {
152                    push_directive(tokens, "s64");
153                }
154                Type::F32 => {
155                    push_directive(tokens, "f32");
156                }
157                Type::F64 => {
158                    push_directive(tokens, "f64");
159                }
160            }
161            if spaced {
162                tokens.push(PtxToken::Space);
163            }
164            self.d.unparse_tokens_mode(tokens, spaced);
165            tokens.push(PtxToken::Comma);
166            if spaced {
167                tokens.push(PtxToken::Space);
168            }
169            self.a.unparse_tokens_mode(tokens, spaced);
170            tokens.push(PtxToken::Comma);
171            if spaced {
172                tokens.push(PtxToken::Space);
173            }
174            self.b.unparse_tokens_mode(tokens, spaced);
175            if self.cache_policy.is_some() {
176                tokens.push(PtxToken::Comma);
177            }
178            if let Some(opt_4) = self.cache_policy.as_ref() {
179                if spaced {
180                    tokens.push(PtxToken::Space);
181                }
182                opt_4.unparse_tokens_mode(tokens, spaced);
183            }
184            tokens.push(PtxToken::Semicolon);
185            if spaced {
186                tokens.push(PtxToken::Newline);
187            }
188        }
189    }
190
191    impl PtxUnparser for AtomSemScopeSpaceOpType {
192        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
193            self.unparse_tokens_mode(tokens, false);
194        }
195        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
196            push_opcode(tokens, "atom");
197            if let Some(sem_5) = self.sem.as_ref() {
198                match sem_5 {
199                    Sem::Relaxed => {
200                        push_directive(tokens, "relaxed");
201                    }
202                    Sem::Acquire => {
203                        push_directive(tokens, "acquire");
204                    }
205                    Sem::Release => {
206                        push_directive(tokens, "release");
207                    }
208                    Sem::AcqRel => {
209                        push_directive(tokens, "acq_rel");
210                    }
211                }
212            }
213            if let Some(scope_6) = self.scope.as_ref() {
214                match scope_6 {
215                    Scope::Cluster => {
216                        push_directive(tokens, "cluster");
217                    }
218                    Scope::Cta => {
219                        push_directive(tokens, "cta");
220                    }
221                    Scope::Gpu => {
222                        push_directive(tokens, "gpu");
223                    }
224                    Scope::Sys => {
225                        push_directive(tokens, "sys");
226                    }
227                }
228            }
229            if let Some(space_7) = self.space.as_ref() {
230                match space_7 {
231                    Space::SharedCluster => {
232                        push_directive(tokens, "shared::cluster");
233                    }
234                    Space::SharedCta => {
235                        push_directive(tokens, "shared::cta");
236                    }
237                    Space::Global => {
238                        push_directive(tokens, "global");
239                    }
240                    Space::Shared => {
241                        push_directive(tokens, "shared");
242                    }
243                }
244            }
245            match &self.op {
246                Op::Exch => {
247                    push_directive(tokens, "exch");
248                }
249                Op::And => {
250                    push_directive(tokens, "and");
251                }
252                Op::Xor => {
253                    push_directive(tokens, "xor");
254                }
255                Op::Cas => {
256                    push_directive(tokens, "cas");
257                }
258                Op::Add => {
259                    push_directive(tokens, "add");
260                }
261                Op::Inc => {
262                    push_directive(tokens, "inc");
263                }
264                Op::Dec => {
265                    push_directive(tokens, "dec");
266                }
267                Op::Min => {
268                    push_directive(tokens, "min");
269                }
270                Op::Max => {
271                    push_directive(tokens, "max");
272                }
273                Op::Or => {
274                    push_directive(tokens, "or");
275                }
276            }
277            match &self.type_ {
278                Type::B32 => {
279                    push_directive(tokens, "b32");
280                }
281                Type::B64 => {
282                    push_directive(tokens, "b64");
283                }
284                Type::U32 => {
285                    push_directive(tokens, "u32");
286                }
287                Type::U64 => {
288                    push_directive(tokens, "u64");
289                }
290                Type::S32 => {
291                    push_directive(tokens, "s32");
292                }
293                Type::S64 => {
294                    push_directive(tokens, "s64");
295                }
296                Type::F32 => {
297                    push_directive(tokens, "f32");
298                }
299                Type::F64 => {
300                    push_directive(tokens, "f64");
301                }
302            }
303            if spaced {
304                tokens.push(PtxToken::Space);
305            }
306            self.d.unparse_tokens_mode(tokens, spaced);
307            tokens.push(PtxToken::Comma);
308            if spaced {
309                tokens.push(PtxToken::Space);
310            }
311            self.a.unparse_tokens_mode(tokens, spaced);
312            tokens.push(PtxToken::Comma);
313            if spaced {
314                tokens.push(PtxToken::Space);
315            }
316            self.b.unparse_tokens_mode(tokens, spaced);
317            tokens.push(PtxToken::Comma);
318            if spaced {
319                tokens.push(PtxToken::Space);
320            }
321            self.c.unparse_tokens_mode(tokens, spaced);
322            tokens.push(PtxToken::Semicolon);
323            if spaced {
324                tokens.push(PtxToken::Newline);
325            }
326        }
327    }
328
329    impl PtxUnparser for AtomSemScopeSpaceCasB16 {
330        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
331            self.unparse_tokens_mode(tokens, false);
332        }
333        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
334            push_opcode(tokens, "atom");
335            if let Some(sem_8) = self.sem.as_ref() {
336                match sem_8 {
337                    Sem::Relaxed => {
338                        push_directive(tokens, "relaxed");
339                    }
340                    Sem::Acquire => {
341                        push_directive(tokens, "acquire");
342                    }
343                    Sem::Release => {
344                        push_directive(tokens, "release");
345                    }
346                    Sem::AcqRel => {
347                        push_directive(tokens, "acq_rel");
348                    }
349                }
350            }
351            if let Some(scope_9) = self.scope.as_ref() {
352                match scope_9 {
353                    Scope::Cluster => {
354                        push_directive(tokens, "cluster");
355                    }
356                    Scope::Cta => {
357                        push_directive(tokens, "cta");
358                    }
359                    Scope::Gpu => {
360                        push_directive(tokens, "gpu");
361                    }
362                    Scope::Sys => {
363                        push_directive(tokens, "sys");
364                    }
365                }
366            }
367            if let Some(space_10) = self.space.as_ref() {
368                match space_10 {
369                    Space::SharedCluster => {
370                        push_directive(tokens, "shared::cluster");
371                    }
372                    Space::SharedCta => {
373                        push_directive(tokens, "shared::cta");
374                    }
375                    Space::Global => {
376                        push_directive(tokens, "global");
377                    }
378                    Space::Shared => {
379                        push_directive(tokens, "shared");
380                    }
381                }
382            }
383            push_directive(tokens, "cas");
384            push_directive(tokens, "b16");
385            if spaced {
386                tokens.push(PtxToken::Space);
387            }
388            self.d.unparse_tokens_mode(tokens, spaced);
389            tokens.push(PtxToken::Comma);
390            if spaced {
391                tokens.push(PtxToken::Space);
392            }
393            self.a.unparse_tokens_mode(tokens, spaced);
394            tokens.push(PtxToken::Comma);
395            if spaced {
396                tokens.push(PtxToken::Space);
397            }
398            self.b.unparse_tokens_mode(tokens, spaced);
399            tokens.push(PtxToken::Comma);
400            if spaced {
401                tokens.push(PtxToken::Space);
402            }
403            self.c.unparse_tokens_mode(tokens, spaced);
404            tokens.push(PtxToken::Semicolon);
405            if spaced {
406                tokens.push(PtxToken::Newline);
407            }
408        }
409    }
410
411    impl PtxUnparser for AtomSemScopeSpaceCasB128 {
412        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
413            self.unparse_tokens_mode(tokens, false);
414        }
415        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
416            push_opcode(tokens, "atom");
417            if let Some(sem_11) = self.sem.as_ref() {
418                match sem_11 {
419                    Sem::Relaxed => {
420                        push_directive(tokens, "relaxed");
421                    }
422                    Sem::Acquire => {
423                        push_directive(tokens, "acquire");
424                    }
425                    Sem::Release => {
426                        push_directive(tokens, "release");
427                    }
428                    Sem::AcqRel => {
429                        push_directive(tokens, "acq_rel");
430                    }
431                }
432            }
433            if let Some(scope_12) = self.scope.as_ref() {
434                match scope_12 {
435                    Scope::Cluster => {
436                        push_directive(tokens, "cluster");
437                    }
438                    Scope::Cta => {
439                        push_directive(tokens, "cta");
440                    }
441                    Scope::Gpu => {
442                        push_directive(tokens, "gpu");
443                    }
444                    Scope::Sys => {
445                        push_directive(tokens, "sys");
446                    }
447                }
448            }
449            if let Some(space_13) = self.space.as_ref() {
450                match space_13 {
451                    Space::SharedCluster => {
452                        push_directive(tokens, "shared::cluster");
453                    }
454                    Space::SharedCta => {
455                        push_directive(tokens, "shared::cta");
456                    }
457                    Space::Global => {
458                        push_directive(tokens, "global");
459                    }
460                    Space::Shared => {
461                        push_directive(tokens, "shared");
462                    }
463                }
464            }
465            push_directive(tokens, "cas");
466            push_directive(tokens, "b128");
467            if spaced {
468                tokens.push(PtxToken::Space);
469            }
470            self.d.unparse_tokens_mode(tokens, spaced);
471            tokens.push(PtxToken::Comma);
472            if spaced {
473                tokens.push(PtxToken::Space);
474            }
475            self.a.unparse_tokens_mode(tokens, spaced);
476            tokens.push(PtxToken::Comma);
477            if spaced {
478                tokens.push(PtxToken::Space);
479            }
480            self.b.unparse_tokens_mode(tokens, spaced);
481            tokens.push(PtxToken::Comma);
482            if spaced {
483                tokens.push(PtxToken::Space);
484            }
485            self.c.unparse_tokens_mode(tokens, spaced);
486            tokens.push(PtxToken::Semicolon);
487            if spaced {
488                tokens.push(PtxToken::Newline);
489            }
490        }
491    }
492
493    impl PtxUnparser for AtomSemScopeSpaceExchLevelCacheHintB128 {
494        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
495            self.unparse_tokens_mode(tokens, false);
496        }
497        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
498            push_opcode(tokens, "atom");
499            if let Some(sem_14) = self.sem.as_ref() {
500                match sem_14 {
501                    Sem::Relaxed => {
502                        push_directive(tokens, "relaxed");
503                    }
504                    Sem::Acquire => {
505                        push_directive(tokens, "acquire");
506                    }
507                    Sem::Release => {
508                        push_directive(tokens, "release");
509                    }
510                    Sem::AcqRel => {
511                        push_directive(tokens, "acq_rel");
512                    }
513                }
514            }
515            if let Some(scope_15) = self.scope.as_ref() {
516                match scope_15 {
517                    Scope::Cluster => {
518                        push_directive(tokens, "cluster");
519                    }
520                    Scope::Cta => {
521                        push_directive(tokens, "cta");
522                    }
523                    Scope::Gpu => {
524                        push_directive(tokens, "gpu");
525                    }
526                    Scope::Sys => {
527                        push_directive(tokens, "sys");
528                    }
529                }
530            }
531            if let Some(space_16) = self.space.as_ref() {
532                match space_16 {
533                    Space::SharedCluster => {
534                        push_directive(tokens, "shared::cluster");
535                    }
536                    Space::SharedCta => {
537                        push_directive(tokens, "shared::cta");
538                    }
539                    Space::Global => {
540                        push_directive(tokens, "global");
541                    }
542                    Space::Shared => {
543                        push_directive(tokens, "shared");
544                    }
545                }
546            }
547            push_directive(tokens, "exch");
548            if let Some(level_cache_hint_17) = self.level_cache_hint.as_ref() {
549                match level_cache_hint_17 {
550                    LevelCacheHint::L2CacheHint => {
551                        push_directive(tokens, "L2::cache_hint");
552                    }
553                }
554            }
555            push_directive(tokens, "b128");
556            if spaced {
557                tokens.push(PtxToken::Space);
558            }
559            self.d.unparse_tokens_mode(tokens, spaced);
560            tokens.push(PtxToken::Comma);
561            if spaced {
562                tokens.push(PtxToken::Space);
563            }
564            self.a.unparse_tokens_mode(tokens, spaced);
565            tokens.push(PtxToken::Comma);
566            if spaced {
567                tokens.push(PtxToken::Space);
568            }
569            self.b.unparse_tokens_mode(tokens, spaced);
570            if self.cache_policy.is_some() {
571                tokens.push(PtxToken::Comma);
572            }
573            if let Some(opt_18) = self.cache_policy.as_ref() {
574                if spaced {
575                    tokens.push(PtxToken::Space);
576                }
577                opt_18.unparse_tokens_mode(tokens, spaced);
578            }
579            tokens.push(PtxToken::Semicolon);
580            if spaced {
581                tokens.push(PtxToken::Newline);
582            }
583        }
584    }
585
586    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintF16 {
587        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
588            self.unparse_tokens_mode(tokens, false);
589        }
590        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
591            push_opcode(tokens, "atom");
592            if let Some(sem_19) = self.sem.as_ref() {
593                match sem_19 {
594                    Sem::Relaxed => {
595                        push_directive(tokens, "relaxed");
596                    }
597                    Sem::Acquire => {
598                        push_directive(tokens, "acquire");
599                    }
600                    Sem::Release => {
601                        push_directive(tokens, "release");
602                    }
603                    Sem::AcqRel => {
604                        push_directive(tokens, "acq_rel");
605                    }
606                }
607            }
608            if let Some(scope_20) = self.scope.as_ref() {
609                match scope_20 {
610                    Scope::Cluster => {
611                        push_directive(tokens, "cluster");
612                    }
613                    Scope::Cta => {
614                        push_directive(tokens, "cta");
615                    }
616                    Scope::Gpu => {
617                        push_directive(tokens, "gpu");
618                    }
619                    Scope::Sys => {
620                        push_directive(tokens, "sys");
621                    }
622                }
623            }
624            if let Some(space_21) = self.space.as_ref() {
625                match space_21 {
626                    Space::SharedCluster => {
627                        push_directive(tokens, "shared::cluster");
628                    }
629                    Space::SharedCta => {
630                        push_directive(tokens, "shared::cta");
631                    }
632                    Space::Global => {
633                        push_directive(tokens, "global");
634                    }
635                    Space::Shared => {
636                        push_directive(tokens, "shared");
637                    }
638                }
639            }
640            push_directive(tokens, "add");
641            push_directive(tokens, "noftz");
642            if let Some(level_cache_hint_22) = self.level_cache_hint.as_ref() {
643                match level_cache_hint_22 {
644                    LevelCacheHint::L2CacheHint => {
645                        push_directive(tokens, "L2::cache_hint");
646                    }
647                }
648            }
649            push_directive(tokens, "f16");
650            if spaced {
651                tokens.push(PtxToken::Space);
652            }
653            self.d.unparse_tokens_mode(tokens, spaced);
654            tokens.push(PtxToken::Comma);
655            if spaced {
656                tokens.push(PtxToken::Space);
657            }
658            self.a.unparse_tokens_mode(tokens, spaced);
659            tokens.push(PtxToken::Comma);
660            if spaced {
661                tokens.push(PtxToken::Space);
662            }
663            self.b.unparse_tokens_mode(tokens, spaced);
664            if self.cache_policy.is_some() {
665                tokens.push(PtxToken::Comma);
666            }
667            if let Some(opt_23) = self.cache_policy.as_ref() {
668                if spaced {
669                    tokens.push(PtxToken::Space);
670                }
671                opt_23.unparse_tokens_mode(tokens, spaced);
672            }
673            tokens.push(PtxToken::Semicolon);
674            if spaced {
675                tokens.push(PtxToken::Newline);
676            }
677        }
678    }
679
680    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintF16x2 {
681        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
682            self.unparse_tokens_mode(tokens, false);
683        }
684        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
685            push_opcode(tokens, "atom");
686            if let Some(sem_24) = self.sem.as_ref() {
687                match sem_24 {
688                    Sem::Relaxed => {
689                        push_directive(tokens, "relaxed");
690                    }
691                    Sem::Acquire => {
692                        push_directive(tokens, "acquire");
693                    }
694                    Sem::Release => {
695                        push_directive(tokens, "release");
696                    }
697                    Sem::AcqRel => {
698                        push_directive(tokens, "acq_rel");
699                    }
700                }
701            }
702            if let Some(scope_25) = self.scope.as_ref() {
703                match scope_25 {
704                    Scope::Cluster => {
705                        push_directive(tokens, "cluster");
706                    }
707                    Scope::Cta => {
708                        push_directive(tokens, "cta");
709                    }
710                    Scope::Gpu => {
711                        push_directive(tokens, "gpu");
712                    }
713                    Scope::Sys => {
714                        push_directive(tokens, "sys");
715                    }
716                }
717            }
718            if let Some(space_26) = self.space.as_ref() {
719                match space_26 {
720                    Space::SharedCluster => {
721                        push_directive(tokens, "shared::cluster");
722                    }
723                    Space::SharedCta => {
724                        push_directive(tokens, "shared::cta");
725                    }
726                    Space::Global => {
727                        push_directive(tokens, "global");
728                    }
729                    Space::Shared => {
730                        push_directive(tokens, "shared");
731                    }
732                }
733            }
734            push_directive(tokens, "add");
735            push_directive(tokens, "noftz");
736            if let Some(level_cache_hint_27) = self.level_cache_hint.as_ref() {
737                match level_cache_hint_27 {
738                    LevelCacheHint::L2CacheHint => {
739                        push_directive(tokens, "L2::cache_hint");
740                    }
741                }
742            }
743            push_directive(tokens, "f16x2");
744            if spaced {
745                tokens.push(PtxToken::Space);
746            }
747            self.d.unparse_tokens_mode(tokens, spaced);
748            tokens.push(PtxToken::Comma);
749            if spaced {
750                tokens.push(PtxToken::Space);
751            }
752            self.a.unparse_tokens_mode(tokens, spaced);
753            tokens.push(PtxToken::Comma);
754            if spaced {
755                tokens.push(PtxToken::Space);
756            }
757            self.b.unparse_tokens_mode(tokens, spaced);
758            if self.cache_policy.is_some() {
759                tokens.push(PtxToken::Comma);
760            }
761            if let Some(opt_28) = self.cache_policy.as_ref() {
762                if spaced {
763                    tokens.push(PtxToken::Space);
764                }
765                opt_28.unparse_tokens_mode(tokens, spaced);
766            }
767            tokens.push(PtxToken::Semicolon);
768            if spaced {
769                tokens.push(PtxToken::Newline);
770            }
771        }
772    }
773
774    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintBf16 {
775        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
776            self.unparse_tokens_mode(tokens, false);
777        }
778        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
779            push_opcode(tokens, "atom");
780            if let Some(sem_29) = self.sem.as_ref() {
781                match sem_29 {
782                    Sem::Relaxed => {
783                        push_directive(tokens, "relaxed");
784                    }
785                    Sem::Acquire => {
786                        push_directive(tokens, "acquire");
787                    }
788                    Sem::Release => {
789                        push_directive(tokens, "release");
790                    }
791                    Sem::AcqRel => {
792                        push_directive(tokens, "acq_rel");
793                    }
794                }
795            }
796            if let Some(scope_30) = self.scope.as_ref() {
797                match scope_30 {
798                    Scope::Cluster => {
799                        push_directive(tokens, "cluster");
800                    }
801                    Scope::Cta => {
802                        push_directive(tokens, "cta");
803                    }
804                    Scope::Gpu => {
805                        push_directive(tokens, "gpu");
806                    }
807                    Scope::Sys => {
808                        push_directive(tokens, "sys");
809                    }
810                }
811            }
812            if let Some(space_31) = self.space.as_ref() {
813                match space_31 {
814                    Space::SharedCluster => {
815                        push_directive(tokens, "shared::cluster");
816                    }
817                    Space::SharedCta => {
818                        push_directive(tokens, "shared::cta");
819                    }
820                    Space::Global => {
821                        push_directive(tokens, "global");
822                    }
823                    Space::Shared => {
824                        push_directive(tokens, "shared");
825                    }
826                }
827            }
828            push_directive(tokens, "add");
829            push_directive(tokens, "noftz");
830            if let Some(level_cache_hint_32) = self.level_cache_hint.as_ref() {
831                match level_cache_hint_32 {
832                    LevelCacheHint::L2CacheHint => {
833                        push_directive(tokens, "L2::cache_hint");
834                    }
835                }
836            }
837            push_directive(tokens, "bf16");
838            if spaced {
839                tokens.push(PtxToken::Space);
840            }
841            self.d.unparse_tokens_mode(tokens, spaced);
842            tokens.push(PtxToken::Comma);
843            if spaced {
844                tokens.push(PtxToken::Space);
845            }
846            self.a.unparse_tokens_mode(tokens, spaced);
847            tokens.push(PtxToken::Comma);
848            if spaced {
849                tokens.push(PtxToken::Space);
850            }
851            self.b.unparse_tokens_mode(tokens, spaced);
852            if self.cache_policy.is_some() {
853                tokens.push(PtxToken::Comma);
854            }
855            if let Some(opt_33) = self.cache_policy.as_ref() {
856                if spaced {
857                    tokens.push(PtxToken::Space);
858                }
859                opt_33.unparse_tokens_mode(tokens, spaced);
860            }
861            tokens.push(PtxToken::Semicolon);
862            if spaced {
863                tokens.push(PtxToken::Newline);
864            }
865        }
866    }
867
868    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintBf16x2 {
869        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
870            self.unparse_tokens_mode(tokens, false);
871        }
872        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
873            push_opcode(tokens, "atom");
874            if let Some(sem_34) = self.sem.as_ref() {
875                match sem_34 {
876                    Sem::Relaxed => {
877                        push_directive(tokens, "relaxed");
878                    }
879                    Sem::Acquire => {
880                        push_directive(tokens, "acquire");
881                    }
882                    Sem::Release => {
883                        push_directive(tokens, "release");
884                    }
885                    Sem::AcqRel => {
886                        push_directive(tokens, "acq_rel");
887                    }
888                }
889            }
890            if let Some(scope_35) = self.scope.as_ref() {
891                match scope_35 {
892                    Scope::Cluster => {
893                        push_directive(tokens, "cluster");
894                    }
895                    Scope::Cta => {
896                        push_directive(tokens, "cta");
897                    }
898                    Scope::Gpu => {
899                        push_directive(tokens, "gpu");
900                    }
901                    Scope::Sys => {
902                        push_directive(tokens, "sys");
903                    }
904                }
905            }
906            if let Some(space_36) = self.space.as_ref() {
907                match space_36 {
908                    Space::SharedCluster => {
909                        push_directive(tokens, "shared::cluster");
910                    }
911                    Space::SharedCta => {
912                        push_directive(tokens, "shared::cta");
913                    }
914                    Space::Global => {
915                        push_directive(tokens, "global");
916                    }
917                    Space::Shared => {
918                        push_directive(tokens, "shared");
919                    }
920                }
921            }
922            push_directive(tokens, "add");
923            push_directive(tokens, "noftz");
924            if let Some(level_cache_hint_37) = self.level_cache_hint.as_ref() {
925                match level_cache_hint_37 {
926                    LevelCacheHint::L2CacheHint => {
927                        push_directive(tokens, "L2::cache_hint");
928                    }
929                }
930            }
931            push_directive(tokens, "bf16x2");
932            if spaced {
933                tokens.push(PtxToken::Space);
934            }
935            self.d.unparse_tokens_mode(tokens, spaced);
936            tokens.push(PtxToken::Comma);
937            if spaced {
938                tokens.push(PtxToken::Space);
939            }
940            self.a.unparse_tokens_mode(tokens, spaced);
941            tokens.push(PtxToken::Comma);
942            if spaced {
943                tokens.push(PtxToken::Space);
944            }
945            self.b.unparse_tokens_mode(tokens, spaced);
946            if self.cache_policy.is_some() {
947                tokens.push(PtxToken::Comma);
948            }
949            if let Some(opt_38) = self.cache_policy.as_ref() {
950                if spaced {
951                    tokens.push(PtxToken::Space);
952                }
953                opt_38.unparse_tokens_mode(tokens, spaced);
954            }
955            tokens.push(PtxToken::Semicolon);
956            if spaced {
957                tokens.push(PtxToken::Newline);
958            }
959        }
960    }
961}
962
963pub mod section_1 {
964    use super::*;
965    use crate::r#type::instruction::atom::section_1::*;
966
967    impl PtxUnparser for AtomSemScopeGlobalAddLevelCacheHintVec32BitF32 {
968        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
969            self.unparse_tokens_mode(tokens, false);
970        }
971        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
972            push_opcode(tokens, "atom");
973            if let Some(sem_39) = self.sem.as_ref() {
974                match sem_39 {
975                    Sem::Relaxed => {
976                        push_directive(tokens, "relaxed");
977                    }
978                    Sem::Acquire => {
979                        push_directive(tokens, "acquire");
980                    }
981                    Sem::Release => {
982                        push_directive(tokens, "release");
983                    }
984                    Sem::AcqRel => {
985                        push_directive(tokens, "acq_rel");
986                    }
987                }
988            }
989            if let Some(scope_40) = self.scope.as_ref() {
990                match scope_40 {
991                    Scope::Cluster => {
992                        push_directive(tokens, "cluster");
993                    }
994                    Scope::Cta => {
995                        push_directive(tokens, "cta");
996                    }
997                    Scope::Gpu => {
998                        push_directive(tokens, "gpu");
999                    }
1000                    Scope::Sys => {
1001                        push_directive(tokens, "sys");
1002                    }
1003                }
1004            }
1005            if self.global {
1006                push_directive(tokens, "global");
1007            }
1008            push_directive(tokens, "add");
1009            if let Some(level_cache_hint_41) = self.level_cache_hint.as_ref() {
1010                match level_cache_hint_41 {
1011                    LevelCacheHint::L2CacheHint => {
1012                        push_directive(tokens, "L2::cache_hint");
1013                    }
1014                }
1015            }
1016            match &self.vec_32_bit {
1017                Vec32Bit::V2 => {
1018                    push_directive(tokens, "v2");
1019                }
1020                Vec32Bit::V4 => {
1021                    push_directive(tokens, "v4");
1022                }
1023            }
1024            push_directive(tokens, "f32");
1025            if spaced {
1026                tokens.push(PtxToken::Space);
1027            }
1028            self.d.unparse_tokens_mode(tokens, spaced);
1029            tokens.push(PtxToken::Comma);
1030            if spaced {
1031                tokens.push(PtxToken::Space);
1032            }
1033            self.a.unparse_tokens_mode(tokens, spaced);
1034            tokens.push(PtxToken::Comma);
1035            if spaced {
1036                tokens.push(PtxToken::Space);
1037            }
1038            self.b.unparse_tokens_mode(tokens, spaced);
1039            if self.cache_policy.is_some() {
1040                tokens.push(PtxToken::Comma);
1041            }
1042            if let Some(opt_42) = self.cache_policy.as_ref() {
1043                if spaced {
1044                    tokens.push(PtxToken::Space);
1045                }
1046                opt_42.unparse_tokens_mode(tokens, spaced);
1047            }
1048            tokens.push(PtxToken::Semicolon);
1049            if spaced {
1050                tokens.push(PtxToken::Newline);
1051            }
1052        }
1053    }
1054
1055    impl PtxUnparser for AtomSemScopeGlobalOpNoftzLevelCacheHintVec16BitHalfWordType {
1056        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
1057            self.unparse_tokens_mode(tokens, false);
1058        }
1059        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
1060            push_opcode(tokens, "atom");
1061            if let Some(sem_43) = self.sem.as_ref() {
1062                match sem_43 {
1063                    Sem::Relaxed => {
1064                        push_directive(tokens, "relaxed");
1065                    }
1066                    Sem::Acquire => {
1067                        push_directive(tokens, "acquire");
1068                    }
1069                    Sem::Release => {
1070                        push_directive(tokens, "release");
1071                    }
1072                    Sem::AcqRel => {
1073                        push_directive(tokens, "acq_rel");
1074                    }
1075                }
1076            }
1077            if let Some(scope_44) = self.scope.as_ref() {
1078                match scope_44 {
1079                    Scope::Cluster => {
1080                        push_directive(tokens, "cluster");
1081                    }
1082                    Scope::Cta => {
1083                        push_directive(tokens, "cta");
1084                    }
1085                    Scope::Gpu => {
1086                        push_directive(tokens, "gpu");
1087                    }
1088                    Scope::Sys => {
1089                        push_directive(tokens, "sys");
1090                    }
1091                }
1092            }
1093            if self.global {
1094                push_directive(tokens, "global");
1095            }
1096            match &self.op {
1097                Op::Add => {
1098                    push_directive(tokens, "add");
1099                }
1100                Op::Min => {
1101                    push_directive(tokens, "min");
1102                }
1103                Op::Max => {
1104                    push_directive(tokens, "max");
1105                }
1106            }
1107            push_directive(tokens, "noftz");
1108            if let Some(level_cache_hint_45) = self.level_cache_hint.as_ref() {
1109                match level_cache_hint_45 {
1110                    LevelCacheHint::L2CacheHint => {
1111                        push_directive(tokens, "L2::cache_hint");
1112                    }
1113                }
1114            }
1115            match &self.vec_16_bit {
1116                Vec16Bit::V2 => {
1117                    push_directive(tokens, "v2");
1118                }
1119                Vec16Bit::V4 => {
1120                    push_directive(tokens, "v4");
1121                }
1122                Vec16Bit::V8 => {
1123                    push_directive(tokens, "v8");
1124                }
1125            }
1126            match &self.half_word_type {
1127                HalfWordType::Bf16 => {
1128                    push_directive(tokens, "bf16");
1129                }
1130                HalfWordType::F16 => {
1131                    push_directive(tokens, "f16");
1132                }
1133            }
1134            if spaced {
1135                tokens.push(PtxToken::Space);
1136            }
1137            self.d.unparse_tokens_mode(tokens, spaced);
1138            tokens.push(PtxToken::Comma);
1139            if spaced {
1140                tokens.push(PtxToken::Space);
1141            }
1142            self.a.unparse_tokens_mode(tokens, spaced);
1143            tokens.push(PtxToken::Comma);
1144            if spaced {
1145                tokens.push(PtxToken::Space);
1146            }
1147            self.b.unparse_tokens_mode(tokens, spaced);
1148            if self.cache_policy.is_some() {
1149                tokens.push(PtxToken::Comma);
1150            }
1151            if let Some(opt_46) = self.cache_policy.as_ref() {
1152                if spaced {
1153                    tokens.push(PtxToken::Space);
1154                }
1155                opt_46.unparse_tokens_mode(tokens, spaced);
1156            }
1157            tokens.push(PtxToken::Semicolon);
1158            if spaced {
1159                tokens.push(PtxToken::Newline);
1160            }
1161        }
1162    }
1163
1164    impl PtxUnparser for AtomSemScopeGlobalOpNoftzLevelCacheHintVec32BitPackedType {
1165        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
1166            self.unparse_tokens_mode(tokens, false);
1167        }
1168        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
1169            push_opcode(tokens, "atom");
1170            if let Some(sem_47) = self.sem.as_ref() {
1171                match sem_47 {
1172                    Sem::Relaxed => {
1173                        push_directive(tokens, "relaxed");
1174                    }
1175                    Sem::Acquire => {
1176                        push_directive(tokens, "acquire");
1177                    }
1178                    Sem::Release => {
1179                        push_directive(tokens, "release");
1180                    }
1181                    Sem::AcqRel => {
1182                        push_directive(tokens, "acq_rel");
1183                    }
1184                }
1185            }
1186            if let Some(scope_48) = self.scope.as_ref() {
1187                match scope_48 {
1188                    Scope::Cluster => {
1189                        push_directive(tokens, "cluster");
1190                    }
1191                    Scope::Cta => {
1192                        push_directive(tokens, "cta");
1193                    }
1194                    Scope::Gpu => {
1195                        push_directive(tokens, "gpu");
1196                    }
1197                    Scope::Sys => {
1198                        push_directive(tokens, "sys");
1199                    }
1200                }
1201            }
1202            if self.global {
1203                push_directive(tokens, "global");
1204            }
1205            match &self.op {
1206                Op::Add => {
1207                    push_directive(tokens, "add");
1208                }
1209                Op::Min => {
1210                    push_directive(tokens, "min");
1211                }
1212                Op::Max => {
1213                    push_directive(tokens, "max");
1214                }
1215            }
1216            push_directive(tokens, "noftz");
1217            if let Some(level_cache_hint_49) = self.level_cache_hint.as_ref() {
1218                match level_cache_hint_49 {
1219                    LevelCacheHint::L2CacheHint => {
1220                        push_directive(tokens, "L2::cache_hint");
1221                    }
1222                }
1223            }
1224            match &self.vec_32_bit {
1225                Vec32Bit::V2 => {
1226                    push_directive(tokens, "v2");
1227                }
1228                Vec32Bit::V4 => {
1229                    push_directive(tokens, "v4");
1230                }
1231            }
1232            match &self.packed_type {
1233                PackedType::Bf16x2 => {
1234                    push_directive(tokens, "bf16x2");
1235                }
1236                PackedType::F16x2 => {
1237                    push_directive(tokens, "f16x2");
1238                }
1239            }
1240            if spaced {
1241                tokens.push(PtxToken::Space);
1242            }
1243            self.d.unparse_tokens_mode(tokens, spaced);
1244            tokens.push(PtxToken::Comma);
1245            if spaced {
1246                tokens.push(PtxToken::Space);
1247            }
1248            self.a.unparse_tokens_mode(tokens, spaced);
1249            tokens.push(PtxToken::Comma);
1250            if spaced {
1251                tokens.push(PtxToken::Space);
1252            }
1253            self.b.unparse_tokens_mode(tokens, spaced);
1254            if self.cache_policy.is_some() {
1255                tokens.push(PtxToken::Comma);
1256            }
1257            if let Some(opt_50) = self.cache_policy.as_ref() {
1258                if spaced {
1259                    tokens.push(PtxToken::Space);
1260                }
1261                opt_50.unparse_tokens_mode(tokens, spaced);
1262            }
1263            tokens.push(PtxToken::Semicolon);
1264            if spaced {
1265                tokens.push(PtxToken::Newline);
1266            }
1267        }
1268    }
1269}