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
2 changes: 1 addition & 1 deletion include/tvm/ir/node_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef TVM_IR_NODE_FUNCTOR_H_
#define TVM_IR_NODE_FUNCTOR_H_

#include <tvm/runtime/logging.h>
#include <tvm/ffi/error.h>

#include <cstring>
#include <type_traits>
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/op.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
#ifndef TVM_IR_OP_H_
#define TVM_IR_OP_H_

#include <tvm/ffi/error.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ir/attr_registry_map.h>
#include <tvm/ir/attrs.h>
#include <tvm/ir/env_func.h>
#include <tvm/ir/expr.h>
#include <tvm/ir/type.h>
#include <tvm/runtime/logging.h>

#include <string>
#include <utility>
Expand Down
12 changes: 6 additions & 6 deletions include/tvm/relax/op_attr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ enum OpPatternKind {
kOpaque = 8
};

/*!
* \brief Packed function implementation for operators. The relax operator will be lowered to
* this packed function call during codegen.
*/
using FCallPacked = ffi::String;

/*!
* \brief Infer output struct info given the call
*
Expand All @@ -61,12 +67,6 @@ enum OpPatternKind {
*/
using FInferStructInfo = ffi::TypedFunction<StructInfo(const Call& call, const BlockBuilder& ctx)>;

/*!
* \brief Packed function implementation for operators. The relax operator will be lowered to
* this packed function call during codegen.
*/
using FCallPacked = ffi::String;

