Tensor Comprehensions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
halide2isl.h
Go to the documentation of this file.
1 
16 #pragma once
17 
18 #include <iostream>
19 #include <sstream>
20 #include <string>
21 #include <unordered_map>
22 
23 #include <Halide/Halide.h>
24 
26 #include "tc/core/tc2halide.h"
27 #include "tc/external/isl.h"
28 
29 namespace tc {
30 namespace halide2isl {
31 
35 
37 struct SymbolTable {
38  std::vector<std::string> reductionVars, idxVars;
39  std::vector<Halide::Internal::Parameter> params;
40 };
42 
44 isl::space makeParamSpace(isl::ctx ctx, const SymbolTable& symbolTable);
45 
47 isl::aff makeIslAffFromInt(isl::space space, int64_t i);
48 
49 // Make an affine function over a space from a Halide Expr. Returns a
50 // null isl::aff if the expression is not affine. Fails if Variable
51 // does not correspond to a parameter or set dimension of the space.
52 isl::aff makeIslAffFromExpr(isl::space space, const Halide::Expr& e);
53 
54 typedef std::unordered_map<isl::id, Halide::Internal::Stmt, isl::IslIdIslHash>
56 typedef std::unordered_map<const Halide::Internal::IRNode*, isl::id> AccessMap;
62  tc::polyhedral::ScheduleTreeUPtr tree;
63 
67  isl::union_map reads, writes;
68 
72 
76 };
77 
81  isl::space paramSpace,
82  const Halide::Internal::Stmt& s);
83 
91 struct Reduction {
92  Halide::Internal::Stmt init, update;
93  std::vector<size_t> dims;
94 };
95 std::vector<Reduction> findReductions(const Halide::Internal::Stmt& s);
96 
97 } // namespace halide2isl
98 } // namespace tc
std::vector< std::string > idxVars
Definition: halide2isl.h:38
Halide::Internal::Stmt update
Definition: halide2isl.h:92
std::vector< std::string > reductionVars
Definition: halide2isl.h:38
Definition: tc2halide.h:29
isl::union_map reads
Definition: halide2isl.h:67
Definition: halide2isl.h:57
std::unordered_map< isl::id, Halide::Internal::Stmt, isl::IslIdIslHash > StatementMap
Definition: halide2isl.h:55
isl::union_map writes
Definition: halide2isl.h:67
std::vector< Reduction > findReductions(const Halide::Internal::Stmt &s)
isl::aff makeIslAffFromInt(isl::space space, int64_t i)
Make a constant-valued affine function over a space.
std::vector< Halide::Internal::Parameter > params
Definition: halide2isl.h:39
SymbolTable makeSymbolTable(const tc2halide::HalideComponents &components)
Definition: halide2isl.h:91
Find and categorize all variables referenced in a piece of Halide IR.
Definition: halide2isl.h:37
std::vector< size_t > dims
Definition: halide2isl.h:93
AccessMap accesses
Definition: halide2isl.h:71
isl::space makeParamSpace(isl::ctx ctx, const SymbolTable &symbolTable)
Make the space of all parameter values from the symbol table.
tc::polyhedral::ScheduleTreeUPtr tree
Definition: halide2isl.h:62
StatementMap statements
Definition: halide2isl.h:75
isl::aff makeIslAffFromExpr(isl::space space, const Halide::Expr &e)
std::unordered_map< const Halide::Internal::IRNode *, isl::id > AccessMap
Definition: halide2isl.h:56
Halide::Internal::Stmt init
Definition: halide2isl.h:92
ScheduleTreeAndAccesses makeScheduleTree(isl::space paramSpace, const Halide::Internal::Stmt &s)