31
31
32
32
namespace na ::zoned {
33
33
#define SELF (*static_cast <ConcreteType*>(this ))
34
+
35
+ /* * @brief Compiler class that combines various components to compile quantum
36
+ * circuits for neutral atom architectures.
37
+ *
38
+ * @details This class is a template that allows for different implementations
39
+ * of the scheduler, reuse analyzer, placer, router, and code generator. It
40
+ * provides a unified interface to compile quantum computations into
41
+ * NAComputation objects. The components are linked together at compile time,
42
+ * allowing for better performance than having the components as members of the
43
+ * compiler and setting them at runtime.
44
+ */
34
45
template <class ConcreteType , class Scheduler , class ReuseAnalyzer ,
35
46
class Placer , class Router , class CodeGenerator >
36
47
class Compiler : protected Scheduler ,
@@ -41,6 +52,10 @@ class Compiler : protected Scheduler,
41
52
friend ConcreteType;
42
53
43
54
public:
55
+ /* *
56
+ * Collection of the configuration parameters for the different components
57
+ * of the compiler.
58
+ */
44
59
struct Config {
45
60
typename Scheduler::Config schedulerConfig{};
46
61
typename ReuseAnalyzer::Config reuseAnalyzerConfig{};
@@ -53,6 +68,10 @@ class Compiler : protected Scheduler,
53
68
placerConfig, routerConfig,
54
69
codeGeneratorConfig, logLevel);
55
70
};
71
+ /* *
72
+ * Collection of statistics collected during the compilation process for the
73
+ * different components.
74
+ */
56
75
struct Statistics {
57
76
std::chrono::microseconds schedulingTime;
58
77
std::chrono::microseconds reuseAnalysisTime;
@@ -72,6 +91,13 @@ class Compiler : protected Scheduler,
72
91
nlohmann::json config_;
73
92
Statistics statistics_;
74
93
94
+ /* *
95
+ * Construct a Compiler instance with the given architecture and
96
+ * configuration.
97
+ *
98
+ * @param architecture The architecture to compile for.
99
+ * @param config The configuration for the compiler.
100
+ */
75
101
Compiler (const Architecture& architecture, const Config& config)
76
102
: Scheduler(architecture, config.schedulerConfig),
77
103
ReuseAnalyzer (architecture, config.reuseAnalyzerConfig),
@@ -82,10 +108,23 @@ class Compiler : protected Scheduler,
82
108
spdlog::set_level (config.logLevel );
83
109
}
84
110
111
+ /* *
112
+ * Construct a Compiler instance with the given architecture and
113
+ * default configuration.
114
+ *
115
+ * @param architecture The architecture to compile for.
116
+ */
85
117
explicit Compiler (const Architecture& architecture)
86
118
: Compiler(architecture, {}) {}
87
119
88
120
public:
121
+ /* *
122
+ * Compile a quantum computation into a neutral atom computation.
123
+ *
124
+ * @param qComp is the quantum computation to compile.
125
+ * @return an NAComputation object that represents the compiled quantum
126
+ * circuit.
127
+ */
89
128
[[nodiscard]] auto compile (const qc::QuantumComputation& qComp)
90
129
-> NAComputation {
91
130
SPDLOG_INFO (" *** MQT QMAP Zoned Neutral Atom Compiler ***" );
@@ -188,6 +227,7 @@ class Compiler : protected Scheduler,
188
227
SPDLOG_INFO (" Total time: {}us" , statistics_.totalTime .count ());
189
228
return code;
190
229
}
230
+ // / @return the statistics collected during the compilation process.
191
231
[[nodiscard]] auto getStatistics () const -> const Statistics& {
192
232
return statistics_;
193
233
}
0 commit comments