FreeTensor
Loading...
Searching...
No Matches
parallelize.h
Go to the documentation of this file.
1#ifndef FREE_TENSOR_PARALLELIZE_H
2#define FREE_TENSOR_PARALLELIZE_H
3
4#include <unordered_map>
5#include <unordered_set>
6
7#include <mutator.h>
8
9namespace freetensor {
10
11class Parallelize : public Mutator {
12 ID loop_;
13 ParallelScope parallel_;
14 std::vector<ID> outerLoops_, loopStack_;
15 bool done_ = false;
16
17 public:
18 Parallelize(const ID &loop, const ParallelScope &parallel)
19 : loop_(loop), parallel_(parallel) {}
20
21 bool done() const { return done_; }
22 const std::vector<ID> outerLoops() const { return outerLoops_; }
23
24 protected:
25 Stmt visit(const For &op) override;
26};
27
28Stmt parallelize(const Stmt &ast, const ID &loop, const ParallelScope &parallel,
29 bool allowReduction);
30
31} // namespace freetensor
32
33#endif // FREE_TENSOR_PARALLELIZE_H
Definition: id.h:18
Definition: mutator.h:11
Definition: parallelize.h:11
Stmt visit(const For &op) override
Definition: parallelize.cc:82
Parallelize(const ID &loop, const ParallelScope &parallel)
Definition: parallelize.h:18
const std::vector< ID > outerLoops() const
Definition: parallelize.h:22
bool done() const
Definition: parallelize.h:21
Definition: allocator.h:9
Stmt parallelize(const Stmt &ast, const ID &loop, const ParallelScope &parallel, bool allowReduction)
Definition: parallelize.cc:97
std::variant< SerialScope, OpenMPScope, CUDAStreamScope, CUDAScope > ParallelScope
Definition: parallel_scope.h:73
Ref< StmtNode > Stmt
Definition: ast.h:152