ptx_parser/unparser/instruction/
cp_async_bulk_prefetch_tensor.rs

1//! Original PTX specification:
2//!
3//! // global -> shared::cluster:
4//! cp.async.bulk.prefetch.tensor.dim.L2.src{.load_mode}{.level::cache_hint} [tensorMap, tensorCoords] {, im2colInfo } {, cache-policy};
5//! .src =                { .global };
6//! .dim =                { .1d, .2d, .3d, .4d, .5d };
7//! .load_mode =          { .tile, .tile::gather4, .im2col, .im2col::w, .im2col::w::128 };
8//! .level::cache_hint =  { .L2::cache_hint };
9
10#![allow(unused)]
11
12use crate::lexer::PtxToken;
13use crate::unparser::{PtxUnparser, common::*};
14
15pub mod section_0 {
16    use super::*;
17    use crate::r#type::instruction::cp_async_bulk_prefetch_tensor::section_0::*;
18
19    impl PtxUnparser for CpAsyncBulkPrefetchTensorDimL2SrcLoadModeLevelCacheHint {
20        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
21            push_opcode(tokens, "cp");
22                    push_directive(tokens, "async");
23                    push_directive(tokens, "bulk");
24                    push_directive(tokens, "prefetch");
25                    push_directive(tokens, "tensor");
26                    match &self.dim {
27                            Dim::_1d => {
28                                    push_directive(tokens, "1d");
29                            }
30                            Dim::_2d => {
31                                    push_directive(tokens, "2d");
32                            }
33                            Dim::_3d => {
34                                    push_directive(tokens, "3d");
35                            }
36                            Dim::_4d => {
37                                    push_directive(tokens, "4d");
38                            }
39                            Dim::_5d => {
40                                    push_directive(tokens, "5d");
41                            }
42                    }
43                    push_directive(tokens, "L2");
44                    match &self.src {
45                            Src::Global => {
46                                    push_directive(tokens, "global");
47                            }
48                    }
49                    if let Some(load_mode_0) = self.load_mode.as_ref() {
50                            match load_mode_0 {
51                                    LoadMode::Im2colW128 => {
52                                            push_directive(tokens, "im2col::w::128");
53                                    }
54                                    LoadMode::TileGather4 => {
55                                            push_directive(tokens, "tile::gather4");
56                                    }
57                                    LoadMode::Im2colW => {
58                                            push_directive(tokens, "im2col::w");
59                                    }
60                                    LoadMode::Im2col => {
61                                            push_directive(tokens, "im2col");
62                                    }
63                                    LoadMode::Tile => {
64                                            push_directive(tokens, "tile");
65                                    }
66                            }
67                    }
68                    if let Some(level_cache_hint_1) = self.level_cache_hint.as_ref() {
69                            match level_cache_hint_1 {
70                                    LevelCacheHint::L2CacheHint => {
71                                            push_directive(tokens, "L2::cache_hint");
72                                    }
73                            }
74                    }
75                    self.tensormap.unparse_tokens(tokens);
76            if self.im2colinfo.is_some() { tokens.push(PtxToken::Comma); }
77                    if let Some(opt_2) = self.im2colinfo.as_ref() {
78                        opt_2.unparse_tokens(tokens);
79                    }
80            if self.cache_policy.is_some() { tokens.push(PtxToken::Comma); }
81                    if let Some(opt_3) = self.cache_policy.as_ref() {
82                        opt_3.unparse_tokens(tokens);
83                    }
84            tokens.push(PtxToken::Semicolon);
85        }
86    }
87
88}
89