From 3af9ab82d964551d64c5913f56e30de9081233ac Mon Sep 17 00:00:00 2001 From: cchung100m Date: Thu, 14 May 2020 21:19:09 +0800 Subject: [PATCH] [TIR][REFACTOR] std::string -> String Migration in transform.h --- include/tvm/tir/transform.h | 8 ++++---- src/tir/ir/transform.cc | 2 +- src/tir/transforms/inject_copy_intrin.cc | 12 ++++++------ src/tir/transforms/lift_attr_scope.cc | 2 +- src/tir/transforms/thread_storage_sync.cc | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/tvm/tir/transform.h b/include/tvm/tir/transform.h index 13e1e2510e29d..0bd7020139ade 100644 --- a/include/tvm/tir/transform.h +++ b/include/tvm/tir/transform.h @@ -54,7 +54,7 @@ using tvm::transform::Sequential; */ TVM_DLL Pass CreatePrimFuncPass( const runtime::TypedPackedFunc& pass_func, - int opt_level, const std::string& name, const tvm::Array& required); + int opt_level, const String& name, const tvm::Array& required); /*! * \brief Inject prefetch instructions into stmt. @@ -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. @@ -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. @@ -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. diff --git a/src/tir/ir/transform.cc b/src/tir/ir/transform.cc index 30d5f0f507741..274374bdb1c15 100644 --- a/src/tir/ir/transform.cc +++ b/src/tir/ir/transform.cc @@ -118,7 +118,7 @@ IRModule PrimFuncPassNode::operator()(IRModule mod, const PassContext& pass_ctx) Pass CreatePrimFuncPass( const runtime::TypedPackedFunc& pass_func, - int opt_level, const std::string& name, const tvm::Array& required) { + int opt_level, const String& name, const tvm::Array& required) { PassInfo pass_info = PassInfo(opt_level, name, required); return PrimFuncPass(pass_func, pass_info); } diff --git a/src/tir/transforms/inject_copy_intrin.cc b/src/tir/transforms/inject_copy_intrin.cc index 5af1a39d27c60..825e8615852f4 100644 --- a/src/tir/transforms/inject_copy_intrin.cc +++ b/src/tir/transforms/inject_copy_intrin.cc @@ -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) {} @@ -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; @@ -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 storage_scope_; + std::unordered_map 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)); diff --git a/src/tir/transforms/lift_attr_scope.cc b/src/tir/transforms/lift_attr_scope.cc index bb4e5f7678a72..82d329b37908c 100644 --- a/src/tir/transforms/lift_attr_scope.cc +++ b/src/tir/transforms/lift_attr_scope.cc @@ -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)); diff --git a/src/tir/transforms/thread_storage_sync.cc b/src/tir/transforms/thread_storage_sync.cc index 0379fd9f56218..8e1dc08be8c27 100644 --- a/src/tir/transforms/thread_storage_sync.cc +++ b/src/tir/transforms/thread_storage_sync.cc @@ -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);