Skip to main content

ptx_parser/unparser/instruction/
multimem_ld_reduce.rs

1//! Original PTX specification:
2//!
3//! // Integer type:
4//! multimem.ld_reduce{.ldsem}{.scope}{.ss}.op.type      d, [a];
5//! multimem.ld_reduce.weak{.ss}.op.type                 d, [a];
6//! multimem.st{.stsem}{.scope}{.ss}.type                [a], b;
7//! multimem.st.weak{.ss}.type                           [a], b;
8//! multimem.red{.redsem}{.scope}{.ss}.op.type           [a], b;
9//! .ss =       { .global };
10//! .ldsem =    { .relaxed, .acquire };
11//! .stsem =    { .relaxed, .release };
12//! .redsem =   { .relaxed, .release };
13//! .scope =    { .cta, .cluster, .gpu, .sys };
14//! .op  =      { .min, .max, .add, .and, .or, .xor };
15//! .type =     { .b32, .b64,  .u32, .u64, .s32, .s64 };
16//! ------------------------------------------------------------------
17//! // Floating point type:
18//! multimem.ld_reduce{.ldsem}{.scope}{.ss}.op{.acc_prec}{.vec}.type    d, [a];
19//! multimem.ld_reduce.weak{.ss}.op{.acc_prec}{.vec}.type               d, [a];
20//! multimem.st{.stsem}{.scope}{.ss}{.vec}.type                         [a], b;
21//! multimem.st.weak{.ss}{.vec}.type                                    [a], b;
22//! multimem.red{.redsem}{.scope}{.ss}.redop{.vec}.redtype              [a], b;
23//! .ss =       { .global };
24//! .ldsem =    { .relaxed, .acquire };
25//! .stsem =    { .relaxed, .release };
26//! .redsem =   { .relaxed, .release };
27//! .scope =    { .cta, .cluster, .gpu, .sys };
28//! .op  =      { .min, .max, .add };
29//! .redop  =   { .add };
30//! .acc_prec = { .acc::f32, .acc::f16 };
31//! .vec =      { .v2, .v4, .v8 };
32//! .type=      { .f16, .f16x2, .bf16, .bf16x2, .f32, .f64, .e5m2, .e5m2x2, .e5m2x4, .e4m3, .e4m3x2, .e4m3x4 };
33//! .redtype =  { .f16, .f16x2, .bf16, .bf16x2, .f32, .f64 };
34
35#![allow(unused)]
36
37use crate::lexer::PtxToken;
38use crate::unparser::{PtxUnparser, common::*};
39
40pub mod section_0 {
41    use super::*;
42    use crate::r#type::instruction::multimem_ld_reduce::section_0::*;
43
44    impl PtxUnparser for MultimemLdReduceLdsemScopeSsOpType {
45        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
46            self.unparse_tokens_mode(tokens, false);
47        }
48        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
49            push_opcode(tokens, "multimem");
50            push_directive(tokens, "ld_reduce");
51            if let Some(ldsem_0) = self.ldsem.as_ref() {
52                match ldsem_0 {
53                    Ldsem::Relaxed => {
54                        push_directive(tokens, "relaxed");
55                    }
56                    Ldsem::Acquire => {
57                        push_directive(tokens, "acquire");
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(ss_2) = self.ss.as_ref() {
78                match ss_2 {
79                    Ss::Global => {
80                        push_directive(tokens, "global");
81                    }
82                }
83            }
84            match &self.op {
85                Op::Min => {
86                    push_directive(tokens, "min");
87                }
88                Op::Max => {
89                    push_directive(tokens, "max");
90                }
91                Op::Add => {
92                    push_directive(tokens, "add");
93                }
94                Op::And => {
95                    push_directive(tokens, "and");
96                }
97                Op::Xor => {
98                    push_directive(tokens, "xor");
99                }
100                Op::Or => {
101                    push_directive(tokens, "or");
102                }
103            }
104            match &self.type_ {
105                Type::B32 => {
106                    push_directive(tokens, "b32");
107                }
108                Type::B64 => {
109                    push_directive(tokens, "b64");
110                }
111                Type::U32 => {
112                    push_directive(tokens, "u32");
113                }
114                Type::U64 => {
115                    push_directive(tokens, "u64");
116                }
117                Type::S32 => {
118                    push_directive(tokens, "s32");
119                }
120                Type::S64 => {
121                    push_directive(tokens, "s64");
122                }
123            }
124            if spaced {
125                tokens.push(PtxToken::Space);
126            }
127            self.d.unparse_tokens_mode(tokens, spaced);
128            tokens.push(PtxToken::Comma);
129            if spaced {
130                tokens.push(PtxToken::Space);
131            }
132            self.a.unparse_tokens_mode(tokens, spaced);
133            tokens.push(PtxToken::Semicolon);
134            if spaced {
135                tokens.push(PtxToken::Newline);
136            }
137        }
138    }
139
140    impl PtxUnparser for MultimemLdReduceWeakSsOpType {
141        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
142            self.unparse_tokens_mode(tokens, false);
143        }
144        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
145            push_opcode(tokens, "multimem");
146            push_directive(tokens, "ld_reduce");
147            push_directive(tokens, "weak");
148            if let Some(ss_3) = self.ss.as_ref() {
149                match ss_3 {
150                    Ss::Global => {
151                        push_directive(tokens, "global");
152                    }
153                }
154            }
155            match &self.op {
156                Op::Min => {
157                    push_directive(tokens, "min");
158                }
159                Op::Max => {
160                    push_directive(tokens, "max");
161                }
162                Op::Add => {
163                    push_directive(tokens, "add");
164                }
165                Op::And => {
166                    push_directive(tokens, "and");
167                }
168                Op::Xor => {
169                    push_directive(tokens, "xor");
170                }
171                Op::Or => {
172                    push_directive(tokens, "or");
173                }
174            }
175            match &self.type_ {
176                Type::B32 => {
177                    push_directive(tokens, "b32");
178                }
179                Type::B64 => {
180                    push_directive(tokens, "b64");
181                }
182                Type::U32 => {
183                    push_directive(tokens, "u32");
184                }
185                Type::U64 => {
186                    push_directive(tokens, "u64");
187                }
188                Type::S32 => {
189                    push_directive(tokens, "s32");
190                }
191                Type::S64 => {
192                    push_directive(tokens, "s64");
193                }
194            }
195            if spaced {
196                tokens.push(PtxToken::Space);
197            }
198            self.d.unparse_tokens_mode(tokens, spaced);
199            tokens.push(PtxToken::Comma);
200            if spaced {
201                tokens.push(PtxToken::Space);
202            }
203            self.a.unparse_tokens_mode(tokens, spaced);
204            tokens.push(PtxToken::Semicolon);
205            if spaced {
206                tokens.push(PtxToken::Newline);
207            }
208        }
209    }
210
211    impl PtxUnparser for MultimemStStsemScopeSsType {
212        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
213            self.unparse_tokens_mode(tokens, false);
214        }
215        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
216            push_opcode(tokens, "multimem");
217            push_directive(tokens, "st");
218            if let Some(stsem_4) = self.stsem.as_ref() {
219                match stsem_4 {
220                    Stsem::Relaxed => {
221                        push_directive(tokens, "relaxed");
222                    }
223                    Stsem::Release => {
224                        push_directive(tokens, "release");
225                    }
226                }
227            }
228            if let Some(scope_5) = self.scope.as_ref() {
229                match scope_5 {
230                    Scope::Cluster => {
231                        push_directive(tokens, "cluster");
232                    }
233                    Scope::Cta => {
234                        push_directive(tokens, "cta");
235                    }
236                    Scope::Gpu => {
237                        push_directive(tokens, "gpu");
238                    }
239                    Scope::Sys => {
240                        push_directive(tokens, "sys");
241                    }
242                }
243            }
244            if let Some(ss_6) = self.ss.as_ref() {
245                match ss_6 {
246                    Ss::Global => {
247                        push_directive(tokens, "global");
248                    }
249                }
250            }
251            match &self.type_ {
252                Type::B32 => {
253                    push_directive(tokens, "b32");
254                }
255                Type::B64 => {
256                    push_directive(tokens, "b64");
257                }
258                Type::U32 => {
259                    push_directive(tokens, "u32");
260                }
261                Type::U64 => {
262                    push_directive(tokens, "u64");
263                }
264                Type::S32 => {
265                    push_directive(tokens, "s32");
266                }
267                Type::S64 => {
268                    push_directive(tokens, "s64");
269                }
270            }
271            if spaced {
272                tokens.push(PtxToken::Space);
273            }
274            self.a.unparse_tokens_mode(tokens, spaced);
275            tokens.push(PtxToken::Comma);
276            if spaced {
277                tokens.push(PtxToken::Space);
278            }
279            self.b.unparse_tokens_mode(tokens, spaced);
280            tokens.push(PtxToken::Semicolon);
281            if spaced {
282                tokens.push(PtxToken::Newline);
283            }
284        }
285    }
286
287    impl PtxUnparser for MultimemStWeakSsType {
288        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
289            self.unparse_tokens_mode(tokens, false);
290        }
291        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
292            push_opcode(tokens, "multimem");
293            push_directive(tokens, "st");
294            push_directive(tokens, "weak");
295            if let Some(ss_7) = self.ss.as_ref() {
296                match ss_7 {
297                    Ss::Global => {
298                        push_directive(tokens, "global");
299                    }
300                }
301            }
302            match &self.type_ {
303                Type::B32 => {
304                    push_directive(tokens, "b32");
305                }
306                Type::B64 => {
307                    push_directive(tokens, "b64");
308                }
309                Type::U32 => {
310                    push_directive(tokens, "u32");
311                }
312                Type::U64 => {
313                    push_directive(tokens, "u64");
314                }
315                Type::S32 => {
316                    push_directive(tokens, "s32");
317                }
318                Type::S64 => {
319                    push_directive(tokens, "s64");
320                }
321            }
322            if spaced {
323                tokens.push(PtxToken::Space);
324            }
325            self.a.unparse_tokens_mode(tokens, spaced);
326            tokens.push(PtxToken::Comma);
327            if spaced {
328                tokens.push(PtxToken::Space);
329            }
330            self.b.unparse_tokens_mode(tokens, spaced);
331            tokens.push(PtxToken::Semicolon);
332            if spaced {
333                tokens.push(PtxToken::Newline);
334            }
335        }
336    }
337
338    impl PtxUnparser for MultimemRedRedsemScopeSsOpType {
339        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
340            self.unparse_tokens_mode(tokens, false);
341        }
342        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
343            push_opcode(tokens, "multimem");
344            push_directive(tokens, "red");
345            if let Some(redsem_8) = self.redsem.as_ref() {
346                match redsem_8 {
347                    Redsem::Relaxed => {
348                        push_directive(tokens, "relaxed");
349                    }
350                    Redsem::Release => {
351                        push_directive(tokens, "release");
352                    }
353                }
354            }
355            if let Some(scope_9) = self.scope.as_ref() {
356                match scope_9 {
357                    Scope::Cluster => {
358                        push_directive(tokens, "cluster");
359                    }
360                    Scope::Cta => {
361                        push_directive(tokens, "cta");
362                    }
363                    Scope::Gpu => {
364                        push_directive(tokens, "gpu");
365                    }
366                    Scope::Sys => {
367                        push_directive(tokens, "sys");
368                    }
369                }
370            }
371            if let Some(ss_10) = self.ss.as_ref() {
372                match ss_10 {
373                    Ss::Global => {
374                        push_directive(tokens, "global");
375                    }
376                }
377            }
378            match &self.op {
379                Op::Min => {
380                    push_directive(tokens, "min");
381                }
382                Op::Max => {
383                    push_directive(tokens, "max");
384                }
385                Op::Add => {
386                    push_directive(tokens, "add");
387                }
388                Op::And => {
389                    push_directive(tokens, "and");
390                }
391                Op::Xor => {
392                    push_directive(tokens, "xor");
393                }
394                Op::Or => {
395                    push_directive(tokens, "or");
396                }
397            }
398            match &self.type_ {
399                Type::B32 => {
400                    push_directive(tokens, "b32");
401                }
402                Type::B64 => {
403                    push_directive(tokens, "b64");
404                }
405                Type::U32 => {
406                    push_directive(tokens, "u32");
407                }
408                Type::U64 => {
409                    push_directive(tokens, "u64");
410                }
411                Type::S32 => {
412                    push_directive(tokens, "s32");
413                }
414                Type::S64 => {
415                    push_directive(tokens, "s64");
416                }
417            }
418            if spaced {
419                tokens.push(PtxToken::Space);
420            }
421            self.a.unparse_tokens_mode(tokens, spaced);
422            tokens.push(PtxToken::Comma);
423            if spaced {
424                tokens.push(PtxToken::Space);
425            }
426            self.b.unparse_tokens_mode(tokens, spaced);
427            tokens.push(PtxToken::Semicolon);
428            if spaced {
429                tokens.push(PtxToken::Newline);
430            }
431        }
432    }
433}
434
435pub mod section_1 {
436    use super::*;
437    use crate::r#type::instruction::multimem_ld_reduce::section_1::*;
438
439    impl PtxUnparser for MultimemLdReduceLdsemScopeSsOpAccPrecVecType {
440        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
441            self.unparse_tokens_mode(tokens, false);
442        }
443        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
444            push_opcode(tokens, "multimem");
445            push_directive(tokens, "ld_reduce");
446            if let Some(ldsem_11) = self.ldsem.as_ref() {
447                match ldsem_11 {
448                    Ldsem::Relaxed => {
449                        push_directive(tokens, "relaxed");
450                    }
451                    Ldsem::Acquire => {
452                        push_directive(tokens, "acquire");
453                    }
454                }
455            }
456            if let Some(scope_12) = self.scope.as_ref() {
457                match scope_12 {
458                    Scope::Cluster => {
459                        push_directive(tokens, "cluster");
460                    }
461                    Scope::Cta => {
462                        push_directive(tokens, "cta");
463                    }
464                    Scope::Gpu => {
465                        push_directive(tokens, "gpu");
466                    }
467                    Scope::Sys => {
468                        push_directive(tokens, "sys");
469                    }
470                }
471            }
472            if let Some(ss_13) = self.ss.as_ref() {
473                match ss_13 {
474                    Ss::Global => {
475                        push_directive(tokens, "global");
476                    }
477                }
478            }
479            match &self.op {
480                Op::Min => {
481                    push_directive(tokens, "min");
482                }
483                Op::Max => {
484                    push_directive(tokens, "max");
485                }
486                Op::Add => {
487                    push_directive(tokens, "add");
488                }
489            }
490            if let Some(acc_prec_14) = self.acc_prec.as_ref() {
491                match acc_prec_14 {
492                    AccPrec::AccF32 => {
493                        push_directive(tokens, "acc::f32");
494                    }
495                    AccPrec::AccF16 => {
496                        push_directive(tokens, "acc::f16");
497                    }
498                }
499            }
500            if let Some(vec_15) = self.vec.as_ref() {
501                match vec_15 {
502                    Vec::V2 => {
503                        push_directive(tokens, "v2");
504                    }
505                    Vec::V4 => {
506                        push_directive(tokens, "v4");
507                    }
508                    Vec::V8 => {
509                        push_directive(tokens, "v8");
510                    }
511                }
512            }
513            match &self.type_ {
514                Type::Bf16x2 => {
515                    push_directive(tokens, "bf16x2");
516                }
517                Type::E5m2x2 => {
518                    push_directive(tokens, "e5m2x2");
519                }
520                Type::E5m2x4 => {
521                    push_directive(tokens, "e5m2x4");
522                }
523                Type::E4m3x2 => {
524                    push_directive(tokens, "e4m3x2");
525                }
526                Type::E4m3x4 => {
527                    push_directive(tokens, "e4m3x4");
528                }
529                Type::F16x2 => {
530                    push_directive(tokens, "f16x2");
531                }
532                Type::Bf16 => {
533                    push_directive(tokens, "bf16");
534                }
535                Type::E5m2 => {
536                    push_directive(tokens, "e5m2");
537                }
538                Type::E4m3 => {
539                    push_directive(tokens, "e4m3");
540                }
541                Type::F16 => {
542                    push_directive(tokens, "f16");
543                }
544                Type::F32 => {
545                    push_directive(tokens, "f32");
546                }
547                Type::F64 => {
548                    push_directive(tokens, "f64");
549                }
550            }
551            if spaced {
552                tokens.push(PtxToken::Space);
553            }
554            self.d.unparse_tokens_mode(tokens, spaced);
555            tokens.push(PtxToken::Comma);
556            if spaced {
557                tokens.push(PtxToken::Space);
558            }
559            self.a.unparse_tokens_mode(tokens, spaced);
560            tokens.push(PtxToken::Semicolon);
561            if spaced {
562                tokens.push(PtxToken::Newline);
563            }
564        }
565    }
566
567    impl PtxUnparser for MultimemLdReduceWeakSsOpAccPrecVecType {
568        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
569            self.unparse_tokens_mode(tokens, false);
570        }
571        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
572            push_opcode(tokens, "multimem");
573            push_directive(tokens, "ld_reduce");
574            push_directive(tokens, "weak");
575            if let Some(ss_16) = self.ss.as_ref() {
576                match ss_16 {
577                    Ss::Global => {
578                        push_directive(tokens, "global");
579                    }
580                }
581            }
582            match &self.op {
583                Op::Min => {
584                    push_directive(tokens, "min");
585                }
586                Op::Max => {
587                    push_directive(tokens, "max");
588                }
589                Op::Add => {
590                    push_directive(tokens, "add");
591                }
592            }
593            if let Some(acc_prec_17) = self.acc_prec.as_ref() {
594                match acc_prec_17 {
595                    AccPrec::AccF32 => {
596                        push_directive(tokens, "acc::f32");
597                    }
598                    AccPrec::AccF16 => {
599                        push_directive(tokens, "acc::f16");
600                    }
601                }
602            }
603            if let Some(vec_18) = self.vec.as_ref() {
604                match vec_18 {
605                    Vec::V2 => {
606                        push_directive(tokens, "v2");
607                    }
608                    Vec::V4 => {
609                        push_directive(tokens, "v4");
610                    }
611                    Vec::V8 => {
612                        push_directive(tokens, "v8");
613                    }
614                }
615            }
616            match &self.type_ {
617                Type::Bf16x2 => {
618                    push_directive(tokens, "bf16x2");
619                }
620                Type::E5m2x2 => {
621                    push_directive(tokens, "e5m2x2");
622                }
623                Type::E5m2x4 => {
624                    push_directive(tokens, "e5m2x4");
625                }
626                Type::E4m3x2 => {
627                    push_directive(tokens, "e4m3x2");
628                }
629                Type::E4m3x4 => {
630                    push_directive(tokens, "e4m3x4");
631                }
632                Type::F16x2 => {
633                    push_directive(tokens, "f16x2");
634                }
635                Type::Bf16 => {
636                    push_directive(tokens, "bf16");
637                }
638                Type::E5m2 => {
639                    push_directive(tokens, "e5m2");
640                }
641                Type::E4m3 => {
642                    push_directive(tokens, "e4m3");
643                }
644                Type::F16 => {
645                    push_directive(tokens, "f16");
646                }
647                Type::F32 => {
648                    push_directive(tokens, "f32");
649                }
650                Type::F64 => {
651                    push_directive(tokens, "f64");
652                }
653            }
654            if spaced {
655                tokens.push(PtxToken::Space);
656            }
657            self.d.unparse_tokens_mode(tokens, spaced);
658            tokens.push(PtxToken::Comma);
659            if spaced {
660                tokens.push(PtxToken::Space);
661            }
662            self.a.unparse_tokens_mode(tokens, spaced);
663            tokens.push(PtxToken::Semicolon);
664            if spaced {
665                tokens.push(PtxToken::Newline);
666            }
667        }
668    }
669
670    impl PtxUnparser for MultimemStStsemScopeSsVecType {
671        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
672            self.unparse_tokens_mode(tokens, false);
673        }
674        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
675            push_opcode(tokens, "multimem");
676            push_directive(tokens, "st");
677            if let Some(stsem_19) = self.stsem.as_ref() {
678                match stsem_19 {
679                    Stsem::Relaxed => {
680                        push_directive(tokens, "relaxed");
681                    }
682                    Stsem::Release => {
683                        push_directive(tokens, "release");
684                    }
685                }
686            }
687            if let Some(scope_20) = self.scope.as_ref() {
688                match scope_20 {
689                    Scope::Cluster => {
690                        push_directive(tokens, "cluster");
691                    }
692                    Scope::Cta => {
693                        push_directive(tokens, "cta");
694                    }
695                    Scope::Gpu => {
696                        push_directive(tokens, "gpu");
697                    }
698                    Scope::Sys => {
699                        push_directive(tokens, "sys");
700                    }
701                }
702            }
703            if let Some(ss_21) = self.ss.as_ref() {
704                match ss_21 {
705                    Ss::Global => {
706                        push_directive(tokens, "global");
707                    }
708                }
709            }
710            if let Some(vec_22) = self.vec.as_ref() {
711                match vec_22 {
712                    Vec::V2 => {
713                        push_directive(tokens, "v2");
714                    }
715                    Vec::V4 => {
716                        push_directive(tokens, "v4");
717                    }
718                    Vec::V8 => {
719                        push_directive(tokens, "v8");
720                    }
721                }
722            }
723            match &self.type_ {
724                Type::Bf16x2 => {
725                    push_directive(tokens, "bf16x2");
726                }
727                Type::E5m2x2 => {
728                    push_directive(tokens, "e5m2x2");
729                }
730                Type::E5m2x4 => {
731                    push_directive(tokens, "e5m2x4");
732                }
733                Type::E4m3x2 => {
734                    push_directive(tokens, "e4m3x2");
735                }
736                Type::E4m3x4 => {
737                    push_directive(tokens, "e4m3x4");
738                }
739                Type::F16x2 => {
740                    push_directive(tokens, "f16x2");
741                }
742                Type::Bf16 => {
743                    push_directive(tokens, "bf16");
744                }
745                Type::E5m2 => {
746                    push_directive(tokens, "e5m2");
747                }
748                Type::E4m3 => {
749                    push_directive(tokens, "e4m3");
750                }
751                Type::F16 => {
752                    push_directive(tokens, "f16");
753                }
754                Type::F32 => {
755                    push_directive(tokens, "f32");
756                }
757                Type::F64 => {
758                    push_directive(tokens, "f64");
759                }
760            }
761            if spaced {
762                tokens.push(PtxToken::Space);
763            }
764            self.a.unparse_tokens_mode(tokens, spaced);
765            tokens.push(PtxToken::Comma);
766            if spaced {
767                tokens.push(PtxToken::Space);
768            }
769            self.b.unparse_tokens_mode(tokens, spaced);
770            tokens.push(PtxToken::Semicolon);
771            if spaced {
772                tokens.push(PtxToken::Newline);
773            }
774        }
775    }
776
777    impl PtxUnparser for MultimemStWeakSsVecType {
778        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
779            self.unparse_tokens_mode(tokens, false);
780        }
781        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
782            push_opcode(tokens, "multimem");
783            push_directive(tokens, "st");
784            push_directive(tokens, "weak");
785            if let Some(ss_23) = self.ss.as_ref() {
786                match ss_23 {
787                    Ss::Global => {
788                        push_directive(tokens, "global");
789                    }
790                }
791            }
792            if let Some(vec_24) = self.vec.as_ref() {
793                match vec_24 {
794                    Vec::V2 => {
795                        push_directive(tokens, "v2");
796                    }
797                    Vec::V4 => {
798                        push_directive(tokens, "v4");
799                    }
800                    Vec::V8 => {
801                        push_directive(tokens, "v8");
802                    }
803                }
804            }
805            match &self.type_ {
806                Type::Bf16x2 => {
807                    push_directive(tokens, "bf16x2");
808                }
809                Type::E5m2x2 => {
810                    push_directive(tokens, "e5m2x2");
811                }
812                Type::E5m2x4 => {
813                    push_directive(tokens, "e5m2x4");
814                }
815                Type::E4m3x2 => {
816                    push_directive(tokens, "e4m3x2");
817                }
818                Type::E4m3x4 => {
819                    push_directive(tokens, "e4m3x4");
820                }
821                Type::F16x2 => {
822                    push_directive(tokens, "f16x2");
823                }
824                Type::Bf16 => {
825                    push_directive(tokens, "bf16");
826                }
827                Type::E5m2 => {
828                    push_directive(tokens, "e5m2");
829                }
830                Type::E4m3 => {
831                    push_directive(tokens, "e4m3");
832                }
833                Type::F16 => {
834                    push_directive(tokens, "f16");
835                }
836                Type::F32 => {
837                    push_directive(tokens, "f32");
838                }
839                Type::F64 => {
840                    push_directive(tokens, "f64");
841                }
842            }
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            tokens.push(PtxToken::Semicolon);
853            if spaced {
854                tokens.push(PtxToken::Newline);
855            }
856        }
857    }
858
859    impl PtxUnparser for MultimemRedRedsemScopeSsRedopVecRedtype {
860        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
861            self.unparse_tokens_mode(tokens, false);
862        }
863        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
864            push_opcode(tokens, "multimem");
865            push_directive(tokens, "red");
866            if let Some(redsem_25) = self.redsem.as_ref() {
867                match redsem_25 {
868                    Redsem::Relaxed => {
869                        push_directive(tokens, "relaxed");
870                    }
871                    Redsem::Release => {
872                        push_directive(tokens, "release");
873                    }
874                }
875            }
876            if let Some(scope_26) = self.scope.as_ref() {
877                match scope_26 {
878                    Scope::Cluster => {
879                        push_directive(tokens, "cluster");
880                    }
881                    Scope::Cta => {
882                        push_directive(tokens, "cta");
883                    }
884                    Scope::Gpu => {
885                        push_directive(tokens, "gpu");
886                    }
887                    Scope::Sys => {
888                        push_directive(tokens, "sys");
889                    }
890                }
891            }
892            if let Some(ss_27) = self.ss.as_ref() {
893                match ss_27 {
894                    Ss::Global => {
895                        push_directive(tokens, "global");
896                    }
897                }
898            }
899            match &self.redop {
900                Redop::Add => {
901                    push_directive(tokens, "add");
902                }
903            }
904            if let Some(vec_28) = self.vec.as_ref() {
905                match vec_28 {
906                    Vec::V2 => {
907                        push_directive(tokens, "v2");
908                    }
909                    Vec::V4 => {
910                        push_directive(tokens, "v4");
911                    }
912                    Vec::V8 => {
913                        push_directive(tokens, "v8");
914                    }
915                }
916            }
917            match &self.redtype {
918                Redtype::Bf16x2 => {
919                    push_directive(tokens, "bf16x2");
920                }
921                Redtype::F16x2 => {
922                    push_directive(tokens, "f16x2");
923                }
924                Redtype::Bf16 => {
925                    push_directive(tokens, "bf16");
926                }
927                Redtype::F16 => {
928                    push_directive(tokens, "f16");
929                }
930                Redtype::F32 => {
931                    push_directive(tokens, "f32");
932                }
933                Redtype::F64 => {
934                    push_directive(tokens, "f64");
935                }
936            }
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            tokens.push(PtxToken::Semicolon);
947            if spaced {
948                tokens.push(PtxToken::Newline);
949            }
950        }
951    }
952}