1#ifndef FREE_TENSOR_PARALLEL_SCOPE_H
2#define FREE_TENSOR_PARALLEL_SCOPE_H
25 return os <<
"openmp";
34 return os <<
"cudastream";
55 switch (parallel.
dim_) {
72typedef std::variant<SerialScope, OpenMPScope, CUDAStreamScope, CUDAScope>
77 if (std::holds_alternative<SerialScope>(parallel)) {
79 }
else if (std::holds_alternative<OpenMPScope>(parallel)) {
80 return os << std::get<OpenMPScope>(parallel);
81 }
else if (std::holds_alternative<CUDAScope>(parallel)) {
82 return os << std::get<CUDAScope>(parallel);
83 }
else if (std::holds_alternative<CUDAStreamScope>(parallel)) {
84 return os << std::get<CUDAStreamScope>(parallel);
109 ERROR(
"Unrecognized parallel scope " + _str);
140 std::hash<int>()((
int)parallel.
dim_));
#define ASSERT(expr)
Definition: except.h:152
#define ERROR(msg)
Definition: except.h:141
Definition: allocator.h:9
auto && lhs
Definition: const_fold.cc:70
constexpr ParallelScope threadIdxY
Definition: parallel_scope.h:115
constexpr ParallelScope blockIdxZ
Definition: parallel_scope.h:119
std::string tolower(const std::string &s)
Definition: container_utils.h:142
std::string toString(const AST &op)
Definition: print_ast.cc:784
bool operator==(const Allocator< T > &lhs, const Allocator< T > &rhs)
Definition: allocator.h:100
constexpr ParallelScope threadIdxZ
Definition: parallel_scope.h:116
std::variant< SerialScope, OpenMPScope, CUDAStreamScope, CUDAScope > ParallelScope
Definition: parallel_scope.h:73
ParallelScope parseParallelScope(const std::string &_str)
Definition: parallel_scope.h:90
constexpr ParallelScope blockIdxX
Definition: parallel_scope.h:117
constexpr ParallelScope serialScope
Definition: parallel_scope.h:112
auto auto && rhs
Definition: const_fold.cc:70
size_t hashCombine(size_t seed, size_t other)
Definition: hash_combine.cc:5
std::ostream & operator<<(std::ostream &os, const Dependence &dep)
Definition: deps.cc:1404
constexpr ParallelScope threadIdxX
Definition: parallel_scope.h:114
constexpr ParallelScope blockIdxY
Definition: parallel_scope.h:118
Definition: parallel_scope.h:37
Level
Definition: parallel_scope.h:38
@ Thread
Definition: parallel_scope.h:38
@ Block
Definition: parallel_scope.h:38
enum freetensor::CUDAScope::Level level_
enum freetensor::CUDAScope::Dim dim_
Dim
Definition: parallel_scope.h:39
@ X
Definition: parallel_scope.h:39
@ Y
Definition: parallel_scope.h:39
@ Z
Definition: parallel_scope.h:39
Definition: parallel_scope.h:28
Definition: parallel_scope.h:20
Definition: parallel_scope.h:15
size_t operator()(const freetensor::CUDAScope ¶llel)
Definition: parallel_scope.h:138
size_t operator()(const freetensor::CUDAStreamScope &)
Definition: parallel_scope.h:134
size_t operator()(const freetensor::OpenMPScope &)
Definition: parallel_scope.h:130
size_t operator()(const freetensor::SerialScope &)
Definition: parallel_scope.h:126