Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ffi/include/tvm/ffi/container/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,5 @@ inline constexpr bool type_contains_v<Tuple<T...>, Tuple<U...>> = (type_contains
} // namespace details

} // namespace ffi

// Expose to the tvm namespace
// Rationale: convinience and no ambiguity
using ffi::Tuple;
} // namespace tvm
#endif // TVM_FFI_CONTAINER_TUPLE_H_
287 changes: 0 additions & 287 deletions include/tvm/node/object_path.h

This file was deleted.

46 changes: 46 additions & 0 deletions include/tvm/node/repr_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#ifndef TVM_NODE_REPR_PRINTER_H_
#define TVM_NODE_REPR_PRINTER_H_

#include <tvm/ffi/reflection/access_path.h>
#include <tvm/node/functor.h>
#include <tvm/node/script_printer.h>

Expand Down Expand Up @@ -87,6 +88,51 @@ inline std::ostream& operator<<(std::ostream& os, const Variant<V...>& n) { //
return os;
}

namespace reflection {

inline std::ostream& operator<<(std::ostream& os, const AccessStep& step) {
namespace refl = ffi::reflection;
switch (step->kind) {
case refl::AccessKind::kAttr: {
os << '.' << step->key.cast<String>();
return os;
}
case refl::AccessKind::kArrayItem: {
os << "[" << step->key.cast<int64_t>() << "]";
return os;
}
case refl::AccessKind::kMapItem: {
os << "[" << step->key << "]";
return os;
}
case refl::AccessKind::kAttrMissing: {
os << ".<missing attr " << step->key.cast<String>() << "`>";
return os;
}
case refl::AccessKind::kArrayItemMissing: {
os << "[<missing item at " << step->key.cast<int64_t>() << ">]";
return os;
}
case refl::AccessKind::kMapItemMissing: {
os << "[<missing item at " << step->key << ">]";
return os;
}
default: {
LOG(FATAL) << "Unknown access step kind: " << static_cast<int>(step->kind);
}
}
return os;
}

inline std::ostream& operator<<(std::ostream& os, const AccessPath& path) {
Array<AccessStep> steps = path->ToSteps();
os << "<root>";
for (const auto& step : steps) {
os << step;
}
return os;
}
} // namespace reflection
} // namespace ffi
} // namespace tvm
#endif // TVM_NODE_REPR_PRINTER_H_
8 changes: 4 additions & 4 deletions include/tvm/node/script_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@
#include <tvm/ffi/any.h>
#include <tvm/ffi/container/array.h>
#include <tvm/ffi/container/map.h>
#include <tvm/ffi/reflection/access_path.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ffi/string.h>
#include <tvm/node/functor.h>
#include <tvm/node/object_path.h>
#include <tvm/runtime/data_type.h>

#include <iostream>
#include <string>

namespace tvm {

class PrinterConfigNode : public Object {
class PrinterConfigNode : public ffi::Object {
public:
/*! \brief A stack that tracks the names of the binding hierarchy */
Array<String> binding_names = {};
Expand Down Expand Up @@ -113,9 +113,9 @@ class PrinterConfigNode : public Object {
bool show_all_struct_info = true;

/* \brief Object path to be underlined */
Array<ObjectPath> path_to_underline = Array<ObjectPath>();
Array<ffi::reflection::AccessPath> path_to_underline;
/*! \brief Object path to be annotated. */
Map<ObjectPath, String> path_to_annotate = Map<ObjectPath, String>();
Map<ffi::reflection::AccessPath, String> path_to_annotate;
/*! \brief Object to be underlined. */
Array<ObjectRef> obj_to_underline = Array<ObjectRef>();
/*! \brief Object to be annotated. */
Expand Down
Loading
Loading