1#ifndef FREE_TENSOR_OUTPUT_INTERMEDIATES_H
2#define FREE_TENSOR_OUTPUT_INTERMEDIATES_H
4#include <unordered_map>
5#include <unordered_set>
18 const std::unordered_map<StmtOrExprID, Expr> &versions_;
19 const std::unordered_map<ID, Expr> &totLens_;
20 const std::unordered_set<ID> &trivials_;
22 std::string varSuffix_;
24 std::unordered_map<ID, std::string> savedNames_;
25 std::unordered_set<ID> insertedStmts_;
26 std::unordered_map<ID, std::vector<Stmt>> toSave_;
31 const std::unordered_map<ID, Expr> &totLens,
32 const std::unordered_set<ID> &trivials,
34 const std::string &varSuffix)
35 : versions_(versions), totLens_(totLens), trivials_(trivials),
36 stage_(stage), varSuffix_(varSuffix) {}
42 std::string savingName(
const std::string &oldName)
const;
115std::tuple<Stmt, std::unordered_map<ID, std::string>,
116 std::unordered_map<StmtOrExprID, Expr>, std::unordered_map<ID, Expr>,
117 std::unordered_set<ID>,
118 std::unordered_map<std::string, std::pair<std::string, Expr>>>
121 const std::unordered_map<ID, std::unordered_set<ID>> &needVersions,
122 const std::unordered_map<StmtOrExprID, Derivative::LazyFullDerivative>
125 const std::string &varSuffix =
".tape");
133 const Stmt &op,
const std::unordered_set<ID> &intermediates,
135 const std::string &varSuffix =
".tape");
Definition: symbol_table.h:122
BaseClass::StmtRetType visit(const VarDef &op) override
Definition: symbol_table.h:167
Definition: allocator.h:9
std::tuple< Stmt, std::unordered_map< ID, std::string >, std::unordered_map< StmtOrExprID, Expr >, std::unordered_map< ID, Expr >, std::unordered_set< ID >, std::unordered_map< std::string, std::pair< std::string, Expr > > > outputIntermediates(const Stmt &op, const std::unordered_map< ID, std::unordered_set< ID > > &needVersions, const std::unordered_map< StmtOrExprID, Derivative::LazyFullDerivative > &derivatives, OutputIntermediatesStage stage=OutputIntermediatesStage::Forward, const std::string &varSuffix=".tape")
Definition: output_intermediates.cc:163
Stmt outputAllIntermedaites(const Stmt &op, const std::unordered_set< ID > &intermediates, OutputIntermediatesStage stage=OutputIntermediatesStage::Forward, const std::string &varSuffix=".tape")
Definition: output_intermediates.cc:178
Ref< StmtNode > Stmt
Definition: ast.h:152
OutputIntermediatesStage
Definition: output_intermediates.h:13