ptx_parser/unparser/instruction/
wmma_store.rs

1//! Original PTX specification:
2//!
3//! wmma.store.d.sync.aligned.layout.shape{.ss}.type [p], r {, stride};
4//! .layout = {.row, .col};
5//! .shape  = {.m16n16k16, .m8n32k16, .m32n8k16};
6//! .ss     = {.global, .shared, .shared::cta};
7//! .type   = {.f16, .f32, .s32};
8//! ----------------------------------------------------------------
9//! wmma.store.d.sync.aligned.layout.shape{.ss}.type [p], r {, stride};
10//! .layout = {.row, .col};
11//! .shape  = {.m8n8k32, .m8n8k128};
12//! .ss     = {.global, .shared, .shared::cta};
13//! .type   = {.s32};
14//! ----------------------------------------------------------------
15//! wmma.store.d.sync.aligned.layout.shape{.ss}.type [p], r {, stride};
16//! .layout = {.row, .col};
17//! .shape  = {.m16n16k8};
18//! .ss     = {.global, .shared, .shared::cta};
19//! .type   = {.f32};
20//! ----------------------------------------------------------------
21//! wmma.store.d.sync.aligned.layout.shape{.ss}.type [p], r {, stride};
22//! .layout = {.row, .col};
23//! .shape  = {.m8n8k4 };
24//! .ss     = {.global, .shared, .shared::cta};
25//! .type   = {.f64};
26
27#![allow(unused)]
28
29use crate::lexer::PtxToken;
30use crate::unparser::{PtxUnparser, common::*};
31
32pub mod section_0 {
33    use super::*;
34    use crate::r#type::instruction::wmma_store::section_0::*;
35
36    impl PtxUnparser for WmmaStoreDSyncAlignedLayoutShapeSsType {
37        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
38            push_opcode(tokens, "wmma");
39                    push_directive(tokens, "store");
40                    push_directive(tokens, "d");
41                    push_directive(tokens, "sync");
42                    push_directive(tokens, "aligned");
43                    match &self.layout {
44                            Layout::Row => {
45                                    push_directive(tokens, "row");
46                            }
47                            Layout::Col => {
48                                    push_directive(tokens, "col");
49                            }
50                    }
51                    match &self.shape {
52                            Shape::M16n16k16 => {
53                                    push_directive(tokens, "m16n16k16");
54                            }
55                            Shape::M8n32k16 => {
56                                    push_directive(tokens, "m8n32k16");
57                            }
58                            Shape::M32n8k16 => {
59                                    push_directive(tokens, "m32n8k16");
60                            }
61                    }
62                    if let Some(ss_0) = self.ss.as_ref() {
63                            match ss_0 {
64                                    Ss::SharedCta => {
65                                            push_directive(tokens, "shared::cta");
66                                    }
67                                    Ss::Global => {
68                                            push_directive(tokens, "global");
69                                    }
70                                    Ss::Shared => {
71                                            push_directive(tokens, "shared");
72                                    }
73                            }
74                    }
75                    match &self.type_ {
76                            Type::F16 => {
77                                    push_directive(tokens, "f16");
78                            }
79                            Type::F32 => {
80                                    push_directive(tokens, "f32");
81                            }
82                            Type::S32 => {
83                                    push_directive(tokens, "s32");
84                            }
85                    }
86                    self.p.unparse_tokens(tokens);
87            tokens.push(PtxToken::Comma);
88                    self.r.unparse_tokens(tokens);
89            if self.stride.is_some() { tokens.push(PtxToken::Comma); }
90                    if let Some(opt_1) = self.stride.as_ref() {
91                        opt_1.unparse_tokens(tokens);
92                    }
93            tokens.push(PtxToken::Semicolon);
94        }
95    }
96
97}
98
99pub mod section_1 {
100    use super::*;
101    use crate::r#type::instruction::wmma_store::section_1::*;
102
103    impl PtxUnparser for WmmaStoreDSyncAlignedLayoutShapeSsType1 {
104        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
105            push_opcode(tokens, "wmma");
106                    push_directive(tokens, "store");
107                    push_directive(tokens, "d");
108                    push_directive(tokens, "sync");
109                    push_directive(tokens, "aligned");
110                    match &self.layout {
111                            Layout::Row => {
112                                    push_directive(tokens, "row");
113                            }
114                            Layout::Col => {
115                                    push_directive(tokens, "col");
116                            }
117                    }
118                    match &self.shape {
119                            Shape::M8n8k128 => {
120                                    push_directive(tokens, "m8n8k128");
121                            }
122                            Shape::M8n8k32 => {
123                                    push_directive(tokens, "m8n8k32");
124                            }
125                    }
126                    if let Some(ss_2) = self.ss.as_ref() {
127                            match ss_2 {
128                                    Ss::SharedCta => {
129                                            push_directive(tokens, "shared::cta");
130                                    }
131                                    Ss::Global => {
132                                            push_directive(tokens, "global");
133                                    }
134                                    Ss::Shared => {
135                                            push_directive(tokens, "shared");
136                                    }
137                            }
138                    }
139                    match &self.type_ {
140                            Type::S32 => {
141                                    push_directive(tokens, "s32");
142                            }
143                    }
144                    self.p.unparse_tokens(tokens);
145            tokens.push(PtxToken::Comma);
146                    self.r.unparse_tokens(tokens);
147            if self.stride.is_some() { tokens.push(PtxToken::Comma); }
148                    if let Some(opt_3) = self.stride.as_ref() {
149                        opt_3.unparse_tokens(tokens);
150                    }
151            tokens.push(PtxToken::Semicolon);
152        }
153    }
154
155}
156
157pub mod section_2 {
158    use super::*;
159    use crate::r#type::instruction::wmma_store::section_2::*;
160
161    impl PtxUnparser for WmmaStoreDSyncAlignedLayoutShapeSsType2 {
162        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
163            push_opcode(tokens, "wmma");
164                    push_directive(tokens, "store");
165                    push_directive(tokens, "d");
166                    push_directive(tokens, "sync");
167                    push_directive(tokens, "aligned");
168                    match &self.layout {
169                            Layout::Row => {
170                                    push_directive(tokens, "row");
171                            }
172                            Layout::Col => {
173                                    push_directive(tokens, "col");
174                            }
175                    }
176                    match &self.shape {
177                            Shape::M16n16k8 => {
178                                    push_directive(tokens, "m16n16k8");
179                            }
180                    }
181                    if let Some(ss_4) = self.ss.as_ref() {
182                            match ss_4 {
183                                    Ss::SharedCta => {
184                                            push_directive(tokens, "shared::cta");
185                                    }
186                                    Ss::Global => {
187                                            push_directive(tokens, "global");
188                                    }
189                                    Ss::Shared => {
190                                            push_directive(tokens, "shared");
191                                    }
192                            }
193                    }
194                    match &self.type_ {
195                            Type::F32 => {
196                                    push_directive(tokens, "f32");
197                            }
198                    }
199                    self.p.unparse_tokens(tokens);
200            tokens.push(PtxToken::Comma);
201                    self.r.unparse_tokens(tokens);
202            if self.stride.is_some() { tokens.push(PtxToken::Comma); }
203                    if let Some(opt_5) = self.stride.as_ref() {
204                        opt_5.unparse_tokens(tokens);
205                    }
206            tokens.push(PtxToken::Semicolon);
207        }
208    }
209
210}
211
212pub mod section_3 {
213    use super::*;
214    use crate::r#type::instruction::wmma_store::section_3::*;
215
216    impl PtxUnparser for WmmaStoreDSyncAlignedLayoutShapeSsType3 {
217        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
218            push_opcode(tokens, "wmma");
219                    push_directive(tokens, "store");
220                    push_directive(tokens, "d");
221                    push_directive(tokens, "sync");
222                    push_directive(tokens, "aligned");
223                    match &self.layout {
224                            Layout::Row => {
225                                    push_directive(tokens, "row");
226                            }
227                            Layout::Col => {
228                                    push_directive(tokens, "col");
229                            }
230                    }
231                    match &self.shape {
232                            Shape::M8n8k4 => {
233                                    push_directive(tokens, "m8n8k4");
234                            }
235                    }
236                    if let Some(ss_6) = self.ss.as_ref() {
237                            match ss_6 {
238                                    Ss::SharedCta => {
239                                            push_directive(tokens, "shared::cta");
240                                    }
241                                    Ss::Global => {
242                                            push_directive(tokens, "global");
243                                    }
244                                    Ss::Shared => {
245                                            push_directive(tokens, "shared");
246                                    }
247                            }
248                    }
249                    match &self.type_ {
250                            Type::F64 => {
251                                    push_directive(tokens, "f64");
252                            }
253                    }
254                    self.p.unparse_tokens(tokens);
255            tokens.push(PtxToken::Comma);
256                    self.r.unparse_tokens(tokens);
257            if self.stride.is_some() { tokens.push(PtxToken::Comma); }
258                    if let Some(opt_7) = self.stride.as_ref() {
259                        opt_7.unparse_tokens(tokens);
260                    }
261            tokens.push(PtxToken::Semicolon);
262        }
263    }
264
265}
266