Skip to main content

ptx_parser/unparser/instruction/
cvt.rs

1//! Original PTX specification:
2//!
3//! cvt{.irnd}{.ftz}{.sat}.dtype.atype         d, a;  // integer rounding
4//! cvt{.frnd}{.ftz}{.sat}.dtype.atype         d, a;  // fp rounding
5//! cvt.frnd2{.relu}{.satfinite}.f16.f32       d, a;
6//! cvt.frnd2{.relu}{.satfinite}.f16x2.f32     d, a, b;
7//! cvt.rs{.relu}{.satfinite}.f16x2.f32        d, a, b, rbits;
8//! cvt.frnd2{.relu}{.satfinite}.bf16.f32      d, a;
9//! cvt.frnd2{.relu}{.satfinite}.bf16x2.f32    d, a, b;
10//! cvt.rs{.relu}{.satfinite}.bf16x2.f32       d, a, b, rbits;
11//! cvt.rna{.satfinite}.tf32.f32               d, a;
12//! cvt.frnd2{.satfinite}{.relu}.tf32.f32      d, a;
13//! cvt.rn.satfinite{.relu}.f8x2type.f32       d, a, b;
14//! cvt.rn.satfinite{.relu}.f8x2type.f16x2     d, a;
15//! cvt.rn{.relu}.f16x2.f8x2type              d, a;
16//! cvt.rs{.relu}.satfinite.f8x4type.f32       d, {a, b, e, f}, rbits;
17//! cvt.rn.satfinite{.relu}.f4x2type.f32       d, a, b;
18//! cvt.rn{.relu}.f16x2.f4x2type               d, a;
19//! cvt.rs{.relu}.satfinite.f4x4type.f32       d, {a, b, e, f}, rbits;
20//! cvt.rn.satfinite{.relu}.f6x2type.f32       d, a, b;
21//! cvt.rn{.relu}.f16x2.f6x2type               d, a;
22//! cvt.rs{.relu}.satfinite.f6x4type.f32       d, {a, b, e, f}, rbits;
23//! cvt.frnd3{.satfinite}.ue8m0x2.f32          d, a, b;
24//! cvt.frnd3{.satfinite}.ue8m0x2.bf16x2       d, a;
25//! cvt.rn.bf16x2.ue8m0x2                      d, a;
26//! .irnd   = { .rni, .rzi, .rmi, .rpi };
27//! .frnd   = { .rn,  .rz,  .rm,  .rp  };
28//! .frnd2  = { .rn,  .rz };
29//! .frnd3  = { .rz,  .rp };
30//! .dtype = .atype = { .u8,   .u16, .u32, .u64,
31//! .s8,   .s16, .s32, .s64,
32//! .bf16, .f16, .f32, .f64 };
33//! .f8x2type = { .e4m3x2, .e5m2x2 };
34//! .f4x2type = { .e2m1x2 };
35//! .f6x2type = { .e2m3x2, .e3m2x2 };
36//! .f4x4type = { .e2m1x4 };
37//! .f8x4type = { .e4m3x4, .e5m2x4 };
38//! .f6x4type = { .e2m3x4, .e3m2x4 };
39
40#![allow(unused)]
41
42use crate::lexer::PtxToken;
43use crate::unparser::{PtxUnparser, common::*};
44
45pub mod section_0 {
46    use super::*;
47    use crate::r#type::instruction::cvt::section_0::*;
48
49    impl PtxUnparser for CvtIrndFtzSatDtypeAtype {
50        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
51            self.unparse_tokens_mode(tokens, false);
52        }
53        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
54            push_opcode(tokens, "cvt");
55            if let Some(irnd_0) = self.irnd.as_ref() {
56                match irnd_0 {
57                    Irnd::Rni => {
58                        push_directive(tokens, "rni");
59                    }
60                    Irnd::Rzi => {
61                        push_directive(tokens, "rzi");
62                    }
63                    Irnd::Rmi => {
64                        push_directive(tokens, "rmi");
65                    }
66                    Irnd::Rpi => {
67                        push_directive(tokens, "rpi");
68                    }
69                }
70            }
71            if self.ftz {
72                push_directive(tokens, "ftz");
73            }
74            if self.sat {
75                push_directive(tokens, "sat");
76            }
77            match &self.dtype {
78                Dtype::Bf16 => {
79                    push_directive(tokens, "bf16");
80                }
81                Dtype::U16 => {
82                    push_directive(tokens, "u16");
83                }
84                Dtype::U32 => {
85                    push_directive(tokens, "u32");
86                }
87                Dtype::U64 => {
88                    push_directive(tokens, "u64");
89                }
90                Dtype::S16 => {
91                    push_directive(tokens, "s16");
92                }
93                Dtype::S32 => {
94                    push_directive(tokens, "s32");
95                }
96                Dtype::S64 => {
97                    push_directive(tokens, "s64");
98                }
99                Dtype::F16 => {
100                    push_directive(tokens, "f16");
101                }
102                Dtype::F32 => {
103                    push_directive(tokens, "f32");
104                }
105                Dtype::F64 => {
106                    push_directive(tokens, "f64");
107                }
108                Dtype::U8 => {
109                    push_directive(tokens, "u8");
110                }
111                Dtype::S8 => {
112                    push_directive(tokens, "s8");
113                }
114            }
115            match &self.atype {
116                Atype::Bf16 => {
117                    push_directive(tokens, "bf16");
118                }
119                Atype::U16 => {
120                    push_directive(tokens, "u16");
121                }
122                Atype::U32 => {
123                    push_directive(tokens, "u32");
124                }
125                Atype::U64 => {
126                    push_directive(tokens, "u64");
127                }
128                Atype::S16 => {
129                    push_directive(tokens, "s16");
130                }
131                Atype::S32 => {
132                    push_directive(tokens, "s32");
133                }
134                Atype::S64 => {
135                    push_directive(tokens, "s64");
136                }
137                Atype::F16 => {
138                    push_directive(tokens, "f16");
139                }
140                Atype::F32 => {
141                    push_directive(tokens, "f32");
142                }
143                Atype::F64 => {
144                    push_directive(tokens, "f64");
145                }
146                Atype::U8 => {
147                    push_directive(tokens, "u8");
148                }
149                Atype::S8 => {
150                    push_directive(tokens, "s8");
151                }
152            }
153            if spaced {
154                tokens.push(PtxToken::Space);
155            }
156            self.d.unparse_tokens_mode(tokens, spaced);
157            tokens.push(PtxToken::Comma);
158            if spaced {
159                tokens.push(PtxToken::Space);
160            }
161            self.a.unparse_tokens_mode(tokens, spaced);
162            tokens.push(PtxToken::Semicolon);
163            if spaced {
164                tokens.push(PtxToken::Newline);
165            }
166        }
167    }
168
169    impl PtxUnparser for CvtFrndFtzSatDtypeAtype {
170        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
171            self.unparse_tokens_mode(tokens, false);
172        }
173        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
174            push_opcode(tokens, "cvt");
175            if let Some(frnd_1) = self.frnd.as_ref() {
176                match frnd_1 {
177                    Frnd::Rn => {
178                        push_directive(tokens, "rn");
179                    }
180                    Frnd::Rz => {
181                        push_directive(tokens, "rz");
182                    }
183                    Frnd::Rm => {
184                        push_directive(tokens, "rm");
185                    }
186                    Frnd::Rp => {
187                        push_directive(tokens, "rp");
188                    }
189                }
190            }
191            if self.ftz {
192                push_directive(tokens, "ftz");
193            }
194            if self.sat {
195                push_directive(tokens, "sat");
196            }
197            match &self.dtype {
198                Dtype::Bf16 => {
199                    push_directive(tokens, "bf16");
200                }
201                Dtype::U16 => {
202                    push_directive(tokens, "u16");
203                }
204                Dtype::U32 => {
205                    push_directive(tokens, "u32");
206                }
207                Dtype::U64 => {
208                    push_directive(tokens, "u64");
209                }
210                Dtype::S16 => {
211                    push_directive(tokens, "s16");
212                }
213                Dtype::S32 => {
214                    push_directive(tokens, "s32");
215                }
216                Dtype::S64 => {
217                    push_directive(tokens, "s64");
218                }
219                Dtype::F16 => {
220                    push_directive(tokens, "f16");
221                }
222                Dtype::F32 => {
223                    push_directive(tokens, "f32");
224                }
225                Dtype::F64 => {
226                    push_directive(tokens, "f64");
227                }
228                Dtype::U8 => {
229                    push_directive(tokens, "u8");
230                }
231                Dtype::S8 => {
232                    push_directive(tokens, "s8");
233                }
234            }
235            match &self.atype {
236                Atype::Bf16 => {
237                    push_directive(tokens, "bf16");
238                }
239                Atype::U16 => {
240                    push_directive(tokens, "u16");
241                }
242                Atype::U32 => {
243                    push_directive(tokens, "u32");
244                }
245                Atype::U64 => {
246                    push_directive(tokens, "u64");
247                }
248                Atype::S16 => {
249                    push_directive(tokens, "s16");
250                }
251                Atype::S32 => {
252                    push_directive(tokens, "s32");
253                }
254                Atype::S64 => {
255                    push_directive(tokens, "s64");
256                }
257                Atype::F16 => {
258                    push_directive(tokens, "f16");
259                }
260                Atype::F32 => {
261                    push_directive(tokens, "f32");
262                }
263                Atype::F64 => {
264                    push_directive(tokens, "f64");
265                }
266                Atype::U8 => {
267                    push_directive(tokens, "u8");
268                }
269                Atype::S8 => {
270                    push_directive(tokens, "s8");
271                }
272            }
273            if spaced {
274                tokens.push(PtxToken::Space);
275            }
276            self.d.unparse_tokens_mode(tokens, spaced);
277            tokens.push(PtxToken::Comma);
278            if spaced {
279                tokens.push(PtxToken::Space);
280            }
281            self.a.unparse_tokens_mode(tokens, spaced);
282            tokens.push(PtxToken::Semicolon);
283            if spaced {
284                tokens.push(PtxToken::Newline);
285            }
286        }
287    }
288
289    impl PtxUnparser for CvtFrnd2ReluSatfiniteF16F32 {
290        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
291            self.unparse_tokens_mode(tokens, false);
292        }
293        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
294            push_opcode(tokens, "cvt");
295            match &self.frnd2 {
296                Frnd2::Rn => {
297                    push_directive(tokens, "rn");
298                }
299                Frnd2::Rz => {
300                    push_directive(tokens, "rz");
301                }
302            }
303            if self.relu {
304                push_directive(tokens, "relu");
305            }
306            if self.satfinite {
307                push_directive(tokens, "satfinite");
308            }
309            push_directive(tokens, "f16");
310            push_directive(tokens, "f32");
311            if spaced {
312                tokens.push(PtxToken::Space);
313            }
314            self.d.unparse_tokens_mode(tokens, spaced);
315            tokens.push(PtxToken::Comma);
316            if spaced {
317                tokens.push(PtxToken::Space);
318            }
319            self.a.unparse_tokens_mode(tokens, spaced);
320            tokens.push(PtxToken::Semicolon);
321            if spaced {
322                tokens.push(PtxToken::Newline);
323            }
324        }
325    }
326
327    impl PtxUnparser for CvtFrnd2ReluSatfiniteF16x2F32 {
328        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
329            self.unparse_tokens_mode(tokens, false);
330        }
331        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
332            push_opcode(tokens, "cvt");
333            match &self.frnd2 {
334                Frnd2::Rn => {
335                    push_directive(tokens, "rn");
336                }
337                Frnd2::Rz => {
338                    push_directive(tokens, "rz");
339                }
340            }
341            if self.relu {
342                push_directive(tokens, "relu");
343            }
344            if self.satfinite {
345                push_directive(tokens, "satfinite");
346            }
347            push_directive(tokens, "f16x2");
348            push_directive(tokens, "f32");
349            if spaced {
350                tokens.push(PtxToken::Space);
351            }
352            self.d.unparse_tokens_mode(tokens, spaced);
353            tokens.push(PtxToken::Comma);
354            if spaced {
355                tokens.push(PtxToken::Space);
356            }
357            self.a.unparse_tokens_mode(tokens, spaced);
358            tokens.push(PtxToken::Comma);
359            if spaced {
360                tokens.push(PtxToken::Space);
361            }
362            self.b.unparse_tokens_mode(tokens, spaced);
363            tokens.push(PtxToken::Semicolon);
364            if spaced {
365                tokens.push(PtxToken::Newline);
366            }
367        }
368    }
369
370    impl PtxUnparser for CvtRsReluSatfiniteF16x2F32 {
371        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
372            self.unparse_tokens_mode(tokens, false);
373        }
374        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
375            push_opcode(tokens, "cvt");
376            push_directive(tokens, "rs");
377            if self.relu {
378                push_directive(tokens, "relu");
379            }
380            if self.satfinite {
381                push_directive(tokens, "satfinite");
382            }
383            push_directive(tokens, "f16x2");
384            push_directive(tokens, "f32");
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.rbits.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 CvtFrnd2ReluSatfiniteBf16F32 {
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, "cvt");
417            match &self.frnd2 {
418                Frnd2::Rn => {
419                    push_directive(tokens, "rn");
420                }
421                Frnd2::Rz => {
422                    push_directive(tokens, "rz");
423                }
424            }
425            if self.relu {
426                push_directive(tokens, "relu");
427            }
428            if self.satfinite {
429                push_directive(tokens, "satfinite");
430            }
431            push_directive(tokens, "bf16");
432            push_directive(tokens, "f32");
433            if spaced {
434                tokens.push(PtxToken::Space);
435            }
436            self.d.unparse_tokens_mode(tokens, spaced);
437            tokens.push(PtxToken::Comma);
438            if spaced {
439                tokens.push(PtxToken::Space);
440            }
441            self.a.unparse_tokens_mode(tokens, spaced);
442            tokens.push(PtxToken::Semicolon);
443            if spaced {
444                tokens.push(PtxToken::Newline);
445            }
446        }
447    }
448
449    impl PtxUnparser for CvtFrnd2ReluSatfiniteBf16x2F32 {
450        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
451            self.unparse_tokens_mode(tokens, false);
452        }
453        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
454            push_opcode(tokens, "cvt");
455            match &self.frnd2 {
456                Frnd2::Rn => {
457                    push_directive(tokens, "rn");
458                }
459                Frnd2::Rz => {
460                    push_directive(tokens, "rz");
461                }
462            }
463            if self.relu {
464                push_directive(tokens, "relu");
465            }
466            if self.satfinite {
467                push_directive(tokens, "satfinite");
468            }
469            push_directive(tokens, "bf16x2");
470            push_directive(tokens, "f32");
471            if spaced {
472                tokens.push(PtxToken::Space);
473            }
474            self.d.unparse_tokens_mode(tokens, spaced);
475            tokens.push(PtxToken::Comma);
476            if spaced {
477                tokens.push(PtxToken::Space);
478            }
479            self.a.unparse_tokens_mode(tokens, spaced);
480            tokens.push(PtxToken::Comma);
481            if spaced {
482                tokens.push(PtxToken::Space);
483            }
484            self.b.unparse_tokens_mode(tokens, spaced);
485            tokens.push(PtxToken::Semicolon);
486            if spaced {
487                tokens.push(PtxToken::Newline);
488            }
489        }
490    }
491
492    impl PtxUnparser for CvtRsReluSatfiniteBf16x2F32 {
493        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
494            self.unparse_tokens_mode(tokens, false);
495        }
496        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
497            push_opcode(tokens, "cvt");
498            push_directive(tokens, "rs");
499            if self.relu {
500                push_directive(tokens, "relu");
501            }
502            if self.satfinite {
503                push_directive(tokens, "satfinite");
504            }
505            push_directive(tokens, "bf16x2");
506            push_directive(tokens, "f32");
507            if spaced {
508                tokens.push(PtxToken::Space);
509            }
510            self.d.unparse_tokens_mode(tokens, spaced);
511            tokens.push(PtxToken::Comma);
512            if spaced {
513                tokens.push(PtxToken::Space);
514            }
515            self.a.unparse_tokens_mode(tokens, spaced);
516            tokens.push(PtxToken::Comma);
517            if spaced {
518                tokens.push(PtxToken::Space);
519            }
520            self.b.unparse_tokens_mode(tokens, spaced);
521            tokens.push(PtxToken::Comma);
522            if spaced {
523                tokens.push(PtxToken::Space);
524            }
525            self.rbits.unparse_tokens_mode(tokens, spaced);
526            tokens.push(PtxToken::Semicolon);
527            if spaced {
528                tokens.push(PtxToken::Newline);
529            }
530        }
531    }
532
533    impl PtxUnparser for CvtRnaSatfiniteTf32F32 {
534        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
535            self.unparse_tokens_mode(tokens, false);
536        }
537        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
538            push_opcode(tokens, "cvt");
539            push_directive(tokens, "rna");
540            if self.satfinite {
541                push_directive(tokens, "satfinite");
542            }
543            push_directive(tokens, "tf32");
544            push_directive(tokens, "f32");
545            if spaced {
546                tokens.push(PtxToken::Space);
547            }
548            self.d.unparse_tokens_mode(tokens, spaced);
549            tokens.push(PtxToken::Comma);
550            if spaced {
551                tokens.push(PtxToken::Space);
552            }
553            self.a.unparse_tokens_mode(tokens, spaced);
554            tokens.push(PtxToken::Semicolon);
555            if spaced {
556                tokens.push(PtxToken::Newline);
557            }
558        }
559    }
560
561    impl PtxUnparser for CvtFrnd2SatfiniteReluTf32F32 {
562        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
563            self.unparse_tokens_mode(tokens, false);
564        }
565        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
566            push_opcode(tokens, "cvt");
567            match &self.frnd2 {
568                Frnd2::Rn => {
569                    push_directive(tokens, "rn");
570                }
571                Frnd2::Rz => {
572                    push_directive(tokens, "rz");
573                }
574            }
575            if self.satfinite {
576                push_directive(tokens, "satfinite");
577            }
578            if self.relu {
579                push_directive(tokens, "relu");
580            }
581            push_directive(tokens, "tf32");
582            push_directive(tokens, "f32");
583            if spaced {
584                tokens.push(PtxToken::Space);
585            }
586            self.d.unparse_tokens_mode(tokens, spaced);
587            tokens.push(PtxToken::Comma);
588            if spaced {
589                tokens.push(PtxToken::Space);
590            }
591            self.a.unparse_tokens_mode(tokens, spaced);
592            tokens.push(PtxToken::Semicolon);
593            if spaced {
594                tokens.push(PtxToken::Newline);
595            }
596        }
597    }
598
599    impl PtxUnparser for CvtRnSatfiniteReluF8x2typeF32 {
600        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
601            self.unparse_tokens_mode(tokens, false);
602        }
603        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
604            push_opcode(tokens, "cvt");
605            push_directive(tokens, "rn");
606            push_directive(tokens, "satfinite");
607            if self.relu {
608                push_directive(tokens, "relu");
609            }
610            match &self.f8x2type {
611                F8x2type::E4m3x2 => {
612                    push_directive(tokens, "e4m3x2");
613                }
614                F8x2type::E5m2x2 => {
615                    push_directive(tokens, "e5m2x2");
616                }
617            }
618            push_directive(tokens, "f32");
619            if spaced {
620                tokens.push(PtxToken::Space);
621            }
622            self.d.unparse_tokens_mode(tokens, spaced);
623            tokens.push(PtxToken::Comma);
624            if spaced {
625                tokens.push(PtxToken::Space);
626            }
627            self.a.unparse_tokens_mode(tokens, spaced);
628            tokens.push(PtxToken::Comma);
629            if spaced {
630                tokens.push(PtxToken::Space);
631            }
632            self.b.unparse_tokens_mode(tokens, spaced);
633            tokens.push(PtxToken::Semicolon);
634            if spaced {
635                tokens.push(PtxToken::Newline);
636            }
637        }
638    }
639
640    impl PtxUnparser for CvtRnSatfiniteReluF8x2typeF16x2 {
641        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
642            self.unparse_tokens_mode(tokens, false);
643        }
644        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
645            push_opcode(tokens, "cvt");
646            push_directive(tokens, "rn");
647            push_directive(tokens, "satfinite");
648            if self.relu {
649                push_directive(tokens, "relu");
650            }
651            match &self.f8x2type {
652                F8x2type::E4m3x2 => {
653                    push_directive(tokens, "e4m3x2");
654                }
655                F8x2type::E5m2x2 => {
656                    push_directive(tokens, "e5m2x2");
657                }
658            }
659            push_directive(tokens, "f16x2");
660            if spaced {
661                tokens.push(PtxToken::Space);
662            }
663            self.d.unparse_tokens_mode(tokens, spaced);
664            tokens.push(PtxToken::Comma);
665            if spaced {
666                tokens.push(PtxToken::Space);
667            }
668            self.a.unparse_tokens_mode(tokens, spaced);
669            tokens.push(PtxToken::Semicolon);
670            if spaced {
671                tokens.push(PtxToken::Newline);
672            }
673        }
674    }
675
676    impl PtxUnparser for CvtRnReluF16x2F8x2type {
677        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
678            self.unparse_tokens_mode(tokens, false);
679        }
680        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
681            push_opcode(tokens, "cvt");
682            push_directive(tokens, "rn");
683            if self.relu {
684                push_directive(tokens, "relu");
685            }
686            push_directive(tokens, "f16x2");
687            match &self.f8x2type {
688                F8x2type::E4m3x2 => {
689                    push_directive(tokens, "e4m3x2");
690                }
691                F8x2type::E5m2x2 => {
692                    push_directive(tokens, "e5m2x2");
693                }
694            }
695            if spaced {
696                tokens.push(PtxToken::Space);
697            }
698            self.d.unparse_tokens_mode(tokens, spaced);
699            tokens.push(PtxToken::Comma);
700            if spaced {
701                tokens.push(PtxToken::Space);
702            }
703            self.a.unparse_tokens_mode(tokens, spaced);
704            tokens.push(PtxToken::Semicolon);
705            if spaced {
706                tokens.push(PtxToken::Newline);
707            }
708        }
709    }
710
711    impl PtxUnparser for CvtRsReluSatfiniteF8x4typeF32 {
712        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
713            self.unparse_tokens_mode(tokens, false);
714        }
715        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
716            push_opcode(tokens, "cvt");
717            push_directive(tokens, "rs");
718            if self.relu {
719                push_directive(tokens, "relu");
720            }
721            push_directive(tokens, "satfinite");
722            match &self.f8x4type {
723                F8x4type::E4m3x4 => {
724                    push_directive(tokens, "e4m3x4");
725                }
726                F8x4type::E5m2x4 => {
727                    push_directive(tokens, "e5m2x4");
728                }
729            }
730            push_directive(tokens, "f32");
731            if spaced {
732                tokens.push(PtxToken::Space);
733            }
734            self.d.unparse_tokens_mode(tokens, spaced);
735            tokens.push(PtxToken::Comma);
736            if spaced {
737                tokens.push(PtxToken::Space);
738            }
739            self.a.unparse_tokens_mode(tokens, spaced);
740            tokens.push(PtxToken::Comma);
741            if spaced {
742                tokens.push(PtxToken::Space);
743            }
744            self.rbits.unparse_tokens_mode(tokens, spaced);
745            tokens.push(PtxToken::Semicolon);
746            if spaced {
747                tokens.push(PtxToken::Newline);
748            }
749        }
750    }
751
752    impl PtxUnparser for CvtRnSatfiniteReluF4x2typeF32 {
753        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
754            self.unparse_tokens_mode(tokens, false);
755        }
756        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
757            push_opcode(tokens, "cvt");
758            push_directive(tokens, "rn");
759            push_directive(tokens, "satfinite");
760            if self.relu {
761                push_directive(tokens, "relu");
762            }
763            match &self.f4x2type {
764                F4x2type::E2m1x2 => {
765                    push_directive(tokens, "e2m1x2");
766                }
767            }
768            push_directive(tokens, "f32");
769            if spaced {
770                tokens.push(PtxToken::Space);
771            }
772            self.d.unparse_tokens_mode(tokens, spaced);
773            tokens.push(PtxToken::Comma);
774            if spaced {
775                tokens.push(PtxToken::Space);
776            }
777            self.a.unparse_tokens_mode(tokens, spaced);
778            tokens.push(PtxToken::Comma);
779            if spaced {
780                tokens.push(PtxToken::Space);
781            }
782            self.b.unparse_tokens_mode(tokens, spaced);
783            tokens.push(PtxToken::Semicolon);
784            if spaced {
785                tokens.push(PtxToken::Newline);
786            }
787        }
788    }
789
790    impl PtxUnparser for CvtRnReluF16x2F4x2type {
791        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
792            self.unparse_tokens_mode(tokens, false);
793        }
794        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
795            push_opcode(tokens, "cvt");
796            push_directive(tokens, "rn");
797            if self.relu {
798                push_directive(tokens, "relu");
799            }
800            push_directive(tokens, "f16x2");
801            match &self.f4x2type {
802                F4x2type::E2m1x2 => {
803                    push_directive(tokens, "e2m1x2");
804                }
805            }
806            if spaced {
807                tokens.push(PtxToken::Space);
808            }
809            self.d.unparse_tokens_mode(tokens, spaced);
810            tokens.push(PtxToken::Comma);
811            if spaced {
812                tokens.push(PtxToken::Space);
813            }
814            self.a.unparse_tokens_mode(tokens, spaced);
815            tokens.push(PtxToken::Semicolon);
816            if spaced {
817                tokens.push(PtxToken::Newline);
818            }
819        }
820    }
821
822    impl PtxUnparser for CvtRsReluSatfiniteF4x4typeF32 {
823        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
824            self.unparse_tokens_mode(tokens, false);
825        }
826        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
827            push_opcode(tokens, "cvt");
828            push_directive(tokens, "rs");
829            if self.relu {
830                push_directive(tokens, "relu");
831            }
832            push_directive(tokens, "satfinite");
833            match &self.f4x4type {
834                F4x4type::E2m1x4 => {
835                    push_directive(tokens, "e2m1x4");
836                }
837            }
838            push_directive(tokens, "f32");
839            if spaced {
840                tokens.push(PtxToken::Space);
841            }
842            self.d.unparse_tokens_mode(tokens, spaced);
843            tokens.push(PtxToken::Comma);
844            if spaced {
845                tokens.push(PtxToken::Space);
846            }
847            self.a.unparse_tokens_mode(tokens, spaced);
848            tokens.push(PtxToken::Comma);
849            if spaced {
850                tokens.push(PtxToken::Space);
851            }
852            self.rbits.unparse_tokens_mode(tokens, spaced);
853            tokens.push(PtxToken::Semicolon);
854            if spaced {
855                tokens.push(PtxToken::Newline);
856            }
857        }
858    }
859
860    impl PtxUnparser for CvtRnSatfiniteReluF6x2typeF32 {
861        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
862            self.unparse_tokens_mode(tokens, false);
863        }
864        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
865            push_opcode(tokens, "cvt");
866            push_directive(tokens, "rn");
867            push_directive(tokens, "satfinite");
868            if self.relu {
869                push_directive(tokens, "relu");
870            }
871            match &self.f6x2type {
872                F6x2type::E2m3x2 => {
873                    push_directive(tokens, "e2m3x2");
874                }
875                F6x2type::E3m2x2 => {
876                    push_directive(tokens, "e3m2x2");
877                }
878            }
879            push_directive(tokens, "f32");
880            if spaced {
881                tokens.push(PtxToken::Space);
882            }
883            self.d.unparse_tokens_mode(tokens, spaced);
884            tokens.push(PtxToken::Comma);
885            if spaced {
886                tokens.push(PtxToken::Space);
887            }
888            self.a.unparse_tokens_mode(tokens, spaced);
889            tokens.push(PtxToken::Comma);
890            if spaced {
891                tokens.push(PtxToken::Space);
892            }
893            self.b.unparse_tokens_mode(tokens, spaced);
894            tokens.push(PtxToken::Semicolon);
895            if spaced {
896                tokens.push(PtxToken::Newline);
897            }
898        }
899    }
900
901    impl PtxUnparser for CvtRnReluF16x2F6x2type {
902        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
903            self.unparse_tokens_mode(tokens, false);
904        }
905        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
906            push_opcode(tokens, "cvt");
907            push_directive(tokens, "rn");
908            if self.relu {
909                push_directive(tokens, "relu");
910            }
911            push_directive(tokens, "f16x2");
912            match &self.f6x2type {
913                F6x2type::E2m3x2 => {
914                    push_directive(tokens, "e2m3x2");
915                }
916                F6x2type::E3m2x2 => {
917                    push_directive(tokens, "e3m2x2");
918                }
919            }
920            if spaced {
921                tokens.push(PtxToken::Space);
922            }
923            self.d.unparse_tokens_mode(tokens, spaced);
924            tokens.push(PtxToken::Comma);
925            if spaced {
926                tokens.push(PtxToken::Space);
927            }
928            self.a.unparse_tokens_mode(tokens, spaced);
929            tokens.push(PtxToken::Semicolon);
930            if spaced {
931                tokens.push(PtxToken::Newline);
932            }
933        }
934    }
935
936    impl PtxUnparser for CvtRsReluSatfiniteF6x4typeF32 {
937        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
938            self.unparse_tokens_mode(tokens, false);
939        }
940        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
941            push_opcode(tokens, "cvt");
942            push_directive(tokens, "rs");
943            if self.relu {
944                push_directive(tokens, "relu");
945            }
946            push_directive(tokens, "satfinite");
947            match &self.f6x4type {
948                F6x4type::E2m3x4 => {
949                    push_directive(tokens, "e2m3x4");
950                }
951                F6x4type::E3m2x4 => {
952                    push_directive(tokens, "e3m2x4");
953                }
954            }
955            push_directive(tokens, "f32");
956            if spaced {
957                tokens.push(PtxToken::Space);
958            }
959            self.d.unparse_tokens_mode(tokens, spaced);
960            tokens.push(PtxToken::Comma);
961            if spaced {
962                tokens.push(PtxToken::Space);
963            }
964            self.a.unparse_tokens_mode(tokens, spaced);
965            tokens.push(PtxToken::Comma);
966            if spaced {
967                tokens.push(PtxToken::Space);
968            }
969            self.rbits.unparse_tokens_mode(tokens, spaced);
970            tokens.push(PtxToken::Semicolon);
971            if spaced {
972                tokens.push(PtxToken::Newline);
973            }
974        }
975    }
976
977    impl PtxUnparser for CvtFrnd3SatfiniteUe8m0x2F32 {
978        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
979            self.unparse_tokens_mode(tokens, false);
980        }
981        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
982            push_opcode(tokens, "cvt");
983            match &self.frnd3 {
984                Frnd3::Rz => {
985                    push_directive(tokens, "rz");
986                }
987                Frnd3::Rp => {
988                    push_directive(tokens, "rp");
989                }
990            }
991            if self.satfinite {
992                push_directive(tokens, "satfinite");
993            }
994            push_directive(tokens, "ue8m0x2");
995            push_directive(tokens, "f32");
996            if spaced {
997                tokens.push(PtxToken::Space);
998            }
999            self.d.unparse_tokens_mode(tokens, spaced);
1000            tokens.push(PtxToken::Comma);
1001            if spaced {
1002                tokens.push(PtxToken::Space);
1003            }
1004            self.a.unparse_tokens_mode(tokens, spaced);
1005            tokens.push(PtxToken::Comma);
1006            if spaced {
1007                tokens.push(PtxToken::Space);
1008            }
1009            self.b.unparse_tokens_mode(tokens, spaced);
1010            tokens.push(PtxToken::Semicolon);
1011            if spaced {
1012                tokens.push(PtxToken::Newline);
1013            }
1014        }
1015    }
1016
1017    impl PtxUnparser for CvtFrnd3SatfiniteUe8m0x2Bf16x2 {
1018        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
1019            self.unparse_tokens_mode(tokens, false);
1020        }
1021        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
1022            push_opcode(tokens, "cvt");
1023            match &self.frnd3 {
1024                Frnd3::Rz => {
1025                    push_directive(tokens, "rz");
1026                }
1027                Frnd3::Rp => {
1028                    push_directive(tokens, "rp");
1029                }
1030            }
1031            if self.satfinite {
1032                push_directive(tokens, "satfinite");
1033            }
1034            push_directive(tokens, "ue8m0x2");
1035            push_directive(tokens, "bf16x2");
1036            if spaced {
1037                tokens.push(PtxToken::Space);
1038            }
1039            self.d.unparse_tokens_mode(tokens, spaced);
1040            tokens.push(PtxToken::Comma);
1041            if spaced {
1042                tokens.push(PtxToken::Space);
1043            }
1044            self.a.unparse_tokens_mode(tokens, spaced);
1045            tokens.push(PtxToken::Semicolon);
1046            if spaced {
1047                tokens.push(PtxToken::Newline);
1048            }
1049        }
1050    }
1051
1052    impl PtxUnparser for CvtRnBf16x2Ue8m0x2 {
1053        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
1054            self.unparse_tokens_mode(tokens, false);
1055        }
1056        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
1057            push_opcode(tokens, "cvt");
1058            push_directive(tokens, "rn");
1059            push_directive(tokens, "bf16x2");
1060            push_directive(tokens, "ue8m0x2");
1061            if spaced {
1062                tokens.push(PtxToken::Space);
1063            }
1064            self.d.unparse_tokens_mode(tokens, spaced);
1065            tokens.push(PtxToken::Comma);
1066            if spaced {
1067                tokens.push(PtxToken::Space);
1068            }
1069            self.a.unparse_tokens_mode(tokens, spaced);
1070            tokens.push(PtxToken::Semicolon);
1071            if spaced {
1072                tokens.push(PtxToken::Newline);
1073            }
1074        }
1075    }
1076}