ptx_parser/type/instruction/createpolicy.rs
1//! Original PTX specification:
2//!
3//! // Range-based policy
4//! createpolicy.range{.global}.level::primary_priority{.level::secondary_priority}.b64
5//! cache-policy, [a], primary-size, total-size;
6//! // Fraction-based policy
7//! createpolicy.fractional.level::primary_priority{.level::secondary_priority}.b64
8//! cache-policy{, fraction};
9//! // Converting the access property from CUDA APIs
10//! createpolicy.cvt.L2.b64 cache-policy, access-property;
11//! .level::primary_priority = { .L2::evict_last, .L2::evict_normal,
12//! .L2::evict_first, .L2::evict_unchanged };
13//! .level::secondary_priority = { .L2::evict_first, .L2::evict_unchanged };
14
15#![allow(unused)]
16use crate::r#type::common::*;
17
18pub mod section_0 {
19 use crate::Spanned;
20 use crate::parser::Span;
21 use crate::r#type::common::*;
22
23 use serde::Serialize;
24
25 #[derive(Debug, Clone, PartialEq, Serialize)]
26 pub enum LevelPrimaryPriority {
27 L2EvictUnchanged, // .L2::evict_unchanged
28 L2EvictNormal, // .L2::evict_normal
29 L2EvictFirst, // .L2::evict_first
30 L2EvictLast, // .L2::evict_last
31 }
32
33 #[derive(Debug, Clone, PartialEq, Serialize)]
34 pub enum LevelSecondaryPriority {
35 L2EvictUnchanged, // .L2::evict_unchanged
36 L2EvictFirst, // .L2::evict_first
37 }
38
39 #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
40 pub struct CreatepolicyRangeGlobalLevelPrimaryPriorityLevelSecondaryPriorityB64 {
41 pub range: (), // .range
42 pub global: bool, // {.global}
43 pub level_primary_priority: LevelPrimaryPriority, // .level::primary_priority
44 pub level_secondary_priority: Option<LevelSecondaryPriority>, // {.level::secondary_priority}
45 pub b64: (), // .b64
46 pub cache_policy: GeneralOperand, // cache-policy
47 pub a: AddressOperand, // [a]
48 pub primary_size: GeneralOperand, // primary-size
49 pub total_size: GeneralOperand, // total-size
50 pub span: Span,
51 }
52
53 #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
54 pub struct CreatepolicyFractionalLevelPrimaryPriorityLevelSecondaryPriorityB64 {
55 pub fractional: (), // .fractional
56 pub level_primary_priority: LevelPrimaryPriority, // .level::primary_priority
57 pub level_secondary_priority: Option<LevelSecondaryPriority>, // {.level::secondary_priority}
58 pub b64: (), // .b64
59 pub cache_policy: GeneralOperand, // cache-policy
60 pub fraction: Option<GeneralOperand>, // {, fraction}
61 pub span: Span,
62 }
63
64 #[derive(Debug, Clone, PartialEq, Spanned, Serialize)]
65 pub struct CreatepolicyCvtL2B64 {
66 pub cvt: (), // .cvt
67 pub l2: (), // .L2
68 pub b64: (), // .b64
69 pub cache_policy: GeneralOperand, // cache-policy
70 pub access_property: GeneralOperand, // access-property
71 pub span: Span,
72 }
73}
74
75// Re-export types with section suffixes to avoid naming conflicts
76// e.g., Type0 for section_0::Type, Type1 for section_1::Type
77pub use section_0::CreatepolicyCvtL2B64;
78pub use section_0::CreatepolicyFractionalLevelPrimaryPriorityLevelSecondaryPriorityB64;
79pub use section_0::CreatepolicyRangeGlobalLevelPrimaryPriorityLevelSecondaryPriorityB64;
80pub use section_0::LevelPrimaryPriority as LevelPrimaryPriority0;
81pub use section_0::LevelSecondaryPriority as LevelSecondaryPriority0;