sys-sage
Loading...
Searching...
No Matches
enums.hpp
1#ifndef ENUMS_HPP
2#define ENUMS_HPP
3
4#include <cstdint>
5#include <unordered_map>
6
7
8namespace sys_sage {
9
13
22 namespace ComponentType{
23 using type = int32_t;
24
25 constexpr type None = 1;
26 constexpr type Thread = 2;
27 constexpr type Core = 3;
28 constexpr type Cache = 4;
29 constexpr type Subdivision = 5;
30 constexpr type Numa = 6;
31 constexpr type Chip = 7;
32 constexpr type Memory = 8;
33 constexpr type Storage = 9;
34 constexpr type Node = 10;
35 constexpr type QuantumBackend = 11;
36 constexpr type AtomSite = 12;
37 constexpr type Qubit = 13;
38 constexpr type Topology = 14;
40 //SVTODO this should remain private???
41 static const std::unordered_map<type, const char*> names = {
42 {None, "GenericComponent"},
43 {Thread, "HW_Thread"},
44 {Core, "Core"},
45 {Cache, "Cache"},
46 {Subdivision, "Subdivision"},
47 {Numa, "NUMA"},
48 {Chip, "Chip"},
49 {Memory, "Memory"},
50 {Storage, "Storage"},
51 {Node, "Node"},
52 {QuantumBackend, "QuantumBackend"},
53 {AtomSite, "AtomSite"},
54 {Qubit, "Qubit"},
55 {Topology, "Topology"}
56 };
57
66 inline const char* ToString(type rt) {
67 auto it = names.find(rt);
68 if (it != names.end()) return it->second;
69 return "Unknown";
70 }
71 }
72
77 namespace SubdivisionType {
78 using type = int32_t;
79
80 constexpr type None = 1;
81 constexpr type GpuSM = 2;
82 }
83
88 namespace ChipType {
89 using type = int32_t;
90
91 constexpr type None = 1;
92 constexpr type Cpu = 2;
93 constexpr type CpuSocket = 3;
94 constexpr type Gpu = 4;
95 }
96
100
107 namespace RelationType{
108 using type = int32_t;
109
110 constexpr type Any = -1;
111 constexpr type Relation = 0;
112 constexpr type DataPath = 1;
113 constexpr type QuantumGate = 2;
114 constexpr type CouplingMap = 3;
115 constexpr type _num_relation_types = 4;
116
117 constexpr type RelationTypeList [_num_relation_types] = {
118 Relation,
119 DataPath,
120 QuantumGate,
121 CouplingMap
122 };
123
124 //SVTODO this should remain private???
125 static const std::unordered_map<type, const char*> names = {
126 {Any, "Any"},
127 {Relation, "Relation"},
128 {DataPath, "DataPath"},
129 {QuantumGate, "QuantumGate"},
130 {CouplingMap, "CouplingMap"}
131 };
132
140 inline const char* ToString(type rt) {
141 auto it = names.find(rt);
142 if (it != names.end()) return it->second;
143 return "Unknown";
144 }
145 }
146
153 namespace DataPathType{
154 using type = int32_t;
155
156 constexpr type Any = 1;
157 constexpr type None = 0;
158 constexpr type Logical = 1;
159 constexpr type Physical = 2;
160 constexpr type Datatransfer = 3;
161 constexpr type L3CAT = 4;
162 constexpr type MIG = 5;
163 constexpr type C2C = 6;
164 }
169 namespace DataPathDirection{
170 using type = int32_t;
171
172 constexpr type Any = 1;
173 constexpr type Outgoing = 2;
174 constexpr type Incoming = 3;
175 }
176
177 //SVTODO rename this to RelationOrientation? oriented x not oriented and include this also into general Relation, rather than just DataPath?
182 namespace DataPathOrientation{
183 using type = int32_t;
184
185 constexpr type Oriented = 1;
186 constexpr type Bidirectional = 2;
187 }
192 namespace QuantumGateType{
193 using type = int32_t;
194
195 constexpr type Unknown = 0;
196 constexpr type Id = 1;
197 constexpr type X = 2;
198 constexpr type Rz = 3;
199 constexpr type Cnot = 4;
200 constexpr type Sx = 5;
201 constexpr type Toffoli = 6;
203 //SVTODO this should remain private???
204 static const std::unordered_map<type, const char*> names = {
205 {Unknown, "Unknown"},
206 {Id, "Id"},
207 {X, "X"},
208 {Rz, "Rz"},
209 {Cnot, "Cnot"},
210 {Sx, "Sx"},
211 {Toffoli, "Toffoli"}
212 };
213
220 inline const char* ToString(type rt) {
221 auto it = names.find(rt);
222 if (it != names.end()) return it->second;
223 return "Unknown";
224 }
225 }
226
227
228}
229#endif //ENUMS_HPP
Enumerates chip types (CPU, GPU, etc.).
Enumerates all supported component types in sys-sage.
Enumerates directionality for DataPaths.
Enumerates orientation (directed/bidirectional) for DataPaths.
Enumerates types of DataPaths (logical, physical, etc.).
Enumerates quantum gate types.
Enumerates all supported relation types in sys-sage.
Enumerates subdivision types for components (e.g., GPU SMs).