1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! Original PTX specification:
//!
//! // Range-based policy
//! createpolicy.range{.global}.level::primary_priority{.level::secondary_priority}.b64
//! cache-policy, [a], primary-size, total-size;
//! // Fraction-based policy
//! createpolicy.fractional.level::primary_priority{.level::secondary_priority}.b64
//! cache-policy{, fraction};
//! // Converting the access property from CUDA APIs
//! createpolicy.cvt.L2.b64 cache-policy, access-property;
//! .level::primary_priority = { .L2::evict_last, .L2::evict_normal,
//! .L2::evict_first, .L2::evict_unchanged };
//! .level::secondary_priority = { .L2::evict_first, .L2::evict_unchanged };
#![allow(unused)]
use crate::lexer::PtxToken;
use crate::unparser::{PtxUnparser, common::*};
pub mod section_0 {
use super::*;
use crate::r#type::instruction::createpolicy::section_0::*;
impl PtxUnparser for CreatepolicyRangeGlobalLevelPrimaryPriorityLevelSecondaryPriorityB64 {
fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
push_opcode(tokens, "createpolicy");
push_directive(tokens, "range");
if self.global {
push_directive(tokens, "global");
}
match &self.level_primary_priority {
LevelPrimaryPriority::L2EvictUnchanged => {
push_directive(tokens, "L2::evict_unchanged");
}
LevelPrimaryPriority::L2EvictNormal => {
push_directive(tokens, "L2::evict_normal");
}
LevelPrimaryPriority::L2EvictFirst => {
push_directive(tokens, "L2::evict_first");
}
LevelPrimaryPriority::L2EvictLast => {
push_directive(tokens, "L2::evict_last");
}
}
if let Some(level_secondary_priority_0) = self.level_secondary_priority.as_ref() {
match level_secondary_priority_0 {
LevelSecondaryPriority::L2EvictUnchanged => {
push_directive(tokens, "L2::evict_unchanged");
}
LevelSecondaryPriority::L2EvictFirst => {
push_directive(tokens, "L2::evict_first");
}
}
}
push_directive(tokens, "b64");
self.cache_policy.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.a.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.primary_size.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.total_size.unparse_tokens(tokens);
tokens.push(PtxToken::Semicolon);
}
}
impl PtxUnparser for CreatepolicyFractionalLevelPrimaryPriorityLevelSecondaryPriorityB64 {
fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
push_opcode(tokens, "createpolicy");
push_directive(tokens, "fractional");
match &self.level_primary_priority {
LevelPrimaryPriority::L2EvictUnchanged => {
push_directive(tokens, "L2::evict_unchanged");
}
LevelPrimaryPriority::L2EvictNormal => {
push_directive(tokens, "L2::evict_normal");
}
LevelPrimaryPriority::L2EvictFirst => {
push_directive(tokens, "L2::evict_first");
}
LevelPrimaryPriority::L2EvictLast => {
push_directive(tokens, "L2::evict_last");
}
}
if let Some(level_secondary_priority_1) = self.level_secondary_priority.as_ref() {
match level_secondary_priority_1 {
LevelSecondaryPriority::L2EvictUnchanged => {
push_directive(tokens, "L2::evict_unchanged");
}
LevelSecondaryPriority::L2EvictFirst => {
push_directive(tokens, "L2::evict_first");
}
}
}
push_directive(tokens, "b64");
self.cache_policy.unparse_tokens(tokens);
if self.fraction.is_some() { tokens.push(PtxToken::Comma); }
if let Some(opt_2) = self.fraction.as_ref() {
opt_2.unparse_tokens(tokens);
}
tokens.push(PtxToken::Semicolon);
}
}
impl PtxUnparser for CreatepolicyCvtL2B64 {
fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
push_opcode(tokens, "createpolicy");
push_directive(tokens, "cvt");
push_directive(tokens, "L2");
push_directive(tokens, "b64");
self.cache_policy.unparse_tokens(tokens);
tokens.push(PtxToken::Comma);
self.access_property.unparse_tokens(tokens);
tokens.push(PtxToken::Semicolon);
}
}
}