Skip to content

Commit

Permalink
[TIR][REFACTOR] std::string -> String Migration in transform.h
Browse files Browse the repository at this point in the history
  • Loading branch information
cchung100m committed May 14, 2020
1 parent 3a7c7b2 commit 3af9ab8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions include/tvm/tir/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ using tvm::transform::Sequential;
*/
TVM_DLL Pass CreatePrimFuncPass(
const runtime::TypedPackedFunc<PrimFunc(PrimFunc, IRModule, PassContext)>& pass_func,
int opt_level, const std::string& name, const tvm::Array<runtime::String>& required);
int opt_level, const String& name, const tvm::Array<runtime::String>& required);

/*!
* \brief Inject prefetch instructions into stmt.
Expand Down Expand Up @@ -88,7 +88,7 @@ TVM_DLL Pass StorageFlatten(int cache_line_size, bool create_bound_attribute = f
* Expr pad_value)
* \return The pass.
*/
TVM_DLL Pass InjectCopyIntrin(std::string pragma_key, runtime::PackedFunc fintrin);
TVM_DLL Pass InjectCopyIntrin(String pragma_key, runtime::PackedFunc fintrin);

/*!
* \brief Detect and insert sync points to co-processor.
Expand All @@ -103,7 +103,7 @@ TVM_DLL Pass CoProcSync();
* \param attr_key The attribute key to be checked.
* \return The pass.
*/
TVM_DLL Pass LiftAttrScope(std::string attr_key);
TVM_DLL Pass LiftAttrScope(String attr_key);

/*!
* \brief partition loops in the stmt.
Expand Down Expand Up @@ -269,7 +269,7 @@ TVM_DLL Pass SkipAssert();
* \param storage_scope The storage scope considered.
* \return The pass.
*/
TVM_DLL Pass ThreadSync(std::string storage_scope);
TVM_DLL Pass ThreadSync(String storage_scope);

/*!
* \brief Lower cross thread alleduce.
Expand Down
2 changes: 1 addition & 1 deletion src/tir/ir/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ IRModule PrimFuncPassNode::operator()(IRModule mod, const PassContext& pass_ctx)

Pass CreatePrimFuncPass(
const runtime::TypedPackedFunc<PrimFunc(PrimFunc, IRModule, PassContext)>& pass_func,
int opt_level, const std::string& name, const tvm::Array<runtime::String>& required) {
int opt_level, const String& name, const tvm::Array<runtime::String>& required) {
PassInfo pass_info = PassInfo(opt_level, name, required);
return PrimFuncPass(pass_func, pass_info);
}
Expand Down
12 changes: 6 additions & 6 deletions src/tir/transforms/inject_copy_intrin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ using runtime::PackedFunc;

class CopyIntrinInjector : public StmtMutator {
public:
CopyIntrinInjector(const std::string& pragma_key, const PackedFunc& flower_copy_fromto)
CopyIntrinInjector(const String& pragma_key, const PackedFunc& flower_copy_fromto)
: pragma_key_(attr::pragma_scope_prefix + pragma_key),
flower_copy_fromto_(flower_copy_fromto) {}

Expand Down Expand Up @@ -158,7 +158,7 @@ class CopyIntrinInjector : public StmtMutator {
return true;
}
// Get storage scope
std::string GetStorageScope(const VarNode* var) const {
String GetStorageScope(const VarNode* var) const {
auto it = storage_scope_.find(var);
if (it != storage_scope_.end()) {
return it->second;
Expand All @@ -167,23 +167,23 @@ class CopyIntrinInjector : public StmtMutator {
}
}
// pragma key
std::string pragma_key_;
String pragma_key_;
// function to lower copy intrinsics.
const PackedFunc& flower_copy_fromto_;
// Storage scope
std::unordered_map<const VarNode*, std::string> storage_scope_;
std::unordered_map<const VarNode*, String> storage_scope_;
// arith analyzer
arith::Analyzer analyzer_;
};

Stmt InjectCopyIntrin(Stmt stmt, const std::string& pragma_key,
Stmt InjectCopyIntrin(Stmt stmt, const String& pragma_key,
const PackedFunc& flower_copy_fromto) {
return CopyIntrinInjector(pragma_key, flower_copy_fromto)(std::move(stmt));
}

namespace transform {

Pass InjectCopyIntrin(std::string pragma_key, PackedFunc flower_copy_fromto) {
Pass InjectCopyIntrin(String pragma_key, PackedFunc flower_copy_fromto) {
auto pass_func = [=](PrimFunc f, IRModule m, PassContext ctx) {
auto* n = f.CopyOnWrite();
n->body = CopyIntrinInjector(pragma_key, flower_copy_fromto)(std::move(n->body));
Expand Down
2 changes: 1 addition & 1 deletion src/tir/transforms/lift_attr_scope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Stmt LiftAttrScope(Stmt stmt, std::string attr_key) {

namespace transform {

Pass LiftAttrScope(std::string attr_key) {
Pass LiftAttrScope(String attr_key) {
auto pass_func = [=](PrimFunc f, IRModule m, PassContext ctx) {
auto* n = f.CopyOnWrite();
n->body = AttrScopeLifter(attr_key).Lift(std::move(n->body));
Expand Down
2 changes: 1 addition & 1 deletion src/tir/transforms/thread_storage_sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Stmt ThreadSync(Stmt stmt, std::string storage_scope) {

namespace transform {

Pass ThreadSync(std::string storage_scope) {
Pass ThreadSync(String storage_scope) {
auto pass_func = [storage_scope](PrimFunc f, IRModule m, PassContext ctx) {
auto* n = f.CopyOnWrite();
n->body = ThreadSync(std::move(n->body), storage_scope);
Expand Down

0 comments on commit 3af9ab8

Please sign in to comment.