Skip to content

Commit f29d886

Browse files
committed
📝 Add dcos to compiler
1 parent 0d4f5a0 commit f29d886

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

include/na/zoned/Compiler.hpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@
3131

3232
namespace na::zoned {
3333
#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+
*/
3445
template <class ConcreteType, class Scheduler, class ReuseAnalyzer,
3546
class Placer, class Router, class CodeGenerator>
3647
class Compiler : protected Scheduler,
@@ -41,6 +52,10 @@ class Compiler : protected Scheduler,
4152
friend ConcreteType;
4253

4354
public:
55+
/**
56+
* Collection of the configuration parameters for the different components
57+
* of the compiler.
58+
*/
4459
struct Config {
4560
typename Scheduler::Config schedulerConfig{};
4661
typename ReuseAnalyzer::Config reuseAnalyzerConfig{};
@@ -53,6 +68,10 @@ class Compiler : protected Scheduler,
5368
placerConfig, routerConfig,
5469
codeGeneratorConfig, logLevel);
5570
};
71+
/**
72+
* Collection of statistics collected during the compilation process for the
73+
* different components.
74+
*/
5675
struct Statistics {
5776
std::chrono::microseconds schedulingTime;
5877
std::chrono::microseconds reuseAnalysisTime;
@@ -72,6 +91,13 @@ class Compiler : protected Scheduler,
7291
nlohmann::json config_;
7392
Statistics statistics_;
7493

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+
*/
75101
Compiler(const Architecture& architecture, const Config& config)
76102
: Scheduler(architecture, config.schedulerConfig),
77103
ReuseAnalyzer(architecture, config.reuseAnalyzerConfig),
@@ -82,10 +108,23 @@ class Compiler : protected Scheduler,
82108
spdlog::set_level(config.logLevel);
83109
}
84110

111+
/**
112+
* Construct a Compiler instance with the given architecture and
113+
* default configuration.
114+
*
115+
* @param architecture The architecture to compile for.
116+
*/
85117
explicit Compiler(const Architecture& architecture)
86118
: Compiler(architecture, {}) {}
87119

88120
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+
*/
89128
[[nodiscard]] auto compile(const qc::QuantumComputation& qComp)
90129
-> NAComputation {
91130
SPDLOG_INFO("*** MQT QMAP Zoned Neutral Atom Compiler ***");
@@ -188,6 +227,7 @@ class Compiler : protected Scheduler,
188227
SPDLOG_INFO("Total time: {}us", statistics_.totalTime.count());
189228
return code;
190229
}
230+
/// @return the statistics collected during the compilation process.
191231
[[nodiscard]] auto getStatistics() const -> const Statistics& {
192232
return statistics_;
193233
}

0 commit comments

Comments
 (0)