ptx_parser/unparser/instruction/
tensormap_replace.rs1#![allow(unused)]
14
15use crate::lexer::PtxToken;
16use crate::unparser::{PtxUnparser, common::*};
17
18pub mod section_0 {
19 use super::*;
20 use crate::r#type::instruction::tensormap_replace::section_0::*;
21
22 impl PtxUnparser for TensormapReplaceModeField1SsB1024Type {
23 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
24 self.unparse_tokens_mode(tokens, false);
25 }
26 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
27 push_opcode(tokens, "tensormap");
28 push_directive(tokens, "replace");
29 match &self.mode {
30 Mode::Tile => {
31 push_directive(tokens, "tile");
32 }
33 }
34 match &self.field1 {
35 Field1::GlobalAddress => {
36 push_directive(tokens, "global_address");
37 }
38 Field1::Rank => {
39 push_directive(tokens, "rank");
40 }
41 }
42 if let Some(ss_0) = self.ss.as_ref() {
43 match ss_0 {
44 Ss::SharedCta => {
45 push_directive(tokens, "shared::cta");
46 }
47 Ss::Global => {
48 push_directive(tokens, "global");
49 }
50 }
51 }
52 push_directive(tokens, "b1024");
53 match &self.type_ {
54 Type::B32 => {
55 push_directive(tokens, "b32");
56 }
57 Type::B64 => {
58 push_directive(tokens, "b64");
59 }
60 }
61 if spaced {
62 tokens.push(PtxToken::Space);
63 }
64 self.addr.unparse_tokens_mode(tokens, spaced);
65 tokens.push(PtxToken::Comma);
66 if spaced {
67 tokens.push(PtxToken::Space);
68 }
69 self.new_val.unparse_tokens_mode(tokens, spaced);
70 tokens.push(PtxToken::Semicolon);
71 if spaced {
72 tokens.push(PtxToken::Newline);
73 }
74 }
75 }
76
77 impl PtxUnparser for TensormapReplaceModeField2SsB1024Type {
78 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
79 self.unparse_tokens_mode(tokens, false);
80 }
81 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
82 push_opcode(tokens, "tensormap");
83 push_directive(tokens, "replace");
84 match &self.mode {
85 Mode::Tile => {
86 push_directive(tokens, "tile");
87 }
88 }
89 match &self.field2 {
90 Field2::ElementStride => {
91 push_directive(tokens, "element_stride");
92 }
93 Field2::GlobalStride => {
94 push_directive(tokens, "global_stride");
95 }
96 Field2::GlobalDim => {
97 push_directive(tokens, "global_dim");
98 }
99 Field2::BoxDim => {
100 push_directive(tokens, "box_dim");
101 }
102 }
103 if let Some(ss_1) = self.ss.as_ref() {
104 match ss_1 {
105 Ss::SharedCta => {
106 push_directive(tokens, "shared::cta");
107 }
108 Ss::Global => {
109 push_directive(tokens, "global");
110 }
111 }
112 }
113 push_directive(tokens, "b1024");
114 match &self.type_ {
115 Type::B32 => {
116 push_directive(tokens, "b32");
117 }
118 Type::B64 => {
119 push_directive(tokens, "b64");
120 }
121 }
122 if spaced {
123 tokens.push(PtxToken::Space);
124 }
125 self.addr.unparse_tokens_mode(tokens, spaced);
126 tokens.push(PtxToken::Comma);
127 if spaced {
128 tokens.push(PtxToken::Space);
129 }
130 self.ord.unparse_tokens_mode(tokens, spaced);
131 tokens.push(PtxToken::Comma);
132 if spaced {
133 tokens.push(PtxToken::Space);
134 }
135 self.new_val.unparse_tokens_mode(tokens, spaced);
136 tokens.push(PtxToken::Semicolon);
137 if spaced {
138 tokens.push(PtxToken::Newline);
139 }
140 }
141 }
142
143 impl PtxUnparser for TensormapReplaceModeField3SsB1024Type {
144 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
145 self.unparse_tokens_mode(tokens, false);
146 }
147 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
148 push_opcode(tokens, "tensormap");
149 push_directive(tokens, "replace");
150 match &self.mode {
151 Mode::Tile => {
152 push_directive(tokens, "tile");
153 }
154 }
155 match &self.field3 {
156 Field3::InterleaveLayout => {
157 push_directive(tokens, "interleave_layout");
158 }
159 Field3::SwizzleAtomicity => {
160 push_directive(tokens, "swizzle_atomicity");
161 }
162 Field3::SwizzleMode => {
163 push_directive(tokens, "swizzle_mode");
164 }
165 Field3::FillMode => {
166 push_directive(tokens, "fill_mode");
167 }
168 Field3::Elemtype => {
169 push_directive(tokens, "elemtype");
170 }
171 }
172 if let Some(ss_2) = self.ss.as_ref() {
173 match ss_2 {
174 Ss::SharedCta => {
175 push_directive(tokens, "shared::cta");
176 }
177 Ss::Global => {
178 push_directive(tokens, "global");
179 }
180 }
181 }
182 push_directive(tokens, "b1024");
183 match &self.type_ {
184 Type::B32 => {
185 push_directive(tokens, "b32");
186 }
187 Type::B64 => {
188 push_directive(tokens, "b64");
189 }
190 }
191 if spaced {
192 tokens.push(PtxToken::Space);
193 }
194 self.addr.unparse_tokens_mode(tokens, spaced);
195 tokens.push(PtxToken::Comma);
196 if spaced {
197 tokens.push(PtxToken::Space);
198 }
199 self.new_val.unparse_tokens_mode(tokens, spaced);
200 tokens.push(PtxToken::Semicolon);
201 if spaced {
202 tokens.push(PtxToken::Newline);
203 }
204 }
205 }
206}