spla
Loading...
Searching...
No Matches
schedule_tasks.hpp
Go to the documentation of this file.
1/**********************************************************************************/
2/* This file is part of spla project */
3/* https://github.com/SparseLinearAlgebra/spla */
4/**********************************************************************************/
5/* MIT License */
6/* */
7/* Copyright (c) 2023 SparseLinearAlgebra */
8/* */
9/* Permission is hereby granted, free of charge, to any person obtaining a copy */
10/* of this software and associated documentation files (the "Software"), to deal */
11/* in the Software without restriction, including without limitation the rights */
12/* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell */
13/* copies of the Software, and to permit persons to whom the Software is */
14/* furnished to do so, subject to the following conditions: */
15/* */
16/* The above copyright notice and this permission notice shall be included in all */
17/* copies or substantial portions of the Software. */
18/* */
19/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
20/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
21/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
22/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
23/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
24/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
25/* SOFTWARE. */
26/**********************************************************************************/
27
28#ifndef SPLA_SCHEDULE_TASKS_HPP
29#define SPLA_SCHEDULE_TASKS_HPP
30
31#include <spla/exec.hpp>
32#include <spla/schedule.hpp>
33
35
36namespace spla {
37
48 public:
49 ~ScheduleTaskBase() override = default;
50
51 void set_label(std::string label) override;
52 const std::string& get_label() const override;
55
56 std::string label;
58 };
59
65 public:
66 ~ScheduleTask_callback() override = default;
67
68 std::string get_name() override;
69 std::string get_key() override;
70 std::string get_key_full() override;
71 std::vector<ref_ptr<Object>> get_args() override;
72
74 };
75
80 class ScheduleTask_mxm final : public ScheduleTaskBase {
81 public:
82 ~ScheduleTask_mxm() override = default;
83
84 std::string get_name() override;
85 std::string get_key() override;
86 std::string get_key_full() override;
87 std::vector<ref_ptr<Object>> get_args() override;
88
95 };
96
102 public:
103 ~ScheduleTask_mxmT_masked() override = default;
104
105 std::string get_name() override;
106 std::string get_key() override;
107 std::string get_key_full() override;
108 std::vector<ref_ptr<Object>> get_args() override;
109
118 };
119
124 class ScheduleTask_kron final : public ScheduleTaskBase {
125 public:
126 ~ScheduleTask_kron() override = default;
127
128 std::string get_name() override;
129 std::string get_key() override;
130 std::string get_key_full() override;
131 std::vector<ref_ptr<Object>> get_args() override;
132
137 };
138
144 public:
145 ~ScheduleTask_mxv_masked() override = default;
146
147 std::string get_name() override;
148 std::string get_key() override;
149 std::string get_key_full() override;
150 std::vector<ref_ptr<Object>> get_args() override;
151
160 };
161
167 public:
168 ~ScheduleTask_vxm_masked() override = default;
169
170 std::string get_name() override;
171 std::string get_key() override;
172 std::string get_key_full() override;
173 std::vector<ref_ptr<Object>> get_args() override;
174
183 };
184
190 public:
191 ~ScheduleTask_m_eadd() override = default;
192
193 std::string get_name() override;
194 std::string get_key() override;
195 std::string get_key_full() override;
196 std::vector<ref_ptr<Object>> get_args() override;
197
202 };
203
209 public:
210 ~ScheduleTask_m_emult() override = default;
211
212 std::string get_name() override;
213 std::string get_key() override;
214 std::string get_key_full() override;
215 std::vector<ref_ptr<Object>> get_args() override;
216
221 };
222
228 public:
229 ~ScheduleTask_m_reduce_by_row() override = default;
230
231 std::string get_name() override;
232 std::string get_key() override;
233 std::string get_key_full() override;
234 std::vector<ref_ptr<Object>> get_args() override;
235
240 };
241
247 public:
249
250 std::string get_name() override;
251 std::string get_key() override;
252 std::string get_key_full() override;
253 std::vector<ref_ptr<Object>> get_args() override;
254
259 };
260
266 public:
267 ~ScheduleTask_m_reduce() override = default;
268
269 std::string get_name() override;
270 std::string get_key() override;
271 std::string get_key_full() override;
272 std::vector<ref_ptr<Object>> get_args() override;
273
278 };
279
285 public:
286 ~ScheduleTask_m_transpose() override = default;
287
288 std::string get_name() override;
289 std::string get_key() override;
290 std::string get_key_full() override;
291 std::vector<ref_ptr<Object>> get_args() override;
292
296 };
297
303 public:
304 ~ScheduleTask_m_extract_row() override = default;
305
306 std::string get_name() override;
307 std::string get_key() override;
308 std::string get_key_full() override;
309 std::vector<ref_ptr<Object>> get_args() override;
310
315 };
316
322 public:
323 ~ScheduleTask_m_extract_column() override = default;
324
325 std::string get_name() override;
326 std::string get_key() override;
327 std::string get_key_full() override;
328 std::vector<ref_ptr<Object>> get_args() override;
329
334 };
335
341 public:
342 ~ScheduleTask_v_eadd() override = default;
343
344 std::string get_name() override;
345 std::string get_key() override;
346 std::string get_key_full() override;
347 std::vector<ref_ptr<Object>> get_args() override;
348
353 };
354
360 public:
361 ~ScheduleTask_v_emult() override = default;
362
363 std::string get_name() override;
364 std::string get_key() override;
365 std::string get_key_full() override;
366 std::vector<ref_ptr<Object>> get_args() override;
367
372 };
373
379 public:
380 ~ScheduleTask_v_eadd_fdb() override = default;
381
382 std::string get_name() override;
383 std::string get_key() override;
384 std::string get_key_full() override;
385 std::vector<ref_ptr<Object>> get_args() override;
386
391 };
392
398 public:
399 ~ScheduleTask_v_assign_masked() override = default;
400
401 std::string get_name() override;
402 std::string get_key() override;
403 std::string get_key_full() override;
404 std::vector<ref_ptr<Object>> get_args() override;
405
411 };
412
418 public:
419 ~ScheduleTask_v_map() override = default;
420
421 std::string get_name() override;
422 std::string get_key() override;
423 std::string get_key_full() override;
424 std::vector<ref_ptr<Object>> get_args() override;
425
429 };
430
436 public:
437 ~ScheduleTask_v_reduce() override = default;
438
439 std::string get_name() override;
440 std::string get_key() override;
441 std::string get_key_full() override;
442 std::vector<ref_ptr<Object>> get_args() override;
443
448 };
449
455 public:
456 ~ScheduleTask_v_count_mf() override = default;
457
458 std::string get_name() override;
459 std::string get_key() override;
460 std::string get_key_full() override;
461 std::vector<ref_ptr<Object>> get_args() override;
462
465 };
466
471}// namespace spla
472
473#endif//SPLA_SCHEDULE_TASKS_HPP
Callback function which can be scheduled in schedule.
Base schedule task class with common public properties.
Definition schedule_tasks.hpp:47
const std::string & get_label() const override
Definition schedule_tasks.cpp:39
void set_label(std::string label) override
Definition schedule_tasks.cpp:36
ref_ptr< Descriptor > desc
Definition schedule_tasks.hpp:57
ref_ptr< Descriptor > get_desc() override
Definition schedule_tasks.cpp:43
std::string label
Definition schedule_tasks.hpp:56
ref_ptr< Descriptor > get_desc_or_default() override
Definition schedule_tasks.cpp:47
~ScheduleTaskBase() override=default
Callback task.
Definition schedule_tasks.hpp:64
ScheduleCallback callback
Definition schedule_tasks.hpp:73
std::string get_key() override
Definition schedule_tasks.cpp:55
std::string get_name() override
Definition schedule_tasks.cpp:52
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:61
~ScheduleTask_callback() override=default
std::string get_key_full() override
Definition schedule_tasks.cpp:58
Sparse matrix kronecker product.
Definition schedule_tasks.hpp:124
std::string get_key_full() override
Definition schedule_tasks.cpp:120
ref_ptr< Matrix > R
Definition schedule_tasks.hpp:133
~ScheduleTask_kron() override=default
ref_ptr< Matrix > A
Definition schedule_tasks.hpp:134
std::string get_name() override
Definition schedule_tasks.cpp:110
ref_ptr< OpBinary > op_multiply
Definition schedule_tasks.hpp:136
std::string get_key() override
Definition schedule_tasks.cpp:113
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:127
ref_ptr< Matrix > B
Definition schedule_tasks.hpp:135
Matrix ewise add.
Definition schedule_tasks.hpp:189
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:194
ref_ptr< OpBinary > op
Definition schedule_tasks.hpp:201
std::string get_name() override
Definition schedule_tasks.cpp:177
ref_ptr< Matrix > A
Definition schedule_tasks.hpp:199
std::string get_key() override
Definition schedule_tasks.cpp:180
ref_ptr< Matrix > R
Definition schedule_tasks.hpp:198
~ScheduleTask_m_eadd() override=default
std::string get_key_full() override
Definition schedule_tasks.cpp:187
ref_ptr< Matrix > B
Definition schedule_tasks.hpp:200
Matrix ewise add.
Definition schedule_tasks.hpp:208
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:215
ref_ptr< Matrix > R
Definition schedule_tasks.hpp:217
std::string get_name() override
Definition schedule_tasks.cpp:198
ref_ptr< OpBinary > op
Definition schedule_tasks.hpp:220
std::string get_key() override
Definition schedule_tasks.cpp:201
ref_ptr< Matrix > B
Definition schedule_tasks.hpp:219
std::string get_key_full() override
Definition schedule_tasks.cpp:208
~ScheduleTask_m_emult() override=default
ref_ptr< Matrix > A
Definition schedule_tasks.hpp:218
Matrix extract vector.
Definition schedule_tasks.hpp:321
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:331
uint index
Definition schedule_tasks.hpp:332
ref_ptr< OpUnary > op_apply
Definition schedule_tasks.hpp:333
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:341
ref_ptr< Vector > r
Definition schedule_tasks.hpp:330
std::string get_name() override
Definition schedule_tasks.cpp:324
std::string get_key_full() override
Definition schedule_tasks.cpp:334
~ScheduleTask_m_extract_column() override=default
std::string get_key() override
Definition schedule_tasks.cpp:327
Matrix extract vector.
Definition schedule_tasks.hpp:302
~ScheduleTask_m_extract_row() override=default
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:312
std::string get_key_full() override
Definition schedule_tasks.cpp:313
ref_ptr< OpUnary > op_apply
Definition schedule_tasks.hpp:314
uint index
Definition schedule_tasks.hpp:313
std::string get_key() override
Definition schedule_tasks.cpp:306
std::string get_name() override
Definition schedule_tasks.cpp:303
ref_ptr< Vector > r
Definition schedule_tasks.hpp:311
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:320
Matrix by col reduction.
Definition schedule_tasks.hpp:246
std::string get_key() override
Definition schedule_tasks.cpp:243
std::string get_name() override
Definition schedule_tasks.cpp:240
ref_ptr< Vector > r
Definition schedule_tasks.hpp:255
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:256
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:257
ref_ptr< OpBinary > op_reduce
Definition schedule_tasks.hpp:257
~ScheduleTask_m_reduce_by_column() override=default
std::string get_key_full() override
Definition schedule_tasks.cpp:250
ref_ptr< Scalar > init
Definition schedule_tasks.hpp:258
Matrix by row reduction.
Definition schedule_tasks.hpp:227
std::string get_key_full() override
Definition schedule_tasks.cpp:229
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:236
std::string get_name() override
Definition schedule_tasks.cpp:219
ref_ptr< Vector > r
Definition schedule_tasks.hpp:236
ref_ptr< Scalar > init
Definition schedule_tasks.hpp:239
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:237
~ScheduleTask_m_reduce_by_row() override=default
std::string get_key() override
Definition schedule_tasks.cpp:222
ref_ptr< OpBinary > op_reduce
Definition schedule_tasks.hpp:238
Matrix reduction to scalar.
Definition schedule_tasks.hpp:265
ref_ptr< Scalar > r
Definition schedule_tasks.hpp:274
ref_ptr< OpBinary > op_reduce
Definition schedule_tasks.hpp:277
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:276
ref_ptr< Scalar > s
Definition schedule_tasks.hpp:275
~ScheduleTask_m_reduce() override=default
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:278
std::string get_name() override
Definition schedule_tasks.cpp:261
std::string get_key() override
Definition schedule_tasks.cpp:264
std::string get_key_full() override
Definition schedule_tasks.cpp:271
Matrix transpose.
Definition schedule_tasks.hpp:284
~ScheduleTask_m_transpose() override=default
std::string get_key() override
Definition schedule_tasks.cpp:285
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:294
std::string get_name() override
Definition schedule_tasks.cpp:282
ref_ptr< Matrix > R
Definition schedule_tasks.hpp:293
ref_ptr< OpUnary > op_apply
Definition schedule_tasks.hpp:295
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:299
std::string get_key_full() override
Definition schedule_tasks.cpp:292
Masked matrix matrix-transposed product.
Definition schedule_tasks.hpp:101
std::string get_key_full() override
Definition schedule_tasks.cpp:97
ref_ptr< Matrix > R
Definition schedule_tasks.hpp:110
ref_ptr< Matrix > A
Definition schedule_tasks.hpp:112
ref_ptr< OpBinary > op_add
Definition schedule_tasks.hpp:115
ref_ptr< Scalar > init
Definition schedule_tasks.hpp:117
std::string get_name() override
Definition schedule_tasks.cpp:87
~ScheduleTask_mxmT_masked() override=default
ref_ptr< Matrix > mask
Definition schedule_tasks.hpp:111
ref_ptr< Matrix > B
Definition schedule_tasks.hpp:113
std::string get_key() override
Definition schedule_tasks.cpp:90
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:106
ref_ptr< OpBinary > op_multiply
Definition schedule_tasks.hpp:114
ref_ptr< OpSelect > op_select
Definition schedule_tasks.hpp:116
Sparse matrix sparse matrix product.
Definition schedule_tasks.hpp:80
ref_ptr< OpBinary > op_add
Definition schedule_tasks.hpp:93
ref_ptr< Matrix > R
Definition schedule_tasks.hpp:89
std::string get_key_full() override
Definition schedule_tasks.cpp:75
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:83
ref_ptr< Scalar > init
Definition schedule_tasks.hpp:94
std::string get_key() override
Definition schedule_tasks.cpp:68
ref_ptr< Matrix > B
Definition schedule_tasks.hpp:91
ref_ptr< Matrix > A
Definition schedule_tasks.hpp:90
ref_ptr< OpBinary > op_multiply
Definition schedule_tasks.hpp:92
std::string get_name() override
Definition schedule_tasks.cpp:65
~ScheduleTask_mxm() override=default
Masked matrix-vector product.
Definition schedule_tasks.hpp:143
ref_ptr< OpSelect > op_select
Definition schedule_tasks.hpp:158
~ScheduleTask_mxv_masked() override=default
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:150
ref_ptr< Vector > r
Definition schedule_tasks.hpp:152
ref_ptr< Scalar > init
Definition schedule_tasks.hpp:159
std::string get_key() override
Definition schedule_tasks.cpp:134
std::string get_key_full() override
Definition schedule_tasks.cpp:141
ref_ptr< OpBinary > op_multiply
Definition schedule_tasks.hpp:156
ref_ptr< OpBinary > op_add
Definition schedule_tasks.hpp:157
ref_ptr< Vector > mask
Definition schedule_tasks.hpp:153
std::string get_name() override
Definition schedule_tasks.cpp:131
ref_ptr< Vector > v
Definition schedule_tasks.hpp:155
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:154
Masked vector assignment.
Definition schedule_tasks.hpp:397
ref_ptr< Scalar > value
Definition schedule_tasks.hpp:408
ref_ptr< Vector > mask
Definition schedule_tasks.hpp:407
ref_ptr< OpSelect > op_select
Definition schedule_tasks.hpp:410
std::string get_key() override
Definition schedule_tasks.cpp:411
~ScheduleTask_v_assign_masked() override=default
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:426
std::string get_name() override
Definition schedule_tasks.cpp:408
ref_ptr< Vector > r
Definition schedule_tasks.hpp:406
std::string get_key_full() override
Definition schedule_tasks.cpp:418
ref_ptr< OpBinary > op_assign
Definition schedule_tasks.hpp:409
Vector count meaningful elements.
Definition schedule_tasks.hpp:454
~ScheduleTask_v_count_mf() override=default
std::string get_key() override
Definition schedule_tasks.cpp:475
std::string get_name() override
Definition schedule_tasks.cpp:472
ref_ptr< Vector > v
Definition schedule_tasks.hpp:464
std::string get_key_full() override
Definition schedule_tasks.cpp:482
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:489
ref_ptr< Scalar > r
Definition schedule_tasks.hpp:463
Vector ewise with feedback.
Definition schedule_tasks.hpp:378
std::string get_name() override
Definition schedule_tasks.cpp:387
ref_ptr< Vector > r
Definition schedule_tasks.hpp:387
std::string get_key() override
Definition schedule_tasks.cpp:390
ref_ptr< Vector > fdb
Definition schedule_tasks.hpp:389
ref_ptr< OpBinary > op
Definition schedule_tasks.hpp:390
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:404
std::string get_key_full() override
Definition schedule_tasks.cpp:397
ref_ptr< Vector > v
Definition schedule_tasks.hpp:388
~ScheduleTask_v_eadd_fdb() override=default
Vector ewise add.
Definition schedule_tasks.hpp:340
std::string get_name() override
Definition schedule_tasks.cpp:345
ref_ptr< Vector > v
Definition schedule_tasks.hpp:351
ref_ptr< OpBinary > op
Definition schedule_tasks.hpp:352
std::string get_key_full() override
Definition schedule_tasks.cpp:355
std::string get_key() override
Definition schedule_tasks.cpp:348
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:362
~ScheduleTask_v_eadd() override=default
ref_ptr< Vector > u
Definition schedule_tasks.hpp:350
ref_ptr< Vector > r
Definition schedule_tasks.hpp:349
Vector ewise mult.
Definition schedule_tasks.hpp:359
ref_ptr< Vector > u
Definition schedule_tasks.hpp:369
ref_ptr< OpBinary > op
Definition schedule_tasks.hpp:371
std::string get_key() override
Definition schedule_tasks.cpp:369
ref_ptr< Vector > r
Definition schedule_tasks.hpp:368
std::string get_key_full() override
Definition schedule_tasks.cpp:376
std::string get_name() override
Definition schedule_tasks.cpp:366
ref_ptr< Vector > v
Definition schedule_tasks.hpp:370
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:383
~ScheduleTask_v_emult() override=default
Vector map to vector.
Definition schedule_tasks.hpp:417
ref_ptr< Vector > v
Definition schedule_tasks.hpp:427
std::string get_key_full() override
Definition schedule_tasks.cpp:440
~ScheduleTask_v_map() override=default
std::string get_name() override
Definition schedule_tasks.cpp:430
ref_ptr< Vector > r
Definition schedule_tasks.hpp:426
ref_ptr< OpUnary > op
Definition schedule_tasks.hpp:428
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:447
std::string get_key() override
Definition schedule_tasks.cpp:433
Vector reduction to scalar.
Definition schedule_tasks.hpp:435
std::string get_key() override
Definition schedule_tasks.cpp:454
ref_ptr< Scalar > r
Definition schedule_tasks.hpp:444
ref_ptr< Vector > v
Definition schedule_tasks.hpp:446
~ScheduleTask_v_reduce() override=default
std::string get_name() override
Definition schedule_tasks.cpp:451
std::string get_key_full() override
Definition schedule_tasks.cpp:461
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:468
ref_ptr< Scalar > s
Definition schedule_tasks.hpp:445
ref_ptr< OpBinary > op_reduce
Definition schedule_tasks.hpp:447
Masked vector-matrix product.
Definition schedule_tasks.hpp:166
ref_ptr< Vector > mask
Definition schedule_tasks.hpp:176
ref_ptr< Vector > v
Definition schedule_tasks.hpp:177
std::string get_key_full() override
Definition schedule_tasks.cpp:164
ref_ptr< OpBinary > op_multiply
Definition schedule_tasks.hpp:179
ref_ptr< Matrix > M
Definition schedule_tasks.hpp:178
ref_ptr< OpSelect > op_select
Definition schedule_tasks.hpp:181
std::vector< ref_ptr< Object > > get_args() override
Definition schedule_tasks.cpp:173
ref_ptr< OpBinary > op_add
Definition schedule_tasks.hpp:180
ref_ptr< Scalar > init
Definition schedule_tasks.hpp:182
ref_ptr< Vector > r
Definition schedule_tasks.hpp:175
std::string get_name() override
Definition schedule_tasks.cpp:154
std::string get_key() override
Definition schedule_tasks.cpp:157
~ScheduleTask_vxm_masked() override=default
Represent single smallest evaluation tasks which can scheduled.
Definition schedule.hpp:49
Automates reference counting and behaves as shared smart pointer.
Definition ref.hpp:117
std::uint32_t uint
Library index and size type.
Definition config.hpp:56
Definition algorithm.hpp:37