ptx_parser/type/instruction/
prefetch.rs

1//! Original PTX specification:
2//!
3//! prefetch{.space}.level                    [a];   // prefetch to data cache
4//! prefetch.global.level::eviction_priority  [a];   // prefetch to data cache
5//! prefetchu.L1  [a];             // prefetch to uniform cache
6//! prefetch{.tensormap_space}.tensormap [a];  // prefetch the tensormap
7//! .space =                    { .global, .local };
8//! .level =                    { .L1, .L2 };
9//! .level::eviction_priority = { .L2::evict_last, .L2::evict_normal };
10//! .tensormap_space =          { .const, .param };
11
12#![allow(unused)]
13use crate::r#type::common::*;
14
15pub mod section_0 {
16    use crate::r#type::common::*;
17
18    #[derive(Debug, Clone, PartialEq)]
19    pub enum Space {
20        Global, // .global
21        Local,  // .local
22    }
23
24    #[derive(Debug, Clone, PartialEq)]
25    pub enum Level {
26        L1, // .L1
27        L2, // .L2
28    }
29
30    #[derive(Debug, Clone, PartialEq)]
31    pub enum LevelEvictionPriority {
32        L2EvictNormal, // .L2::evict_normal
33        L2EvictLast,   // .L2::evict_last
34    }
35
36    #[derive(Debug, Clone, PartialEq)]
37    pub enum TensormapSpace {
38        Const, // .const
39        Param, // .param
40    }
41
42    #[derive(Debug, Clone, PartialEq)]
43    pub struct PrefetchSpaceLevel {
44        pub space: Option<Space>, // {.space}
45        pub level: Level,         // .level
46        pub a: AddressOperand,    // [a]
47    }
48
49    #[derive(Debug, Clone, PartialEq)]
50    pub struct PrefetchGlobalLevelEvictionPriority {
51        pub global: (),                                     // .global
52        pub level_eviction_priority: LevelEvictionPriority, // .level::eviction_priority
53        pub a: AddressOperand,                              // [a]
54    }
55
56    #[derive(Debug, Clone, PartialEq)]
57    pub struct PrefetchuL1 {
58        pub l1: (),            // .L1
59        pub a: AddressOperand, // [a]
60    }
61
62    #[derive(Debug, Clone, PartialEq)]
63    pub struct PrefetchTensormapSpaceTensormap {
64        pub tensormap_space: Option<TensormapSpace>, // {.tensormap_space}
65        pub tensormap: (),                           // .tensormap
66        pub a: AddressOperand,                       // [a]
67    }
68}
69
70// Re-export types with section suffixes to avoid naming conflicts
71// e.g., Type0 for section_0::Type, Type1 for section_1::Type
72pub use section_0::Level as Level0;
73pub use section_0::LevelEvictionPriority as LevelEvictionPriority0;
74pub use section_0::PrefetchGlobalLevelEvictionPriority;
75pub use section_0::PrefetchSpaceLevel;
76pub use section_0::PrefetchTensormapSpaceTensormap;
77pub use section_0::PrefetchuL1;
78pub use section_0::Space as Space0;
79pub use section_0::TensormapSpace as TensormapSpace0;