/*!
* \brief The function type of a normalization function.
*
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/relax/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#define TVM_RELAX_UTILS_H_

#include <tvm/arith/analyzer.h>
#include <tvm/ffi/error.h>
#include <tvm/ir/module.h>
#include <tvm/relax/expr.h>
#include <tvm/runtime/logging.h>

namespace tvm {
namespace relax {
Expand Down
13 changes: 4 additions & 9 deletions include/tvm/runtime/data_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

#include <tvm/ffi/container/shape.h>
#include <tvm/ffi/dtype.h>
#include <tvm/ffi/error.h>
#include <tvm/runtime/base.h>
#include <tvm/runtime/logging.h>

#include <cstring>
#include <string>
Expand All @@ -36,8 +36,6 @@
namespace tvm {
namespace runtime {

using tvm_index_t = ffi::Shape::index_type;

/*!
* \brief Runtime primitive data type.
*
Expand Down Expand Up @@ -404,10 +402,10 @@ class DataType {
* \return The type of TVM shape index.
*/
static DataType ShapeIndex() {
if (std::is_signed<tvm_index_t>::value) {
return DataType::Int(sizeof(tvm_index_t) * 8);
if (std::is_signed<ffi::Shape::index_type>::value) {
return DataType::Int(sizeof(ffi::Shape::index_type) * 8);
} else {
return DataType::UInt(sizeof(tvm_index_t) * 8);
return DataType::UInt(sizeof(ffi::Shape::index_type) * 8);
}
}

Expand Down Expand Up @@ -451,9 +449,6 @@ inline bool TypeEqual(DLDataType lhs, DLDataType rhs) {
return lhs.code == rhs.code && lhs.bits == rhs.bits && lhs.lanes == rhs.lanes;
}

using ffi::DLDataTypeToString;
using ffi::StringToDLDataType;

inline std::ostream& operator<<(std::ostream& os, const DataType& dtype) { // NOLINT(*)
return os << dtype.operator DLDataType();
}
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/runtime/device_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#define TVM_RUNTIME_DEVICE_API_H_

#include <tvm/ffi/any.h>
#include <tvm/ffi/error.h>
#include <tvm/ffi/optional.h>
#include <tvm/ffi/string.h>
#include <tvm/runtime/base.h>
#include <tvm/runtime/logging.h>

#include <string>
/*!
Expand Down
2 changes: 0 additions & 2 deletions include/tvm/runtime/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
namespace tvm {
namespace runtime {

using ffi::EnvErrorAlreadySet;

/*! \brief Internal implementation */
namespace detail {
// Provide support for customized logging.
Expand Down
5 changes: 0 additions & 5 deletions include/tvm/runtime/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,12 @@
namespace tvm {
namespace runtime {

using ffi::GetDataSize;
using ffi::IsAligned;
using ffi::IsContiguous;

/*!
* \brief Managed Tensor.
* The array is backed by reference counted blocks.
*/
class Tensor : public tvm::ffi::Tensor {
public:
using Container = ffi::TensorObj;
Tensor() = default;
/*!
* \brief constructor.
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/runtime/vm/bytecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#ifndef TVM_RUNTIME_VM_BYTECODE_H_
#define TVM_RUNTIME_VM_BYTECODE_H_

#include <tvm/ffi/error.h>
#include <tvm/runtime/data_type.h>
#include <tvm/runtime/logging.h>

#include <iostream>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/s_tir/random_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
#ifndef TVM_S_TIR_RANDOM_ENGINE_H_
#define TVM_S_TIR_RANDOM_ENGINE_H_
#include <tvm/runtime/logging.h>
#include <tvm/ffi/error.h>

#include <cstdint>
#include <random>
Expand Down
4 changes: 2 additions & 2 deletions include/tvm/script/printer/doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DocNode : public ffi::Object {
* this Doc is generated, in order to position the diagnostic
* message.
*/
mutable ffi::Array<ffi::reflection::AccessPath> source_paths;
mutable ffi::Array<AccessPath> source_paths;

static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
Expand Down Expand Up @@ -308,7 +308,7 @@ class LiteralDoc : public ExprDoc {
* \param p The object path
*/
static LiteralDoc DataType(const runtime::DataType& v, const ffi::Optional<AccessPath>& p) {
std::string dtype = v.is_void() ? "void" : runtime::DLDataTypeToString(v);
std::string dtype = v.is_void() ? "void" : ffi::DLDataTypeToString(v);
return LiteralDoc::Str(dtype, p);
}
/*!
Expand Down
4 changes: 0 additions & 4 deletions include/tvm/target/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
namespace tvm {
/*! \brief namespace for target translation and codegen. */
namespace codegen {
// use packed function from runtime.
using ffi::Any;
using ffi::Function;
using ffi::PackedArgs;

/*!
* \brief Build a module from array of lowered function.
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/target/virtual_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
namespace tvm {

/*!
* Abstract label for an area of memory.
* \brief Abstract label for an area of memory.
*
* Currently uninterpreted and arbitrary. Likely to be replaced by a structured representation
* of a memory pool in the future. Please try to use this alias instead of ffi::String to aid future
Expand Down
1 change: 1 addition & 0 deletions include/tvm/topi/detail/constant_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define TVM_TOPI_DETAIL_CONSTANT_UTILS_H_

#include <tvm/arith/analyzer.h>
#include <tvm/runtime/logging.h>
#include <tvm/te/operation.h>
#include <tvm/tirx/analysis.h>
#include <tvm/tirx/expr.h>
Expand Down
1 change: 1 addition & 0 deletions src/arith/analyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <tvm/ffi/cast.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/runtime/logging.h>
#include <tvm/tirx/expr.h>
#include <tvm/tirx/op.h>

Expand Down
1 change: 1 addition & 0 deletions src/arith/const_fold.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define TVM_ARITH_CONST_FOLD_H_

#include <tvm/ffi/optional.h>
#include <tvm/runtime/logging.h>
#include <tvm/tirx/expr.h>
#include <tvm/tirx/op.h>

Expand Down
1 change: 1 addition & 0 deletions src/arith/domain_touched.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/runtime/logging.h>
#include <tvm/te/tensor.h>
#include <tvm/tirx/expr.h>
#include <tvm/tirx/stmt_functor.h>
Expand Down
1 change: 1 addition & 0 deletions src/arith/int_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <tvm/ffi/cast.h>
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/runtime/logging.h>
#include <tvm/tirx/expr.h>
#include <tvm/tirx/expr_functor.h>
#include <tvm/tirx/op.h>
Expand Down
1 change: 1 addition & 0 deletions src/arith/solve_linear_equation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <tvm/ffi/function.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/runtime/data_type.h>
#include <tvm/runtime/logging.h>
#include <tvm/tirx/expr.h>
#include <tvm/tirx/op.h>
#include <tvm/tirx/stmt_functor.h>
Expand Down
1 change: 1 addition & 0 deletions src/ir/diagnostic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ir/diagnostic.h>
#include <tvm/ir/source_map.h>
#include <tvm/runtime/logging.h>

namespace tvm {

Expand Down
2 changes: 2 additions & 0 deletions src/ir/instrument.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
#include <tvm/ir/instrument.h>
#include <tvm/ir/repr.h>
#include <tvm/ir/transform.h>
#include <tvm/runtime/logging.h>

#include <chrono>
#include <iomanip>
#include <stack>

namespace tvm {
Expand Down
6 changes: 3 additions & 3 deletions src/ir/repr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* The legacy ReprPrinter has been replaced by ffi::ReprPrint. This file:
* - Implements the Dump() debug helpers (they call ffi::ReprPrint).
* - Registers node.AsRepr (for backward Python compatibility) via ffi::ReprPrint.
* - Registers __ffi_repr__ hooks for AccessPath and AccessStep.
* - Registers __ffi_repr__ hooks for ffi::reflection::AccessPath and AccessStep.
*/
#include <tvm/ffi/cast.h>
#include <tvm/ffi/extra/dataclass.h>
Expand All @@ -48,7 +48,7 @@ TVM_FFI_STATIC_INIT_BLOCK() {
// Python's tvm.runtime._ffi_node_api sets __object_repr__ = AsRepr via init_ffi_api.
refl::GlobalDef().def("node.AsRepr",
[](ffi::Any obj) -> ffi::String { return ffi::ReprPrint(obj); });
// Register __ffi_repr__ for AccessPath/AccessStep so that ffi.ReprPrint
// Register __ffi_repr__ for ffi::reflection::AccessPath/AccessStep so that ffi.ReprPrint
// uses the concise "<root>.field[idx]" format.
//
// AccessStep: format one step fragment (e.g. ".field", "[0]", "[key]?").
Expand Down Expand Up @@ -79,7 +79,7 @@ TVM_FFI_STATIC_INIT_BLOCK() {
}
return os.str();
});
// AccessPath: recurse through parent via fn_repr rather than walking the
// ffi::reflection::AccessPath: recurse through parent via fn_repr rather than walking the
// linked list manually. Root (no step) emits "<root>"; each non-root node
// prepends its parent's repr and appends the current step's repr.
refl::TypeAttrDef<ffi::reflection::AccessPathObj>().def(
Expand Down
10 changes: 5 additions & 5 deletions src/ir/script_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

namespace tvm {

using AccessPath = ffi::reflection::AccessPath;

TVM_FFI_STATIC_INIT_BLOCK() { PrinterConfigNode::RegisterReflection(); }

TVMScriptPrinter::FType& TVMScriptPrinter::vtable() {
Expand Down Expand Up @@ -94,11 +92,13 @@ PrinterConfig::PrinterConfig(ffi::Map<ffi::String, Any> config_dict) {
}
if (auto v = config_dict.Get("path_to_underline")) {
n->path_to_underline =
Downcast<ffi::Optional<ffi::Array<AccessPath>>>(v).value_or(ffi::Array<AccessPath>());
Downcast<ffi::Optional<ffi::Array<ffi::reflection::AccessPath>>>(v).value_or(
ffi::Array<ffi::reflection::AccessPath>());
}
if (auto v = config_dict.Get("path_to_annotate")) {
n->path_to_annotate = Downcast<ffi::Optional<ffi::Map<AccessPath, ffi::String>>>(v).value_or(
ffi::Map<AccessPath, ffi::String>());
n->path_to_annotate =
Downcast<ffi::Optional<ffi::Map<ffi::reflection::AccessPath, ffi::String>>>(v).value_or(
ffi::Map<ffi::reflection::AccessPath, ffi::String>());
}
if (auto v = config_dict.Get("obj_to_underline")) {
n->obj_to_underline = Downcast<ffi::Optional<ffi::Array<ffi::ObjectRef>>>(v).value_or(
Expand Down
1 change: 1 addition & 0 deletions src/ir/source_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <tvm/ffi/reflection/registry.h>
#include <tvm/ir/source_map.h>
#include <tvm/ir/transform.h>
#include <tvm/runtime/logging.h>

#include <algorithm>

Expand Down
4 changes: 2 additions & 2 deletions src/ir/structural_hash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ TVM_FFI_STATIC_INIT_BLOCK() {
return rtmod;
});

refl::TypeAttrDef<runtime::Tensor::Container>()
refl::TypeAttrDef<ffi::TensorObj>()
.def("__data_to_json__",
[](const runtime::Tensor::Container* node) {
[](const ffi::TensorObj* node) {
std::string result;
support::BytesOutStream mstrm(&result);
support::Base64OutStream b64strm(&mstrm);
Expand Down
1 change: 1 addition & 0 deletions src/ir/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <tvm/ir/transform.h>
#include <tvm/relax/expr.h>
#include <tvm/runtime/device_api.h>
#include <tvm/runtime/logging.h>

#include <stack>

Expand Down
1 change: 1 addition & 0 deletions src/relax/analysis/graph_partitioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <tvm/ffi/cast.h>
#include <tvm/relax/op_attr_types.h>
#include <tvm/relax/type.h>
#include <tvm/runtime/logging.h>

#include <unordered_map>
#include <unordered_set>
Expand Down
1 change: 1 addition & 0 deletions src/relax/analysis/layout_transformation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <tvm/ffi/cast.h>
#include <tvm/ffi/reflection/registry.h>
#include <tvm/relax/analysis.h>
#include <tvm/runtime/logging.h>
#include <tvm/tirx/analysis.h>
#include <tvm/tirx/index_map.h>
#include <tvm/tirx/stmt_functor.h>
Expand Down
1 change: 1 addition & 0 deletions src/relax/analysis/well_formed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
#include <tvm/relax/op_attr_types.h>
#include <tvm/relax/struct_info_functor.h>
#include <tvm/relax/utils.h>
#include <tvm/runtime/logging.h>
#include <tvm/tirx/expr_functor.h>

#include <string>
Expand Down
1 change: 1 addition & 0 deletions src/relax/backend/contrib/clml/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <tvm/ir/module.h>
#include <tvm/ir/transform.h>
#include <tvm/relax/type.h>
#include <tvm/runtime/logging.h>

#include <memory>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/relax/backend/contrib/codegen_json/codegen_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class OpAttrExtractor {

void Visit(const char* key, DataType* value) {
if (!value->is_void()) {
SetNodeAttr(key, ffi::String(runtime::DLDataTypeToString(*value)));
SetNodeAttr(key, ffi::String(ffi::DLDataTypeToString(*value)));
} else {
SetNodeAttr(key, ffi::String(""));
}
Expand Down
1 change: 1 addition & 0 deletions src/relax/backend/contrib/cutlass/codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <tvm/relax/analysis.h>
#include <tvm/relax/attrs/nn.h>
#include <tvm/relax/type.h>
#include <tvm/runtime/logging.h>

#include <memory>
#include <string>
Expand Down
Loading
Loading