ptx_parser/unparser/instruction/
prefetch.rs1#![allow(unused)]
13
14use crate::lexer::PtxToken;
15use crate::unparser::{PtxUnparser, common::*};
16
17pub mod section_0 {
18 use super::*;
19 use crate::r#type::instruction::prefetch::section_0::*;
20
21 impl PtxUnparser for PrefetchSpaceLevel {
22 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
23 self.unparse_tokens_mode(tokens, false);
24 }
25 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
26 push_opcode(tokens, "prefetch");
27 if let Some(space_0) = self.space.as_ref() {
28 match space_0 {
29 Space::Global => {
30 push_directive(tokens, "global");
31 }
32 Space::Local => {
33 push_directive(tokens, "local");
34 }
35 }
36 }
37 match &self.level {
38 Level::L1 => {
39 push_directive(tokens, "L1");
40 }
41 Level::L2 => {
42 push_directive(tokens, "L2");
43 }
44 }
45 if spaced {
46 tokens.push(PtxToken::Space);
47 }
48 self.a.unparse_tokens_mode(tokens, spaced);
49 tokens.push(PtxToken::Semicolon);
50 if spaced {
51 tokens.push(PtxToken::Newline);
52 }
53 }
54 }
55
56 impl PtxUnparser for PrefetchGlobalLevelEvictionPriority {
57 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
58 self.unparse_tokens_mode(tokens, false);
59 }
60 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
61 push_opcode(tokens, "prefetch");
62 push_directive(tokens, "global");
63 match &self.level_eviction_priority {
64 LevelEvictionPriority::L2EvictNormal => {
65 push_directive(tokens, "L2::evict_normal");
66 }
67 LevelEvictionPriority::L2EvictLast => {
68 push_directive(tokens, "L2::evict_last");
69 }
70 }
71 if spaced {
72 tokens.push(PtxToken::Space);
73 }
74 self.a.unparse_tokens_mode(tokens, spaced);
75 tokens.push(PtxToken::Semicolon);
76 if spaced {
77 tokens.push(PtxToken::Newline);
78 }
79 }
80 }
81
82 impl PtxUnparser for PrefetchuL1 {
83 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
84 self.unparse_tokens_mode(tokens, false);
85 }
86 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
87 push_opcode(tokens, "prefetchu");
88 push_directive(tokens, "L1");
89 if spaced {
90 tokens.push(PtxToken::Space);
91 }
92 self.a.unparse_tokens_mode(tokens, spaced);
93 tokens.push(PtxToken::Semicolon);
94 if spaced {
95 tokens.push(PtxToken::Newline);
96 }
97 }
98 }
99
100 impl PtxUnparser for PrefetchTensormapSpaceTensormap {
101 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
102 self.unparse_tokens_mode(tokens, false);
103 }
104 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
105 push_opcode(tokens, "prefetch");
106 if let Some(tensormap_space_1) = self.tensormap_space.as_ref() {
107 match tensormap_space_1 {
108 TensormapSpace::Const => {
109 push_directive(tokens, "const");
110 }
111 TensormapSpace::Param => {
112 push_directive(tokens, "param");
113 }
114 }
115 }
116 push_directive(tokens, "tensormap");
117 if spaced {
118 tokens.push(PtxToken::Space);
119 }
120 self.a.unparse_tokens_mode(tokens, spaced);
121 tokens.push(PtxToken::Semicolon);
122 if spaced {
123 tokens.push(PtxToken::Newline);
124 }
125 }
126 }
127}