Tensor Comprehensions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tc2halide.h
Go to the documentation of this file.
1 
16 #pragma once
17 
18 #include <Halide/Halide.h>
19 
20 #include "tc/external/isl.h"
21 #include "tc/lang/tree.h"
22 #include "tc/lang/tree_views.h"
23 
24 namespace tc2halide {
25 
26 // We lower TC source into a Halide imperative statement, plus a list
27 // of the input and output tensors. We do not explicitly enumerate the
28 // scalar params.
31  def; // post-semantic analaysis tree, used for later error reporting
32  Halide::Internal::Stmt stmt;
33  std::vector<Halide::ImageParam> inputs;
34  std::map<std::string, Halide::Internal::Parameter> params;
35  std::vector<Halide::OutputImageParam> outputs;
36  lang::Def getDef() const {
37  return lang::Def(def); // Def is not default constructable, so we don't
38  // put it in the struct directly
39  }
40 };
41 
42 // For TC reductions, the right-hand-sides of the corresponding
43 // Provide nodes are tagged with intrinsics with the following names.
44 Halide::Internal::Call::ConstString kReductionInit = "ReductionInit";
45 Halide::Internal::Call::ConstString kReductionUpdate = "ReductionUpdate";
46 
47 // Translate a TC parse tree into equivalent Halide imperative IR with
48 // a naive schedule.
50  isl::ctx ctx,
51  const lang::TreeRef& treeRef,
52  bool throwWarnings = false);
53 
54 // Translate TC source into equivalent Halide imperative IR with a
55 // naive schedule.
57 translate(isl::ctx ctx, const std::string& tc, bool throwWarnings = false);
58 
59 } // namespace tc2halide
std::map< std::string, Halide::Internal::Parameter > params
Definition: tc2halide.h:34
Definition: tc2halide.h:29
std::vector< Halide::ImageParam > inputs
Definition: tc2halide.h:33
lang::TreeRef def
Definition: tc2halide.h:31
Definition: tree_views.h:330
Halide::Internal::Call::ConstString kReductionUpdate
Definition: tc2halide.h:45
Halide::Internal::Call::ConstString kReductionInit
Definition: tc2halide.h:44
HalideComponents translate(isl::ctx ctx, const lang::TreeRef &treeRef, bool throwWarnings=false)
lang::Def getDef() const
Definition: tc2halide.h:36
std::vector< Halide::OutputImageParam > outputs
Definition: tc2halide.h:35
Halide::Internal::Stmt stmt
Definition: tc2halide.h:32
std::shared_ptr< Tree > TreeRef
Definition: tree.h:44