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            push_opcode(tokens, "atom");
45            if let Some(sem_0) = self.sem.as_ref() {
46                match sem_0 {
47                    Sem::Relaxed => {
48                        push_directive(tokens, "relaxed");
49                    }
50                    Sem::Acquire => {
51                        push_directive(tokens, "acquire");
52                    }
53                    Sem::Release => {
54                        push_directive(tokens, "release");
55                    }
56                    Sem::AcqRel => {
57                        push_directive(tokens, "acq_rel");
58                    }
59                }
60            }
61            if let Some(scope_1) = self.scope.as_ref() {
62                match scope_1 {
63                    Scope::Cluster => {
64                        push_directive(tokens, "cluster");
65                    }
66                    Scope::Cta => {
67                        push_directive(tokens, "cta");
68                    }
69                    Scope::Gpu => {
70                        push_directive(tokens, "gpu");
71                    }
72                    Scope::Sys => {
73                        push_directive(tokens, "sys");
74                    }
75                }
76            }
77            if let Some(space_2) = self.space.as_ref() {
78                match space_2 {
79                    Space::SharedCluster => {
80                        push_directive(tokens, "shared::cluster");
81                    }
82                    Space::SharedCta => {
83                        push_directive(tokens, "shared::cta");
84                    }
85                    Space::Global => {
86                        push_directive(tokens, "global");
87                    }
88                    Space::Shared => {
89                        push_directive(tokens, "shared");
90                    }
91                }
92            }
93            match &self.op {
94                Op::Exch => {
95                    push_directive(tokens, "exch");
96                }
97                Op::And => {
98                    push_directive(tokens, "and");
99                }
100                Op::Xor => {
101                    push_directive(tokens, "xor");
102                }
103                Op::Cas => {
104                    push_directive(tokens, "cas");
105                }
106                Op::Add => {
107                    push_directive(tokens, "add");
108                }
109                Op::Inc => {
110                    push_directive(tokens, "inc");
111                }
112                Op::Dec => {
113                    push_directive(tokens, "dec");
114                }
115                Op::Min => {
116                    push_directive(tokens, "min");
117                }
118                Op::Max => {
119                    push_directive(tokens, "max");
120                }
121                Op::Or => {
122                    push_directive(tokens, "or");
123                }
124            }
125            if let Some(level_cache_hint_3) = self.level_cache_hint.as_ref() {
126                match level_cache_hint_3 {
127                    LevelCacheHint::L2CacheHint => {
128                        push_directive(tokens, "L2::cache_hint");
129                    }
130                }
131            }
132            match &self.type_ {
133                Type::B32 => {
134                    push_directive(tokens, "b32");
135                }
136                Type::B64 => {
137                    push_directive(tokens, "b64");
138                }
139                Type::U32 => {
140                    push_directive(tokens, "u32");
141                }
142                Type::U64 => {
143                    push_directive(tokens, "u64");
144                }
145                Type::S32 => {
146                    push_directive(tokens, "s32");
147                }
148                Type::S64 => {
149                    push_directive(tokens, "s64");
150                }
151                Type::F32 => {
152                    push_directive(tokens, "f32");
153                }
154                Type::F64 => {
155                    push_directive(tokens, "f64");
156                }
157            }
158            self.d.unparse_tokens(tokens);
159            tokens.push(PtxToken::Comma);
160            self.a.unparse_tokens(tokens);
161            tokens.push(PtxToken::Comma);
162            self.b.unparse_tokens(tokens);
163            if self.cache_policy.is_some() {
164                tokens.push(PtxToken::Comma);
165            }
166            if let Some(opt_4) = self.cache_policy.as_ref() {
167                opt_4.unparse_tokens(tokens);
168            }
169            tokens.push(PtxToken::Semicolon);
170        }
171    }
172
173    impl PtxUnparser for AtomSemScopeSpaceOpType {
174        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
175            push_opcode(tokens, "atom");
176            if let Some(sem_5) = self.sem.as_ref() {
177                match sem_5 {
178                    Sem::Relaxed => {
179                        push_directive(tokens, "relaxed");
180                    }
181                    Sem::Acquire => {
182                        push_directive(tokens, "acquire");
183                    }
184                    Sem::Release => {
185                        push_directive(tokens, "release");
186                    }
187                    Sem::AcqRel => {
188                        push_directive(tokens, "acq_rel");
189                    }
190                }
191            }
192            if let Some(scope_6) = self.scope.as_ref() {
193                match scope_6 {
194                    Scope::Cluster => {
195                        push_directive(tokens, "cluster");
196                    }
197                    Scope::Cta => {
198                        push_directive(tokens, "cta");
199                    }
200                    Scope::Gpu => {
201                        push_directive(tokens, "gpu");
202                    }
203                    Scope::Sys => {
204                        push_directive(tokens, "sys");
205                    }
206                }
207            }
208            if let Some(space_7) = self.space.as_ref() {
209                match space_7 {
210                    Space::SharedCluster => {
211                        push_directive(tokens, "shared::cluster");
212                    }
213                    Space::SharedCta => {
214                        push_directive(tokens, "shared::cta");
215                    }
216                    Space::Global => {
217                        push_directive(tokens, "global");
218                    }
219                    Space::Shared => {
220                        push_directive(tokens, "shared");
221                    }
222                }
223            }
224            match &self.op {
225                Op::Exch => {
226                    push_directive(tokens, "exch");
227                }
228                Op::And => {
229                    push_directive(tokens, "and");
230                }
231                Op::Xor => {
232                    push_directive(tokens, "xor");
233                }
234                Op::Cas => {
235                    push_directive(tokens, "cas");
236                }
237                Op::Add => {
238                    push_directive(tokens, "add");
239                }
240                Op::Inc => {
241                    push_directive(tokens, "inc");
242                }
243                Op::Dec => {
244                    push_directive(tokens, "dec");
245                }
246                Op::Min => {
247                    push_directive(tokens, "min");
248                }
249                Op::Max => {
250                    push_directive(tokens, "max");
251                }
252                Op::Or => {
253                    push_directive(tokens, "or");
254                }
255            }
256            match &self.type_ {
257                Type::B32 => {
258                    push_directive(tokens, "b32");
259                }
260                Type::B64 => {
261                    push_directive(tokens, "b64");
262                }
263                Type::U32 => {
264                    push_directive(tokens, "u32");
265                }
266                Type::U64 => {
267                    push_directive(tokens, "u64");
268                }
269                Type::S32 => {
270                    push_directive(tokens, "s32");
271                }
272                Type::S64 => {
273                    push_directive(tokens, "s64");
274                }
275                Type::F32 => {
276                    push_directive(tokens, "f32");
277                }
278                Type::F64 => {
279                    push_directive(tokens, "f64");
280                }
281            }
282            self.d.unparse_tokens(tokens);
283            tokens.push(PtxToken::Comma);
284            self.a.unparse_tokens(tokens);
285            tokens.push(PtxToken::Comma);
286            self.b.unparse_tokens(tokens);
287            tokens.push(PtxToken::Comma);
288            self.c.unparse_tokens(tokens);
289            tokens.push(PtxToken::Semicolon);
290        }
291    }
292
293    impl PtxUnparser for AtomSemScopeSpaceCasB16 {
294        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
295            push_opcode(tokens, "atom");
296            if let Some(sem_8) = self.sem.as_ref() {
297                match sem_8 {
298                    Sem::Relaxed => {
299                        push_directive(tokens, "relaxed");
300                    }
301                    Sem::Acquire => {
302                        push_directive(tokens, "acquire");
303                    }
304                    Sem::Release => {
305                        push_directive(tokens, "release");
306                    }
307                    Sem::AcqRel => {
308                        push_directive(tokens, "acq_rel");
309                    }
310                }
311            }
312            if let Some(scope_9) = self.scope.as_ref() {
313                match scope_9 {
314                    Scope::Cluster => {
315                        push_directive(tokens, "cluster");
316                    }
317                    Scope::Cta => {
318                        push_directive(tokens, "cta");
319                    }
320                    Scope::Gpu => {
321                        push_directive(tokens, "gpu");
322                    }
323                    Scope::Sys => {
324                        push_directive(tokens, "sys");
325                    }
326                }
327            }
328            if let Some(space_10) = self.space.as_ref() {
329                match space_10 {
330                    Space::SharedCluster => {
331                        push_directive(tokens, "shared::cluster");
332                    }
333                    Space::SharedCta => {
334                        push_directive(tokens, "shared::cta");
335                    }
336                    Space::Global => {
337                        push_directive(tokens, "global");
338                    }
339                    Space::Shared => {
340                        push_directive(tokens, "shared");
341                    }
342                }
343            }
344            push_directive(tokens, "cas");
345            push_directive(tokens, "b16");
346            self.d.unparse_tokens(tokens);
347            tokens.push(PtxToken::Comma);
348            self.a.unparse_tokens(tokens);
349            tokens.push(PtxToken::Comma);
350            self.b.unparse_tokens(tokens);
351            tokens.push(PtxToken::Comma);
352            self.c.unparse_tokens(tokens);
353            tokens.push(PtxToken::Semicolon);
354        }
355    }
356
357    impl PtxUnparser for AtomSemScopeSpaceCasB128 {
358        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
359            push_opcode(tokens, "atom");
360            if let Some(sem_11) = self.sem.as_ref() {
361                match sem_11 {
362                    Sem::Relaxed => {
363                        push_directive(tokens, "relaxed");
364                    }
365                    Sem::Acquire => {
366                        push_directive(tokens, "acquire");
367                    }
368                    Sem::Release => {
369                        push_directive(tokens, "release");
370                    }
371                    Sem::AcqRel => {
372                        push_directive(tokens, "acq_rel");
373                    }
374                }
375            }
376            if let Some(scope_12) = self.scope.as_ref() {
377                match scope_12 {
378                    Scope::Cluster => {
379                        push_directive(tokens, "cluster");
380                    }
381                    Scope::Cta => {
382                        push_directive(tokens, "cta");
383                    }
384                    Scope::Gpu => {
385                        push_directive(tokens, "gpu");
386                    }
387                    Scope::Sys => {
388                        push_directive(tokens, "sys");
389                    }
390                }
391            }
392            if let Some(space_13) = self.space.as_ref() {
393                match space_13 {
394                    Space::SharedCluster => {
395                        push_directive(tokens, "shared::cluster");
396                    }
397                    Space::SharedCta => {
398                        push_directive(tokens, "shared::cta");
399                    }
400                    Space::Global => {
401                        push_directive(tokens, "global");
402                    }
403                    Space::Shared => {
404                        push_directive(tokens, "shared");
405                    }
406                }
407            }
408            push_directive(tokens, "cas");
409            push_directive(tokens, "b128");
410            self.d.unparse_tokens(tokens);
411            tokens.push(PtxToken::Comma);
412            self.a.unparse_tokens(tokens);
413            tokens.push(PtxToken::Comma);
414            self.b.unparse_tokens(tokens);
415            tokens.push(PtxToken::Comma);
416            self.c.unparse_tokens(tokens);
417            tokens.push(PtxToken::Semicolon);
418        }
419    }
420
421    impl PtxUnparser for AtomSemScopeSpaceExchLevelCacheHintB128 {
422        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
423            push_opcode(tokens, "atom");
424            if let Some(sem_14) = self.sem.as_ref() {
425                match sem_14 {
426                    Sem::Relaxed => {
427                        push_directive(tokens, "relaxed");
428                    }
429                    Sem::Acquire => {
430                        push_directive(tokens, "acquire");
431                    }
432                    Sem::Release => {
433                        push_directive(tokens, "release");
434                    }
435                    Sem::AcqRel => {
436                        push_directive(tokens, "acq_rel");
437                    }
438                }
439            }
440            if let Some(scope_15) = self.scope.as_ref() {
441                match scope_15 {
442                    Scope::Cluster => {
443                        push_directive(tokens, "cluster");
444                    }
445                    Scope::Cta => {
446                        push_directive(tokens, "cta");
447                    }
448                    Scope::Gpu => {
449                        push_directive(tokens, "gpu");
450                    }
451                    Scope::Sys => {
452                        push_directive(tokens, "sys");
453                    }
454                }
455            }
456            if let Some(space_16) = self.space.as_ref() {
457                match space_16 {
458                    Space::SharedCluster => {
459                        push_directive(tokens, "shared::cluster");
460                    }
461                    Space::SharedCta => {
462                        push_directive(tokens, "shared::cta");
463                    }
464                    Space::Global => {
465                        push_directive(tokens, "global");
466                    }
467                    Space::Shared => {
468                        push_directive(tokens, "shared");
469                    }
470                }
471            }
472            push_directive(tokens, "exch");
473            if let Some(level_cache_hint_17) = self.level_cache_hint.as_ref() {
474                match level_cache_hint_17 {
475                    LevelCacheHint::L2CacheHint => {
476                        push_directive(tokens, "L2::cache_hint");
477                    }
478                }
479            }
480            push_directive(tokens, "b128");
481            self.d.unparse_tokens(tokens);
482            tokens.push(PtxToken::Comma);
483            self.a.unparse_tokens(tokens);
484            tokens.push(PtxToken::Comma);
485            self.b.unparse_tokens(tokens);
486            if self.cache_policy.is_some() {
487                tokens.push(PtxToken::Comma);
488            }
489            if let Some(opt_18) = self.cache_policy.as_ref() {
490                opt_18.unparse_tokens(tokens);
491            }
492            tokens.push(PtxToken::Semicolon);
493        }
494    }
495
496    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintF16 {
497        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
498            push_opcode(tokens, "atom");
499            if let Some(sem_19) = self.sem.as_ref() {
500                match sem_19 {
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_20) = self.scope.as_ref() {
516                match scope_20 {
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_21) = self.space.as_ref() {
532                match space_21 {
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, "add");
548            push_directive(tokens, "noftz");
549            if let Some(level_cache_hint_22) = self.level_cache_hint.as_ref() {
550                match level_cache_hint_22 {
551                    LevelCacheHint::L2CacheHint => {
552                        push_directive(tokens, "L2::cache_hint");
553                    }
554                }
555            }
556            push_directive(tokens, "f16");
557            self.d.unparse_tokens(tokens);
558            tokens.push(PtxToken::Comma);
559            self.a.unparse_tokens(tokens);
560            tokens.push(PtxToken::Comma);
561            self.b.unparse_tokens(tokens);
562            if self.cache_policy.is_some() {
563                tokens.push(PtxToken::Comma);
564            }
565            if let Some(opt_23) = self.cache_policy.as_ref() {
566                opt_23.unparse_tokens(tokens);
567            }
568            tokens.push(PtxToken::Semicolon);
569        }
570    }
571
572    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintF16x2 {
573        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
574            push_opcode(tokens, "atom");
575            if let Some(sem_24) = self.sem.as_ref() {
576                match sem_24 {
577                    Sem::Relaxed => {
578                        push_directive(tokens, "relaxed");
579                    }
580                    Sem::Acquire => {
581                        push_directive(tokens, "acquire");
582                    }
583                    Sem::Release => {
584                        push_directive(tokens, "release");
585                    }
586                    Sem::AcqRel => {
587                        push_directive(tokens, "acq_rel");
588                    }
589                }
590            }
591            if let Some(scope_25) = self.scope.as_ref() {
592                match scope_25 {
593                    Scope::Cluster => {
594                        push_directive(tokens, "cluster");
595                    }
596                    Scope::Cta => {
597                        push_directive(tokens, "cta");
598                    }
599                    Scope::Gpu => {
600                        push_directive(tokens, "gpu");
601                    }
602                    Scope::Sys => {
603                        push_directive(tokens, "sys");
604                    }
605                }
606            }
607            if let Some(space_26) = self.space.as_ref() {
608                match space_26 {
609                    Space::SharedCluster => {
610                        push_directive(tokens, "shared::cluster");
611                    }
612                    Space::SharedCta => {
613                        push_directive(tokens, "shared::cta");
614                    }
615                    Space::Global => {
616                        push_directive(tokens, "global");
617                    }
618                    Space::Shared => {
619                        push_directive(tokens, "shared");
620                    }
621                }
622            }
623            push_directive(tokens, "add");
624            push_directive(tokens, "noftz");
625            if let Some(level_cache_hint_27) = self.level_cache_hint.as_ref() {
626                match level_cache_hint_27 {
627                    LevelCacheHint::L2CacheHint => {
628                        push_directive(tokens, "L2::cache_hint");
629                    }
630                }
631            }
632            push_directive(tokens, "f16x2");
633            self.d.unparse_tokens(tokens);
634            tokens.push(PtxToken::Comma);
635            self.a.unparse_tokens(tokens);
636            tokens.push(PtxToken::Comma);
637            self.b.unparse_tokens(tokens);
638            if self.cache_policy.is_some() {
639                tokens.push(PtxToken::Comma);
640            }
641            if let Some(opt_28) = self.cache_policy.as_ref() {
642                opt_28.unparse_tokens(tokens);
643            }
644            tokens.push(PtxToken::Semicolon);
645        }
646    }
647
648    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintBf16 {
649        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
650            push_opcode(tokens, "atom");
651            if let Some(sem_29) = self.sem.as_ref() {
652                match sem_29 {
653                    Sem::Relaxed => {
654                        push_directive(tokens, "relaxed");
655                    }
656                    Sem::Acquire => {
657                        push_directive(tokens, "acquire");
658                    }
659                    Sem::Release => {
660                        push_directive(tokens, "release");
661                    }
662                    Sem::AcqRel => {
663                        push_directive(tokens, "acq_rel");
664                    }
665                }
666            }
667            if let Some(scope_30) = self.scope.as_ref() {
668                match scope_30 {
669                    Scope::Cluster => {
670                        push_directive(tokens, "cluster");
671                    }
672                    Scope::Cta => {
673                        push_directive(tokens, "cta");
674                    }
675                    Scope::Gpu => {
676                        push_directive(tokens, "gpu");
677                    }
678                    Scope::Sys => {
679                        push_directive(tokens, "sys");
680                    }
681                }
682            }
683            if let Some(space_31) = self.space.as_ref() {
684                match space_31 {
685                    Space::SharedCluster => {
686                        push_directive(tokens, "shared::cluster");
687                    }
688                    Space::SharedCta => {
689                        push_directive(tokens, "shared::cta");
690                    }
691                    Space::Global => {
692                        push_directive(tokens, "global");
693                    }
694                    Space::Shared => {
695                        push_directive(tokens, "shared");
696                    }
697                }
698            }
699            push_directive(tokens, "add");
700            push_directive(tokens, "noftz");
701            if let Some(level_cache_hint_32) = self.level_cache_hint.as_ref() {
702                match level_cache_hint_32 {
703                    LevelCacheHint::L2CacheHint => {
704                        push_directive(tokens, "L2::cache_hint");
705                    }
706                }
707            }
708            push_directive(tokens, "bf16");
709            self.d.unparse_tokens(tokens);
710            tokens.push(PtxToken::Comma);
711            self.a.unparse_tokens(tokens);
712            tokens.push(PtxToken::Comma);
713            self.b.unparse_tokens(tokens);
714            if self.cache_policy.is_some() {
715                tokens.push(PtxToken::Comma);
716            }
717            if let Some(opt_33) = self.cache_policy.as_ref() {
718                opt_33.unparse_tokens(tokens);
719            }
720            tokens.push(PtxToken::Semicolon);
721        }
722    }
723
724    impl PtxUnparser for AtomSemScopeSpaceAddNoftzLevelCacheHintBf16x2 {
725        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
726            push_opcode(tokens, "atom");
727            if let Some(sem_34) = self.sem.as_ref() {
728                match sem_34 {
729                    Sem::Relaxed => {
730                        push_directive(tokens, "relaxed");
731                    }
732                    Sem::Acquire => {
733                        push_directive(tokens, "acquire");
734                    }
735                    Sem::Release => {
736                        push_directive(tokens, "release");
737                    }
738                    Sem::AcqRel => {
739                        push_directive(tokens, "acq_rel");
740                    }
741                }
742            }
743            if let Some(scope_35) = self.scope.as_ref() {
744                match scope_35 {
745                    Scope::Cluster => {
746                        push_directive(tokens, "cluster");
747                    }
748                    Scope::Cta => {
749                        push_directive(tokens, "cta");
750                    }
751                    Scope::Gpu => {
752                        push_directive(tokens, "gpu");
753                    }
754                    Scope::Sys => {
755                        push_directive(tokens, "sys");
756                    }
757                }
758            }
759            if let Some(space_36) = self.space.as_ref() {
760                match space_36 {
761                    Space::SharedCluster => {
762                        push_directive(tokens, "shared::cluster");
763                    }
764                    Space::SharedCta => {
765                        push_directive(tokens, "shared::cta");
766                    }
767                    Space::Global => {
768                        push_directive(tokens, "global");
769                    }
770                    Space::Shared => {
771                        push_directive(tokens, "shared");
772                    }
773                }
774            }
775            push_directive(tokens, "add");
776            push_directive(tokens, "noftz");
777            if let Some(level_cache_hint_37) = self.level_cache_hint.as_ref() {
778                match level_cache_hint_37 {
779                    LevelCacheHint::L2CacheHint => {
780                        push_directive(tokens, "L2::cache_hint");
781                    }
782                }
783            }
784            push_directive(tokens, "bf16x2");
785            self.d.unparse_tokens(tokens);
786            tokens.push(PtxToken::Comma);
787            self.a.unparse_tokens(tokens);
788            tokens.push(PtxToken::Comma);
789            self.b.unparse_tokens(tokens);
790            if self.cache_policy.is_some() {
791                tokens.push(PtxToken::Comma);
792            }
793            if let Some(opt_38) = self.cache_policy.as_ref() {
794                opt_38.unparse_tokens(tokens);
795            }
796            tokens.push(PtxToken::Semicolon);
797        }
798    }
799}
800
801pub mod section_1 {
802    use super::*;
803    use crate::r#type::instruction::atom::section_1::*;
804
805    impl PtxUnparser for AtomSemScopeGlobalAddLevelCacheHintVec32BitF32 {
806        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
807            push_opcode(tokens, "atom");
808            if let Some(sem_39) = self.sem.as_ref() {
809                match sem_39 {
810                    Sem::Relaxed => {
811                        push_directive(tokens, "relaxed");
812                    }
813                    Sem::Acquire => {
814                        push_directive(tokens, "acquire");
815                    }
816                    Sem::Release => {
817                        push_directive(tokens, "release");
818                    }
819                    Sem::AcqRel => {
820                        push_directive(tokens, "acq_rel");
821                    }
822                }
823            }
824            if let Some(scope_40) = self.scope.as_ref() {
825                match scope_40 {
826                    Scope::Cluster => {
827                        push_directive(tokens, "cluster");
828                    }
829                    Scope::Cta => {
830                        push_directive(tokens, "cta");
831                    }
832                    Scope::Gpu => {
833                        push_directive(tokens, "gpu");
834                    }
835                    Scope::Sys => {
836                        push_directive(tokens, "sys");
837                    }
838                }
839            }
840            if self.global {
841                push_directive(tokens, "global");
842            }
843            push_directive(tokens, "add");
844            if let Some(level_cache_hint_41) = self.level_cache_hint.as_ref() {
845                match level_cache_hint_41 {
846                    LevelCacheHint::L2CacheHint => {
847                        push_directive(tokens, "L2::cache_hint");
848                    }
849                }
850            }
851            match &self.vec_32_bit {
852                Vec32Bit::V2 => {
853                    push_directive(tokens, "v2");
854                }
855                Vec32Bit::V4 => {
856                    push_directive(tokens, "v4");
857                }
858            }
859            push_directive(tokens, "f32");
860            self.d.unparse_tokens(tokens);
861            tokens.push(PtxToken::Comma);
862            self.a.unparse_tokens(tokens);
863            tokens.push(PtxToken::Comma);
864            self.b.unparse_tokens(tokens);
865            if self.cache_policy.is_some() {
866                tokens.push(PtxToken::Comma);
867            }
868            if let Some(opt_42) = self.cache_policy.as_ref() {
869                opt_42.unparse_tokens(tokens);
870            }
871            tokens.push(PtxToken::Semicolon);
872        }
873    }
874
875    impl PtxUnparser for AtomSemScopeGlobalOpNoftzLevelCacheHintVec16BitHalfWordType {
876        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
877            push_opcode(tokens, "atom");
878            if let Some(sem_43) = self.sem.as_ref() {
879                match sem_43 {
880                    Sem::Relaxed => {
881                        push_directive(tokens, "relaxed");
882                    }
883                    Sem::Acquire => {
884                        push_directive(tokens, "acquire");
885                    }
886                    Sem::Release => {
887                        push_directive(tokens, "release");
888                    }
889                    Sem::AcqRel => {
890                        push_directive(tokens, "acq_rel");
891                    }
892                }
893            }
894            if let Some(scope_44) = self.scope.as_ref() {
895                match scope_44 {
896                    Scope::Cluster => {
897                        push_directive(tokens, "cluster");
898                    }
899                    Scope::Cta => {
900                        push_directive(tokens, "cta");
901                    }
902                    Scope::Gpu => {
903                        push_directive(tokens, "gpu");
904                    }
905                    Scope::Sys => {
906                        push_directive(tokens, "sys");
907                    }
908                }
909            }
910            if self.global {
911                push_directive(tokens, "global");
912            }
913            match &self.op {
914                Op::Add => {
915                    push_directive(tokens, "add");
916                }
917                Op::Min => {
918                    push_directive(tokens, "min");
919                }
920                Op::Max => {
921                    push_directive(tokens, "max");
922                }
923            }
924            push_directive(tokens, "noftz");
925            if let Some(level_cache_hint_45) = self.level_cache_hint.as_ref() {
926                match level_cache_hint_45 {
927                    LevelCacheHint::L2CacheHint => {
928                        push_directive(tokens, "L2::cache_hint");
929                    }
930                }
931            }
932            match &self.vec_16_bit {
933                Vec16Bit::V2 => {
934                    push_directive(tokens, "v2");
935                }
936                Vec16Bit::V4 => {
937                    push_directive(tokens, "v4");
938                }
939                Vec16Bit::V8 => {
940                    push_directive(tokens, "v8");
941                }
942            }
943            match &self.half_word_type {
944                HalfWordType::Bf16 => {
945                    push_directive(tokens, "bf16");
946                }
947                HalfWordType::F16 => {
948                    push_directive(tokens, "f16");
949                }
950            }
951            self.d.unparse_tokens(tokens);
952            tokens.push(PtxToken::Comma);
953            self.a.unparse_tokens(tokens);
954            tokens.push(PtxToken::Comma);
955            self.b.unparse_tokens(tokens);
956            if self.cache_policy.is_some() {
957                tokens.push(PtxToken::Comma);
958            }
959            if let Some(opt_46) = self.cache_policy.as_ref() {
960                opt_46.unparse_tokens(tokens);
961            }
962            tokens.push(PtxToken::Semicolon);
963        }
964    }
965
966    impl PtxUnparser for AtomSemScopeGlobalOpNoftzLevelCacheHintVec32BitPackedType {
967        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
968            push_opcode(tokens, "atom");
969            if let Some(sem_47) = self.sem.as_ref() {
970                match sem_47 {
971                    Sem::Relaxed => {
972                        push_directive(tokens, "relaxed");
973                    }
974                    Sem::Acquire => {
975                        push_directive(tokens, "acquire");
976                    }
977                    Sem::Release => {
978                        push_directive(tokens, "release");
979                    }
980                    Sem::AcqRel => {
981                        push_directive(tokens, "acq_rel");
982                    }
983                }
984            }
985            if let Some(scope_48) = self.scope.as_ref() {
986                match scope_48 {
987                    Scope::Cluster => {
988                        push_directive(tokens, "cluster");
989                    }
990                    Scope::Cta => {
991                        push_directive(tokens, "cta");
992                    }
993                    Scope::Gpu => {
994                        push_directive(tokens, "gpu");
995                    }
996                    Scope::Sys => {
997                        push_directive(tokens, "sys");
998                    }
999                }
1000            }
1001            if self.global {
1002                push_directive(tokens, "global");
1003            }
1004            match &self.op {
1005                Op::Add => {
1006                    push_directive(tokens, "add");
1007                }
1008                Op::Min => {
1009                    push_directive(tokens, "min");
1010                }
1011                Op::Max => {
1012                    push_directive(tokens, "max");
1013                }
1014            }
1015            push_directive(tokens, "noftz");
1016            if let Some(level_cache_hint_49) = self.level_cache_hint.as_ref() {
1017                match level_cache_hint_49 {
1018                    LevelCacheHint::L2CacheHint => {
1019                        push_directive(tokens, "L2::cache_hint");
1020                    }
1021                }
1022            }
1023            match &self.vec_32_bit {
1024                Vec32Bit::V2 => {
1025                    push_directive(tokens, "v2");
1026                }
1027                Vec32Bit::V4 => {
1028                    push_directive(tokens, "v4");
1029                }
1030            }
1031            match &self.packed_type {
1032                PackedType::Bf16x2 => {
1033                    push_directive(tokens, "bf16x2");
1034                }
1035                PackedType::F16x2 => {
1036                    push_directive(tokens, "f16x2");
1037                }
1038            }
1039            self.d.unparse_tokens(tokens);
1040            tokens.push(PtxToken::Comma);
1041            self.a.unparse_tokens(tokens);
1042            tokens.push(PtxToken::Comma);
1043            self.b.unparse_tokens(tokens);
1044            if self.cache_policy.is_some() {
1045                tokens.push(PtxToken::Comma);
1046            }
1047            if let Some(opt_50) = self.cache_policy.as_ref() {
1048                opt_50.unparse_tokens(tokens);
1049            }
1050            tokens.push(PtxToken::Semicolon);
1051        }
1052    }
1053}