16
16
* Defines kernel functions for all AVX
17
17
*/
18
18
#pragma once
19
-
20
- // General implementations
21
- #include " Macros.hpp"
22
-
23
- #ifdef PL_USE_AVX2
24
- #include " avx_common/AVX2Concept.hpp"
25
- #endif
26
- #ifdef PL_USE_AVX512F
27
- #include " avx_common/AVX512Concept.hpp"
28
- #endif
29
- #include " avx_common/ApplyCNOT.hpp"
30
- #include " avx_common/ApplyCZ.hpp"
31
- #include " avx_common/ApplyHadamard.hpp"
32
- #include " avx_common/ApplyIsingXX.hpp"
33
- #include " avx_common/ApplyIsingYY.hpp"
34
- #include " avx_common/ApplyIsingZZ.hpp"
35
- #include " avx_common/ApplyPauliX.hpp"
36
- #include " avx_common/ApplyPauliY.hpp"
37
- #include " avx_common/ApplyPauliZ.hpp"
38
- #include " avx_common/ApplyPhaseShift.hpp"
39
- #include " avx_common/ApplyRX.hpp"
40
- #include " avx_common/ApplyRY.hpp"
41
- #include " avx_common/ApplyRZ.hpp"
42
- #include " avx_common/ApplyS.hpp"
43
- #include " avx_common/ApplySWAP.hpp"
44
- #include " avx_common/ApplySingleQubitOp.hpp"
45
- #include " avx_common/ApplyT.hpp"
19
+ #include " avx_common/AVXGateKernels.hpp"
46
20
#include " avx_common/SingleQubitGateHelper.hpp"
47
21
#include " avx_common/TwoQubitGateHelper.hpp"
48
22
@@ -91,7 +65,7 @@ class GateImplementationsAVXCommon
91
65
std::is_same_v<PrecisionT, double >,
92
66
" Only float and double are supported." );
93
67
94
- assert (wires.size () == 1 );
68
+ PL_ASSERT (wires.size () == 1 );
95
69
auto helper =
96
70
AVXCommon::SingleQubitGateWithoutParamHelper<ApplyPauliXAVX>(
97
71
&GateImplementationsLM::applyPauliX);
@@ -110,7 +84,7 @@ class GateImplementationsAVXCommon
110
84
std::is_same_v<PrecisionT, double >,
111
85
" Only float and double are supported." );
112
86
113
- assert (wires.size () == 1 );
87
+ PL_ASSERT (wires.size () == 1 );
114
88
auto helper =
115
89
AVXCommon::SingleQubitGateWithoutParamHelper<ApplyPauliYAVX>(
116
90
&GateImplementationsLM::applyPauliY);
@@ -129,7 +103,7 @@ class GateImplementationsAVXCommon
129
103
std::is_same_v<PrecisionT, double >,
130
104
" Only float and double are supported." );
131
105
132
- assert (wires.size () == 1 );
106
+ PL_ASSERT (wires.size () == 1 );
133
107
auto helper =
134
108
AVXCommon::SingleQubitGateWithoutParamHelper<ApplyPauliZAVX>(
135
109
&GateImplementationsLM::applyPauliZ);
@@ -161,7 +135,7 @@ class GateImplementationsAVXCommon
161
135
std::is_same_v<PrecisionT, double >,
162
136
" Only float and double are supported." );
163
137
164
- assert (wires.size () == 1 );
138
+ PL_ASSERT (wires.size () == 1 );
165
139
auto helper = AVXCommon::SingleQubitGateWithoutParamHelper<ApplyTAVX>(
166
140
&GateImplementationsLM::applyT);
167
141
helper (arr, num_qubits, wires, inverse);
@@ -179,7 +153,7 @@ class GateImplementationsAVXCommon
179
153
std::is_same_v<PrecisionT, double >,
180
154
" Only float and double are supported." );
181
155
182
- assert (wires.size () == 1 );
156
+ PL_ASSERT (wires.size () == 1 );
183
157
auto helper =
184
158
AVXCommon::SingleQubitGateWithParamHelper<ApplyPhaseShiftAVX,
185
159
ParamT>(
@@ -198,7 +172,7 @@ class GateImplementationsAVXCommon
198
172
static_assert (std::is_same_v<PrecisionT, float > ||
199
173
std::is_same_v<PrecisionT, double >,
200
174
" Only float and double are supported." );
201
- assert (wires.size () == 1 );
175
+ PL_ASSERT (wires.size () == 1 );
202
176
auto helper =
203
177
AVXCommon::SingleQubitGateWithoutParamHelper<ApplyHadamardAVX>(
204
178
&GateImplementationsLM::applyHadamard);
@@ -215,7 +189,7 @@ class GateImplementationsAVXCommon
215
189
static_assert (std::is_same_v<PrecisionT, float > ||
216
190
std::is_same_v<PrecisionT, double >,
217
191
" Only float and double are supported." );
218
- assert (wires.size () == 1 );
192
+ PL_ASSERT (wires.size () == 1 );
219
193
auto helper =
220
194
AVXCommon::SingleQubitGateWithParamHelper<ApplyRXAVX, ParamT>(
221
195
&GateImplementationsLM::applyRX);
@@ -232,7 +206,7 @@ class GateImplementationsAVXCommon
232
206
static_assert (std::is_same_v<PrecisionT, float > ||
233
207
std::is_same_v<PrecisionT, double >,
234
208
" Only float and double are supported." );
235
- assert (wires.size () == 1 );
209
+ PL_ASSERT (wires.size () == 1 );
236
210
auto helper =
237
211
AVXCommon::SingleQubitGateWithParamHelper<ApplyRYAVX, ParamT>(
238
212
&GateImplementationsLM::applyRY);
@@ -249,7 +223,7 @@ class GateImplementationsAVXCommon
249
223
static_assert (std::is_same_v<PrecisionT, float > ||
250
224
std::is_same_v<PrecisionT, double >,
251
225
" Only float and double are supported." );
252
- assert (wires.size () == 1 );
226
+ PL_ASSERT (wires.size () == 1 );
253
227
auto helper =
254
228
AVXCommon::SingleQubitGateWithParamHelper<ApplyRZAVX, ParamT>(
255
229
&GateImplementationsLM::applyRZ);
@@ -260,7 +234,7 @@ class GateImplementationsAVXCommon
260
234
static void applyRot (std::complex<PrecisionT> *arr, const size_t num_qubits,
261
235
const std::vector<size_t > &wires, bool inverse,
262
236
ParamT phi, ParamT theta, ParamT omega) {
263
- assert (wires.size () == 1 );
237
+ PL_ASSERT (wires.size () == 1 );
264
238
265
239
const auto rotMat =
266
240
(inverse) ? Gates::getRot<PrecisionT>(-omega, -theta, -phi)
@@ -282,7 +256,7 @@ class GateImplementationsAVXCommon
282
256
std::is_same_v<PrecisionT, double >,
283
257
" Only float and double are supported." );
284
258
285
- assert (wires.size () == 2 );
259
+ PL_ASSERT (wires.size () == 2 );
286
260
287
261
const AVXCommon::TwoQubitGateWithoutParamHelper<ApplyCZAVX> gate_helper (
288
262
&GateImplementationsLM::applyCZ<PrecisionT>);
@@ -302,7 +276,7 @@ class GateImplementationsAVXCommon
302
276
std::is_same_v<PrecisionT, double >,
303
277
" Only float and double are supported." );
304
278
305
- assert (wires.size () == 2 );
279
+ PL_ASSERT (wires.size () == 2 );
306
280
307
281
const AVXCommon::TwoQubitGateWithoutParamHelper<ApplySWAPAVX>
308
282
gate_helper (&GateImplementationsLM::applySWAP<PrecisionT>);
@@ -314,7 +288,7 @@ class GateImplementationsAVXCommon
314
288
static void
315
289
applyCNOT (std::complex<PrecisionT> *arr, const size_t num_qubits,
316
290
const std::vector<size_t > &wires, [[maybe_unused]] bool inverse) {
317
- assert (wires.size () == 2 );
291
+ PL_ASSERT (wires.size () == 2 );
318
292
319
293
using ApplyCNOTAVX =
320
294
AVXCommon::ApplyCNOT<PrecisionT,
@@ -327,7 +301,7 @@ class GateImplementationsAVXCommon
327
301
std::is_same_v<PrecisionT, double >,
328
302
" Only float and double are supported." );
329
303
330
- assert (wires.size () == 2 );
304
+ PL_ASSERT (wires.size () == 2 );
331
305
332
306
const AVXCommon::TwoQubitGateWithoutParamHelper<ApplyCNOTAVX>
333
307
gate_helper (&GateImplementationsLM::applyCNOT<PrecisionT>);
@@ -340,7 +314,7 @@ class GateImplementationsAVXCommon
340
314
const size_t num_qubits,
341
315
const std::vector<size_t > &wires,
342
316
[[maybe_unused]] bool inverse, ParamT angle) {
343
- assert (wires.size () == 2 );
317
+ PL_ASSERT (wires.size () == 2 );
344
318
345
319
using ApplyIsingXXAVX =
346
320
AVXCommon::ApplyIsingXX<PrecisionT,
@@ -362,7 +336,7 @@ class GateImplementationsAVXCommon
362
336
const size_t num_qubits,
363
337
const std::vector<size_t > &wires,
364
338
[[maybe_unused]] bool inverse, ParamT angle) {
365
- assert (wires.size () == 2 );
339
+ PL_ASSERT (wires.size () == 2 );
366
340
367
341
using ApplyIsingYYAVX =
368
342
AVXCommon::ApplyIsingYY<PrecisionT,
@@ -392,7 +366,7 @@ class GateImplementationsAVXCommon
392
366
std::is_same_v<PrecisionT, double >,
393
367
" Only float and double are supported." );
394
368
395
- assert (wires.size () == 2 );
369
+ PL_ASSERT (wires.size () == 2 );
396
370
397
371
const AVXCommon::TwoQubitGateWithParamHelper<ApplyIsingZZAVX, ParamT>
398
372
gate_helper (
0 commit comments