19 namespace polyhedral {
21 bool MappingId::isBlockId() {
22 return *
this == BlockId::x() or *this == BlockId::y() or
23 *this == BlockId::z();
25 BlockId* MappingId::asBlockId() {
29 return static_cast<BlockId*
>(
this);
31 bool MappingId::isThreadId() {
32 return *
this == ThreadId::x() or *this == ThreadId::y() or
33 *this == ThreadId::z();
35 ThreadId* MappingId::asThreadId() {
39 return static_cast<ThreadId*
>(
this);
42 ThreadId ThreadId::makeId(
size_t dim) {
52 template <
unsigned char Dim>
53 ThreadId ThreadId::makeId(isl::id
id) {
54 static_assert(Dim < kMaxDim, "Incorrect Dim >= kMaxDim
");
55 return ThreadId(id, Dim);
57 ThreadId ThreadId::x() {
58 static thread_local isl::id x(
59 isl::with_exceptions::globalIslCtx(), std::string("t0
"));
62 ThreadId ThreadId::y() {
63 static thread_local isl::id y(
64 isl::with_exceptions::globalIslCtx(), std::string("t1
"));
67 ThreadId ThreadId::z() {
68 static thread_local isl::id z(
69 isl::with_exceptions::globalIslCtx(), std::string("t2
"));
73 BlockId BlockId::makeId(size_t dim) {
83 template <unsigned char Dim>
84 BlockId BlockId::makeId(isl::id id) {
85 static_assert(Dim < kMaxDim, "Incorrect Dim >= kMaxDim
");
86 return BlockId(id, Dim);
88 BlockId BlockId::x() {
89 static thread_local isl::id x(
90 isl::with_exceptions::globalIslCtx(), std::string("b0
"));
93 BlockId BlockId::y() {
94 static thread_local isl::id y(
95 isl::with_exceptions::globalIslCtx(), std::string("b1
"));
98 BlockId BlockId::z() {
99 static thread_local isl::id z(
100 isl::with_exceptions::globalIslCtx(), std::string("b2
"));
103 } // namespace mapping
104 } // namespace polyhedral