ptx_parser/parser/instruction/
tensormap_cp_fenceproxy.rs

1//! Original PTX specification:
2//!
3//! tensormap.cp_fenceproxy.cp_qualifiers.fence_qualifiers.sync.aligned  [dst], [src], size;
4//! .cp_qualifiers    = { .global.shared::cta };
5//! .fence_qualifiers = { .to_proxy::from_proxy.release.scope };
6//! .to_proxy::from_proxy  = { .tensormap::generic };
7//! .scope            = { .cta, .cluster, .gpu , .sys };
8
9#![allow(unused)]
10
11use crate::parser::{
12    PtxParseError, PtxParser, PtxTokenStream, Span,
13    util::{
14        between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
15        pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
16    },
17};
18use crate::r#type::common::*;
19use crate::{alt, ok, seq_n};
20
21pub mod section_0 {
22    use super::*;
23    use crate::r#type::instruction::tensormap_cp_fenceproxy::section_0::*;
24
25    // ============================================================================
26    // Generated enum parsers
27    // ============================================================================
28
29    impl PtxParser for CpQualifiers {
30        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
31            alt!(map(string_p(".global.shared::cta"), |_, _span| {
32                CpQualifiers::GlobalSharedCta
33            }))
34        }
35    }
36
37    impl PtxParser for FenceQualifiers {
38        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
39            alt!(map(
40                seq_n!(
41                    ToProxyFromProxy::parse(),
42                    string_p(".release"),
43                    Scope::parse()
44                ),
45                |(to_proxy_from_proxy, release, scope), _span| {
46                    FenceQualifiers::ToProxyFromProxyReleaseScope(
47                        to_proxy_from_proxy,
48                        release,
49                        scope,
50                    )
51                }
52            ))
53        }
54    }
55
56    impl PtxParser for Scope {
57        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
58            alt!(
59                map(string_p(".cluster"), |_, _span| Scope::Cluster),
60                map(string_p(".cta"), |_, _span| Scope::Cta),
61                map(string_p(".gpu"), |_, _span| Scope::Gpu),
62                map(string_p(".sys"), |_, _span| Scope::Sys)
63            )
64        }
65    }
66
67    impl PtxParser for ToProxyFromProxy {
68        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
69            alt!(map(string_p(".tensormap::generic"), |_, _span| {
70                ToProxyFromProxy::TensormapGeneric
71            }))
72        }
73    }
74
75    impl PtxParser for TensormapCpFenceproxyCpQualifiersFenceQualifiersSyncAligned {
76        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
77            try_map(
78                seq_n!(
79                    string_p("tensormap"),
80                    string_p(".cp_fenceproxy"),
81                    CpQualifiers::parse(),
82                    FenceQualifiers::parse(),
83                    string_p(".sync"),
84                    string_p(".aligned"),
85                    AddressOperand::parse(),
86                    comma_p(),
87                    AddressOperand::parse(),
88                    comma_p(),
89                    GeneralOperand::parse(),
90                    semicolon_p()
91                ),
92                |(
93                    _,
94                    cp_fenceproxy,
95                    cp_qualifiers,
96                    fence_qualifiers,
97                    sync,
98                    aligned,
99                    dst,
100                    _,
101                    src,
102                    _,
103                    size,
104                    _,
105                ),
106                 span| {
107                    ok!(TensormapCpFenceproxyCpQualifiersFenceQualifiersSyncAligned {
108                        cp_fenceproxy = cp_fenceproxy,
109                        cp_qualifiers = cp_qualifiers,
110                        fence_qualifiers = fence_qualifiers,
111                        sync = sync,
112                        aligned = aligned,
113                        dst = dst,
114                        src = src,
115                        size = size,
116
117                    })
118                },
119            )
120        }
121    }
122}