ptx_parser/parser/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::parser::{
36    PtxParseError, PtxParser, PtxTokenStream, Span,
37    util::{
38        between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
39        pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
40    },
41};
42use crate::r#type::common::*;
43use crate::{alt, ok, seq_n};
44
45pub mod section_0 {
46    use super::*;
47    use crate::r#type::instruction::atom::section_0::*;
48
49    // ============================================================================
50    // Generated enum parsers
51    // ============================================================================
52
53    impl PtxParser for LevelCacheHint {
54        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
55            alt!(map(string_p(".L2::cache_hint"), |_, _span| {
56                LevelCacheHint::L2CacheHint
57            }))
58        }
59    }
60
61    impl PtxParser for Op {
62        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
63            alt!(
64                map(string_p(".exch"), |_, _span| Op::Exch),
65                map(string_p(".and"), |_, _span| Op::And),
66                map(string_p(".xor"), |_, _span| Op::Xor),
67                map(string_p(".cas"), |_, _span| Op::Cas),
68                map(string_p(".add"), |_, _span| Op::Add),
69                map(string_p(".inc"), |_, _span| Op::Inc),
70                map(string_p(".dec"), |_, _span| Op::Dec),
71                map(string_p(".min"), |_, _span| Op::Min),
72                map(string_p(".max"), |_, _span| Op::Max),
73                map(string_p(".or"), |_, _span| Op::Or)
74            )
75        }
76    }
77
78    impl PtxParser for Scope {
79        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
80            alt!(
81                map(string_p(".cluster"), |_, _span| Scope::Cluster),
82                map(string_p(".cta"), |_, _span| Scope::Cta),
83                map(string_p(".gpu"), |_, _span| Scope::Gpu),
84                map(string_p(".sys"), |_, _span| Scope::Sys)
85            )
86        }
87    }
88
89    impl PtxParser for Sem {
90        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
91            alt!(
92                map(string_p(".relaxed"), |_, _span| Sem::Relaxed),
93                map(string_p(".acquire"), |_, _span| Sem::Acquire),
94                map(string_p(".release"), |_, _span| Sem::Release),
95                map(string_p(".acq_rel"), |_, _span| Sem::AcqRel)
96            )
97        }
98    }
99
100    impl PtxParser for Space {
101        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
102            alt!(
103                map(string_p(".shared::cluster"), |_, _span| {
104                    Space::SharedCluster
105                }),
106                map(string_p(".shared::cta"), |_, _span| Space::SharedCta),
107                map(string_p(".global"), |_, _span| Space::Global),
108                map(string_p(".shared"), |_, _span| Space::Shared)
109            )
110        }
111    }
112
113    impl PtxParser for Type {
114        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
115            alt!(
116                map(string_p(".b32"), |_, _span| Type::B32),
117                map(string_p(".b64"), |_, _span| Type::B64),
118                map(string_p(".u32"), |_, _span| Type::U32),
119                map(string_p(".u64"), |_, _span| Type::U64),
120                map(string_p(".s32"), |_, _span| Type::S32),
121                map(string_p(".s64"), |_, _span| Type::S64),
122                map(string_p(".f32"), |_, _span| Type::F32),
123                map(string_p(".f64"), |_, _span| Type::F64)
124            )
125        }
126    }
127
128    impl PtxParser for AtomSemScopeSpaceOpLevelCacheHintType {
129        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
130            try_map(
131                seq_n!(
132                    string_p("atom"),
133                    optional(Sem::parse()),
134                    optional(Scope::parse()),
135                    optional(Space::parse()),
136                    Op::parse(),
137                    optional(LevelCacheHint::parse()),
138                    Type::parse(),
139                    GeneralOperand::parse(),
140                    comma_p(),
141                    AddressOperand::parse(),
142                    comma_p(),
143                    GeneralOperand::parse(),
144                    map(
145                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
146                        |value, _| value.map(|(_, operand)| operand)
147                    ),
148                    semicolon_p()
149                ),
150                |(
151                    _,
152                    sem,
153                    scope,
154                    space,
155                    op,
156                    level_cache_hint,
157                    type_,
158                    d,
159                    _,
160                    a,
161                    _,
162                    b,
163                    cache_policy,
164                    _,
165                ),
166                 span| {
167                    ok!(AtomSemScopeSpaceOpLevelCacheHintType {
168                        sem = sem,
169                        scope = scope,
170                        space = space,
171                        op = op,
172                        level_cache_hint = level_cache_hint,
173                        type_ = type_,
174                        d = d,
175                        a = a,
176                        b = b,
177                        cache_policy = cache_policy,
178
179                    })
180                },
181            )
182        }
183    }
184
185    impl PtxParser for AtomSemScopeSpaceOpType {
186        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
187            try_map(
188                seq_n!(
189                    string_p("atom"),
190                    optional(Sem::parse()),
191                    optional(Scope::parse()),
192                    optional(Space::parse()),
193                    Op::parse(),
194                    Type::parse(),
195                    GeneralOperand::parse(),
196                    comma_p(),
197                    AddressOperand::parse(),
198                    comma_p(),
199                    GeneralOperand::parse(),
200                    comma_p(),
201                    GeneralOperand::parse(),
202                    semicolon_p()
203                ),
204                |(_, sem, scope, space, op, type_, d, _, a, _, b, _, c, _), span| {
205                    ok!(AtomSemScopeSpaceOpType {
206                        sem = sem,
207                        scope = scope,
208                        space = space,
209                        op = op,
210                        type_ = type_,
211                        d = d,
212                        a = a,
213                        b = b,
214                        c = c,
215
216                    })
217                },
218            )
219        }
220    }
221
222    impl PtxParser for AtomSemScopeSpaceCasB16 {
223        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
224            try_map(
225                seq_n!(
226                    string_p("atom"),
227                    optional(Sem::parse()),
228                    optional(Scope::parse()),
229                    optional(Space::parse()),
230                    string_p(".cas"),
231                    string_p(".b16"),
232                    GeneralOperand::parse(),
233                    comma_p(),
234                    AddressOperand::parse(),
235                    comma_p(),
236                    GeneralOperand::parse(),
237                    comma_p(),
238                    GeneralOperand::parse(),
239                    semicolon_p()
240                ),
241                |(_, sem, scope, space, cas, b16, d, _, a, _, b, _, c, _), span| {
242                    ok!(AtomSemScopeSpaceCasB16 {
243                        sem = sem,
244                        scope = scope,
245                        space = space,
246                        cas = cas,
247                        b16 = b16,
248                        d = d,
249                        a = a,
250                        b = b,
251                        c = c,
252
253                    })
254                },
255            )
256        }
257    }
258
259    impl PtxParser for AtomSemScopeSpaceCasB128 {
260        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
261            try_map(
262                seq_n!(
263                    string_p("atom"),
264                    optional(Sem::parse()),
265                    optional(Scope::parse()),
266                    optional(Space::parse()),
267                    string_p(".cas"),
268                    string_p(".b128"),
269                    GeneralOperand::parse(),
270                    comma_p(),
271                    AddressOperand::parse(),
272                    comma_p(),
273                    GeneralOperand::parse(),
274                    comma_p(),
275                    GeneralOperand::parse(),
276                    semicolon_p()
277                ),
278                |(_, sem, scope, space, cas, b128, d, _, a, _, b, _, c, _), span| {
279                    ok!(AtomSemScopeSpaceCasB128 {
280                        sem = sem,
281                        scope = scope,
282                        space = space,
283                        cas = cas,
284                        b128 = b128,
285                        d = d,
286                        a = a,
287                        b = b,
288                        c = c,
289
290                    })
291                },
292            )
293        }
294    }
295
296    impl PtxParser for AtomSemScopeSpaceExchLevelCacheHintB128 {
297        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
298            try_map(
299                seq_n!(
300                    string_p("atom"),
301                    optional(Sem::parse()),
302                    optional(Scope::parse()),
303                    optional(Space::parse()),
304                    string_p(".exch"),
305                    optional(LevelCacheHint::parse()),
306                    string_p(".b128"),
307                    GeneralOperand::parse(),
308                    comma_p(),
309                    AddressOperand::parse(),
310                    comma_p(),
311                    GeneralOperand::parse(),
312                    map(
313                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
314                        |value, _| value.map(|(_, operand)| operand)
315                    ),
316                    semicolon_p()
317                ),
318                |(
319                    _,
320                    sem,
321                    scope,
322                    space,
323                    exch,
324                    level_cache_hint,
325                    b128,
326                    d,
327                    _,
328                    a,
329                    _,
330                    b,
331                    cache_policy,
332                    _,
333                ),
334                 span| {
335                    ok!(AtomSemScopeSpaceExchLevelCacheHintB128 {
336                        sem = sem,
337                        scope = scope,
338                        space = space,
339                        exch = exch,
340                        level_cache_hint = level_cache_hint,
341                        b128 = b128,
342                        d = d,
343                        a = a,
344                        b = b,
345                        cache_policy = cache_policy,
346
347                    })
348                },
349            )
350        }
351    }
352
353    impl PtxParser for AtomSemScopeSpaceAddNoftzLevelCacheHintF16 {
354        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
355            try_map(
356                seq_n!(
357                    string_p("atom"),
358                    optional(Sem::parse()),
359                    optional(Scope::parse()),
360                    optional(Space::parse()),
361                    string_p(".add"),
362                    string_p(".noftz"),
363                    optional(LevelCacheHint::parse()),
364                    string_p(".f16"),
365                    GeneralOperand::parse(),
366                    comma_p(),
367                    AddressOperand::parse(),
368                    comma_p(),
369                    GeneralOperand::parse(),
370                    map(
371                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
372                        |value, _| value.map(|(_, operand)| operand)
373                    ),
374                    semicolon_p()
375                ),
376                |(
377                    _,
378                    sem,
379                    scope,
380                    space,
381                    add,
382                    noftz,
383                    level_cache_hint,
384                    f16,
385                    d,
386                    _,
387                    a,
388                    _,
389                    b,
390                    cache_policy,
391                    _,
392                ),
393                 span| {
394                    ok!(AtomSemScopeSpaceAddNoftzLevelCacheHintF16 {
395                        sem = sem,
396                        scope = scope,
397                        space = space,
398                        add = add,
399                        noftz = noftz,
400                        level_cache_hint = level_cache_hint,
401                        f16 = f16,
402                        d = d,
403                        a = a,
404                        b = b,
405                        cache_policy = cache_policy,
406
407                    })
408                },
409            )
410        }
411    }
412
413    impl PtxParser for AtomSemScopeSpaceAddNoftzLevelCacheHintF16x2 {
414        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
415            try_map(
416                seq_n!(
417                    string_p("atom"),
418                    optional(Sem::parse()),
419                    optional(Scope::parse()),
420                    optional(Space::parse()),
421                    string_p(".add"),
422                    string_p(".noftz"),
423                    optional(LevelCacheHint::parse()),
424                    string_p(".f16x2"),
425                    GeneralOperand::parse(),
426                    comma_p(),
427                    AddressOperand::parse(),
428                    comma_p(),
429                    GeneralOperand::parse(),
430                    map(
431                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
432                        |value, _| value.map(|(_, operand)| operand)
433                    ),
434                    semicolon_p()
435                ),
436                |(
437                    _,
438                    sem,
439                    scope,
440                    space,
441                    add,
442                    noftz,
443                    level_cache_hint,
444                    f16x2,
445                    d,
446                    _,
447                    a,
448                    _,
449                    b,
450                    cache_policy,
451                    _,
452                ),
453                 span| {
454                    ok!(AtomSemScopeSpaceAddNoftzLevelCacheHintF16x2 {
455                        sem = sem,
456                        scope = scope,
457                        space = space,
458                        add = add,
459                        noftz = noftz,
460                        level_cache_hint = level_cache_hint,
461                        f16x2 = f16x2,
462                        d = d,
463                        a = a,
464                        b = b,
465                        cache_policy = cache_policy,
466
467                    })
468                },
469            )
470        }
471    }
472
473    impl PtxParser for AtomSemScopeSpaceAddNoftzLevelCacheHintBf16 {
474        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
475            try_map(
476                seq_n!(
477                    string_p("atom"),
478                    optional(Sem::parse()),
479                    optional(Scope::parse()),
480                    optional(Space::parse()),
481                    string_p(".add"),
482                    string_p(".noftz"),
483                    optional(LevelCacheHint::parse()),
484                    string_p(".bf16"),
485                    GeneralOperand::parse(),
486                    comma_p(),
487                    AddressOperand::parse(),
488                    comma_p(),
489                    GeneralOperand::parse(),
490                    map(
491                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
492                        |value, _| value.map(|(_, operand)| operand)
493                    ),
494                    semicolon_p()
495                ),
496                |(
497                    _,
498                    sem,
499                    scope,
500                    space,
501                    add,
502                    noftz,
503                    level_cache_hint,
504                    bf16,
505                    d,
506                    _,
507                    a,
508                    _,
509                    b,
510                    cache_policy,
511                    _,
512                ),
513                 span| {
514                    ok!(AtomSemScopeSpaceAddNoftzLevelCacheHintBf16 {
515                        sem = sem,
516                        scope = scope,
517                        space = space,
518                        add = add,
519                        noftz = noftz,
520                        level_cache_hint = level_cache_hint,
521                        bf16 = bf16,
522                        d = d,
523                        a = a,
524                        b = b,
525                        cache_policy = cache_policy,
526
527                    })
528                },
529            )
530        }
531    }
532
533    impl PtxParser for AtomSemScopeSpaceAddNoftzLevelCacheHintBf16x2 {
534        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
535            try_map(
536                seq_n!(
537                    string_p("atom"),
538                    optional(Sem::parse()),
539                    optional(Scope::parse()),
540                    optional(Space::parse()),
541                    string_p(".add"),
542                    string_p(".noftz"),
543                    optional(LevelCacheHint::parse()),
544                    string_p(".bf16x2"),
545                    GeneralOperand::parse(),
546                    comma_p(),
547                    AddressOperand::parse(),
548                    comma_p(),
549                    GeneralOperand::parse(),
550                    map(
551                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
552                        |value, _| value.map(|(_, operand)| operand)
553                    ),
554                    semicolon_p()
555                ),
556                |(
557                    _,
558                    sem,
559                    scope,
560                    space,
561                    add,
562                    noftz,
563                    level_cache_hint,
564                    bf16x2,
565                    d,
566                    _,
567                    a,
568                    _,
569                    b,
570                    cache_policy,
571                    _,
572                ),
573                 span| {
574                    ok!(AtomSemScopeSpaceAddNoftzLevelCacheHintBf16x2 {
575                        sem = sem,
576                        scope = scope,
577                        space = space,
578                        add = add,
579                        noftz = noftz,
580                        level_cache_hint = level_cache_hint,
581                        bf16x2 = bf16x2,
582                        d = d,
583                        a = a,
584                        b = b,
585                        cache_policy = cache_policy,
586
587                    })
588                },
589            )
590        }
591    }
592}
593
594pub mod section_1 {
595    use super::*;
596    use crate::r#type::instruction::atom::section_1::*;
597
598    // ============================================================================
599    // Generated enum parsers
600    // ============================================================================
601
602    impl PtxParser for HalfWordType {
603        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
604            alt!(
605                map(string_p(".bf16"), |_, _span| HalfWordType::Bf16),
606                map(string_p(".f16"), |_, _span| HalfWordType::F16)
607            )
608        }
609    }
610
611    impl PtxParser for LevelCacheHint {
612        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
613            alt!(map(string_p(".L2::cache_hint"), |_, _span| {
614                LevelCacheHint::L2CacheHint
615            }))
616        }
617    }
618
619    impl PtxParser for Op {
620        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
621            alt!(
622                map(string_p(".add"), |_, _span| Op::Add),
623                map(string_p(".min"), |_, _span| Op::Min),
624                map(string_p(".max"), |_, _span| Op::Max)
625            )
626        }
627    }
628
629    impl PtxParser for PackedType {
630        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
631            alt!(
632                map(string_p(".bf16x2"), |_, _span| PackedType::Bf16x2),
633                map(string_p(".f16x2"), |_, _span| PackedType::F16x2)
634            )
635        }
636    }
637
638    impl PtxParser for Scope {
639        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
640            alt!(
641                map(string_p(".cluster"), |_, _span| Scope::Cluster),
642                map(string_p(".cta"), |_, _span| Scope::Cta),
643                map(string_p(".gpu"), |_, _span| Scope::Gpu),
644                map(string_p(".sys"), |_, _span| Scope::Sys)
645            )
646        }
647    }
648
649    impl PtxParser for Sem {
650        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
651            alt!(
652                map(string_p(".relaxed"), |_, _span| Sem::Relaxed),
653                map(string_p(".acquire"), |_, _span| Sem::Acquire),
654                map(string_p(".release"), |_, _span| Sem::Release),
655                map(string_p(".acq_rel"), |_, _span| Sem::AcqRel)
656            )
657        }
658    }
659
660    impl PtxParser for Vec16Bit {
661        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
662            alt!(
663                map(string_p(".v2"), |_, _span| Vec16Bit::V2),
664                map(string_p(".v4"), |_, _span| Vec16Bit::V4),
665                map(string_p(".v8"), |_, _span| Vec16Bit::V8)
666            )
667        }
668    }
669
670    impl PtxParser for Vec32Bit {
671        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
672            alt!(
673                map(string_p(".v2"), |_, _span| Vec32Bit::V2),
674                map(string_p(".v4"), |_, _span| Vec32Bit::V4)
675            )
676        }
677    }
678
679    impl PtxParser for AtomSemScopeGlobalAddLevelCacheHintVec32BitF32 {
680        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
681            try_map(
682                seq_n!(
683                    string_p("atom"),
684                    optional(Sem::parse()),
685                    optional(Scope::parse()),
686                    map(optional(string_p(".global")), |value, _| value.is_some()),
687                    string_p(".add"),
688                    optional(LevelCacheHint::parse()),
689                    Vec32Bit::parse(),
690                    string_p(".f32"),
691                    GeneralOperand::parse(),
692                    comma_p(),
693                    AddressOperand::parse(),
694                    comma_p(),
695                    GeneralOperand::parse(),
696                    map(
697                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
698                        |value, _| value.map(|(_, operand)| operand)
699                    ),
700                    semicolon_p()
701                ),
702                |(
703                    _,
704                    sem,
705                    scope,
706                    global,
707                    add,
708                    level_cache_hint,
709                    vec_32_bit,
710                    f32,
711                    d,
712                    _,
713                    a,
714                    _,
715                    b,
716                    cache_policy,
717                    _,
718                ),
719                 span| {
720                    ok!(AtomSemScopeGlobalAddLevelCacheHintVec32BitF32 {
721                        sem = sem,
722                        scope = scope,
723                        global = global,
724                        add = add,
725                        level_cache_hint = level_cache_hint,
726                        vec_32_bit = vec_32_bit,
727                        f32 = f32,
728                        d = d,
729                        a = a,
730                        b = b,
731                        cache_policy = cache_policy,
732
733                    })
734                },
735            )
736        }
737    }
738
739    impl PtxParser for AtomSemScopeGlobalOpNoftzLevelCacheHintVec16BitHalfWordType {
740        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
741            try_map(
742                seq_n!(
743                    string_p("atom"),
744                    optional(Sem::parse()),
745                    optional(Scope::parse()),
746                    map(optional(string_p(".global")), |value, _| value.is_some()),
747                    Op::parse(),
748                    string_p(".noftz"),
749                    optional(LevelCacheHint::parse()),
750                    Vec16Bit::parse(),
751                    HalfWordType::parse(),
752                    GeneralOperand::parse(),
753                    comma_p(),
754                    AddressOperand::parse(),
755                    comma_p(),
756                    GeneralOperand::parse(),
757                    map(
758                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
759                        |value, _| value.map(|(_, operand)| operand)
760                    ),
761                    semicolon_p()
762                ),
763                |(
764                    _,
765                    sem,
766                    scope,
767                    global,
768                    op,
769                    noftz,
770                    level_cache_hint,
771                    vec_16_bit,
772                    half_word_type,
773                    d,
774                    _,
775                    a,
776                    _,
777                    b,
778                    cache_policy,
779                    _,
780                ),
781                 span| {
782                    ok!(AtomSemScopeGlobalOpNoftzLevelCacheHintVec16BitHalfWordType {
783                        sem = sem,
784                        scope = scope,
785                        global = global,
786                        op = op,
787                        noftz = noftz,
788                        level_cache_hint = level_cache_hint,
789                        vec_16_bit = vec_16_bit,
790                        half_word_type = half_word_type,
791                        d = d,
792                        a = a,
793                        b = b,
794                        cache_policy = cache_policy,
795
796                    })
797                },
798            )
799        }
800    }
801
802    impl PtxParser for AtomSemScopeGlobalOpNoftzLevelCacheHintVec32BitPackedType {
803        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
804            try_map(
805                seq_n!(
806                    string_p("atom"),
807                    optional(Sem::parse()),
808                    optional(Scope::parse()),
809                    map(optional(string_p(".global")), |value, _| value.is_some()),
810                    Op::parse(),
811                    string_p(".noftz"),
812                    optional(LevelCacheHint::parse()),
813                    Vec32Bit::parse(),
814                    PackedType::parse(),
815                    GeneralOperand::parse(),
816                    comma_p(),
817                    AddressOperand::parse(),
818                    comma_p(),
819                    GeneralOperand::parse(),
820                    map(
821                        optional(seq_n!(comma_p(), GeneralOperand::parse())),
822                        |value, _| value.map(|(_, operand)| operand)
823                    ),
824                    semicolon_p()
825                ),
826                |(
827                    _,
828                    sem,
829                    scope,
830                    global,
831                    op,
832                    noftz,
833                    level_cache_hint,
834                    vec_32_bit,
835                    packed_type,
836                    d,
837                    _,
838                    a,
839                    _,
840                    b,
841                    cache_policy,
842                    _,
843                ),
844                 span| {
845                    ok!(AtomSemScopeGlobalOpNoftzLevelCacheHintVec32BitPackedType {
846                        sem = sem,
847                        scope = scope,
848                        global = global,
849                        op = op,
850                        noftz = noftz,
851                        level_cache_hint = level_cache_hint,
852                        vec_32_bit = vec_32_bit,
853                        packed_type = packed_type,
854                        d = d,
855                        a = a,
856                        b = b,
857                        cache_policy = cache_policy,
858
859                    })
860                },
861            )
862        }
863    }
864}