Skip to content

Commit

Permalink
[Compatible] more apache/tvm#13785
Browse files Browse the repository at this point in the history
  • Loading branch information
comaniac committed Jan 23, 2023
1 parent aad3d37 commit 55165b6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/impl/ir_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ std::string AsText(const ObjectRef& node, bool show_meta_data) {
}
}
if (expr.as<CallNode>() && Downcast<Expr>(expr)->checked_type_.defined()) {
auto meta = tvm::TextMetaDataContext();
auto meta = tvm::relay::TextMetaDataContext();
tvm::relay::RelayTextPrinter printer(false, &meta, nullptr);
os << " /* ty=" << printer.Print(Downcast<Expr>(expr)->checked_type()).str() << " */";
}
Expand All @@ -123,7 +123,7 @@ std::string AsText(const ObjectRef& node, bool show_meta_data) {
return String(os.str());
});

std::string ret = tvm::AsText(node, show_meta_data, annotate);
std::string ret = tvm::relay::AsText(node, show_meta_data, annotate);
size_t index = 0;
while (true) {
index = ret.find("-114514i64", index);
Expand Down
2 changes: 2 additions & 0 deletions src/impl/vm/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <tvm/ir/type_functor.h>
#include <tvm/target/target.h>
#include <tvm/tir/op.h>
#include <tvm/relay/base.h>
#include <tvm/relay/transform.h>
#include <tvm/relay/analysis.h>
#include <tvm/relay/attrs/memory.h>
Expand Down Expand Up @@ -40,6 +41,7 @@ using namespace raf::value;
using binding::LookupBinding;
using binding::NDArrayBinding;
using raf::distributed::DistConfig;
using tvm::relay::PrettyPrint;
using tvm::relay::Shape;

/*!
Expand Down
4 changes: 2 additions & 2 deletions src/impl/vm/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* \brief The RAF virtual machine compiler.
*/
#pragma once
#include <tvm/ir/error.h>
#include <tvm/relay/error.h>
#include <tvm/relay/expr_functor.h>
#include <tvm/relay/transform.h>
#include <memory>
Expand Down Expand Up @@ -45,7 +45,7 @@ struct VMCompilerContext {
// The module context for the compilation
IRModule module;
// Error reporter
tvm::ErrorReporter err_reporter;
tvm::relay::ErrorReporter err_reporter;
// Map from a unique integer to ADT constructor tag
TagNameMap tag_index_map;
// Map from ADT constructor tag to a unique integer
Expand Down
1 change: 1 addition & 0 deletions src/impl/vm/vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ using namespace raf::requests;
using namespace raf::device_api;
using namespace raf::stream_pool;
using namespace raf::distributed::communicator;
using tvm::relay::PrettyPrint;

namespace utils {
inline std::shared_ptr<Event> GetEventById(const VMContext& ctx, Index device_id, Index event_id) {
Expand Down
17 changes: 9 additions & 8 deletions src/pass/fuse_tvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,15 @@ class FuseMutator : private ExprMutator {

// Debug function, dump the group assignment in text.
void DebugDumpGroup(const Expr& body) {
std::string text = AsText(body, false, [this](const ObjectRef& expr) -> std::string {
auto it = gmap_.find(expr.get());
if (it == gmap_.end()) return "";
std::ostringstream os;
auto* group = it->second->FindRoot();
os << " /* group=" << group << " */";
return os.str();
});
std::string text =
tvm::relay::AsText(body, false, [this](const ObjectRef& expr) -> std::string {
auto it = gmap_.find(expr.get());
if (it == gmap_.end()) return "";
std::ostringstream os;
auto* group = it->second->FindRoot();
os << " /* group=" << group << " */";
return os.str();
});
LOG(INFO) << "Dump of group info:\n" << text;
}
};
Expand Down
1 change: 1 addition & 0 deletions src/pass/type_infer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace type_infer {

using namespace raf::op;
using namespace raf::value;
using tvm::relay::PrettyPrint;

Type Unify(const Type& src, const Type& dst);

Expand Down

0 comments on commit 55165b6

Please sign in to comment.