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 docs/arch/runtime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Each ``Object`` subclass will override this to register its members. Here is an
hash_reduce(value);
}

static constexpr const char* _type_key = "IntImm";
static constexpr const char* _type_key = "ir.IntImm";
TVM_DECLARE_FINAL_OBJECT_INFO(IntImmNode, PrimExprNode);
};
// in cc file
Expand Down
2 changes: 1 addition & 1 deletion ffi/include/tvm/ffi/container/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class ArrayObj : public Object, public details::InplaceArrayBase<ArrayObj, TVMFF
}

static constexpr const int32_t _type_index = TypeIndex::kTVMFFIArray;
static constexpr const char* _type_key = "object.Array";
static constexpr const char* _type_key = StaticTypeKey::kTVMFFIArray;
static const constexpr bool _type_final = true;
TVM_FFI_DECLARE_STATIC_OBJECT_INFO(ArrayObj, Object);

Expand Down
2 changes: 1 addition & 1 deletion ffi/include/tvm/ffi/container/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class MapObj : public Object {
static_assert(sizeof(KVType) == 32, "sizeof(KVType) incorrect");

static constexpr const int32_t _type_index = TypeIndex::kTVMFFIMap;
static constexpr const char* _type_key = "object.Map";
static constexpr const char* _type_key = StaticTypeKey::kTVMFFIMap;
static const constexpr bool _type_final = true;
TVM_FFI_DECLARE_STATIC_OBJECT_INFO(MapObj, Object);

Expand Down
2 changes: 1 addition & 1 deletion ffi/include/tvm/ffi/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct EnvErrorAlreadySet : public std::exception {};
class ErrorObj : public Object, public TVMFFIErrorCell {
public:
static constexpr const int32_t _type_index = TypeIndex::kTVMFFIError;
static constexpr const char* _type_key = "object.Error";
static constexpr const char* _type_key = "ffi.Error";

TVM_FFI_DECLARE_STATIC_OBJECT_INFO(ErrorObj, Object);
};
Expand Down
2 changes: 1 addition & 1 deletion ffi/include/tvm/ffi/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class FunctionObj : public Object, public TVMFFIFunctionCell {
}

static constexpr const uint32_t _type_index = TypeIndex::kTVMFFIFunction;
static constexpr const char* _type_key = "object.Function";
static constexpr const char* _type_key = StaticTypeKey::kTVMFFIFunction;

TVM_FFI_DECLARE_STATIC_OBJECT_INFO(FunctionObj, Object);

Expand Down
14 changes: 9 additions & 5 deletions ffi/include/tvm/ffi/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ struct StaticTypeKey {
static constexpr const char* kTVMFFIRawStr = "const char*";
static constexpr const char* kTVMFFIByteArrayPtr = "TVMFFIByteArray*";
static constexpr const char* kTVMFFIObjectRValueRef = "ObjectRValueRef";
static constexpr const char* kTVMFFIBytes = "object.Bytes";
static constexpr const char* kTVMFFIStr = "object.String";
static constexpr const char* kTVMFFIShape = "object.Shape";
static constexpr const char* kTVMFFINDArray = "object.NDArray";
static constexpr const char* kTVMFFIBytes = "ffi.Bytes";
static constexpr const char* kTVMFFIStr = "ffi.String";
static constexpr const char* kTVMFFIShape = "ffi.Shape";
static constexpr const char* kTVMFFINDArray = "ffi.NDArray";
static constexpr const char* kTVMFFIObject = "ffi.Object";
static constexpr const char* kTVMFFIFunction = "ffi.Function";
static constexpr const char* kTVMFFIArray = "ffi.Array";
static constexpr const char* kTVMFFIMap = "ffi.Map";
};

/*!
Expand Down Expand Up @@ -197,7 +201,7 @@ class Object {
}

// Information about the object
static constexpr const char* _type_key = "object.Object";
static constexpr const char* _type_key = StaticTypeKey::kTVMFFIObject;

// Default object type properties for sub-classes
static constexpr bool _type_final = false;
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/arith/int_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum SignType { kPositive, kNegative, kZero, kUnknown };
*/
class IntSetNode : public Object {
public:
static constexpr const char* _type_key = "IntSet";
static constexpr const char* _type_key = "ir.IntSet";
static constexpr bool _type_has_method_sequal_reduce = false;
TVM_DECLARE_BASE_OBJECT_INFO(IntSetNode, Object);
};
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/ir/attrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class AttrFieldInfoNode : public Object {
v->Visit("description", &description);
}

static constexpr const char* _type_key = "AttrFieldInfo";
static constexpr const char* _type_key = "ir.AttrFieldInfo";
static constexpr bool _type_has_method_sequal_reduce = false;
static constexpr bool _type_has_method_shash_reduce = false;
TVM_DECLARE_FINAL_OBJECT_INFO(AttrFieldInfoNode, Object);
Expand Down Expand Up @@ -164,7 +164,7 @@ class BaseAttrsNode : public Object {

static constexpr const bool _type_has_method_sequal_reduce = true;
static constexpr const bool _type_has_method_shash_reduce = true;
static constexpr const char* _type_key = "Attrs";
static constexpr const char* _type_key = "ir.Attrs";
TVM_DECLARE_BASE_OBJECT_INFO(BaseAttrsNode, Object);
};

Expand Down Expand Up @@ -201,7 +201,7 @@ class DictAttrsNode : public BaseAttrsNode {
Array<AttrFieldInfo> ListFieldInfo() const final;

// type info
static constexpr const char* _type_key = "DictAttrs";
static constexpr const char* _type_key = "ir.DictAttrs";
TVM_DECLARE_FINAL_OBJECT_INFO(DictAttrsNode, BaseAttrsNode);
};

Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/env_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class EnvFuncNode : public Object {
hash_reduce(name);
}

static constexpr const char* _type_key = "EnvFunc";
static constexpr const char* _type_key = "ir.EnvFunc";
static constexpr bool _type_has_method_sequal_reduce = true;
static constexpr bool _type_has_method_shash_reduce = true;
TVM_DECLARE_FINAL_OBJECT_INFO(EnvFuncNode, Object);
Expand Down
16 changes: 8 additions & 8 deletions include/tvm/ir/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BaseExprNode : public Object {
refl::ObjectDef<BaseExprNode>().def_ro("span", &BaseExprNode::span, refl::DefaultValue(Span()));
}

static constexpr const char* _type_key = "BaseExpr";
static constexpr const char* _type_key = "ir.BaseExpr";
static constexpr const bool _type_has_method_visit_attrs = true;
static constexpr const bool _type_has_method_sequal_reduce = true;
static constexpr const bool _type_has_method_shash_reduce = true;
Expand Down Expand Up @@ -117,7 +117,7 @@ class PrimExprNode : public BaseExprNode {

TVM_OBJECT_ENABLE_SCRIPT_PRINTER();

static constexpr const char* _type_key = "PrimExpr";
static constexpr const char* _type_key = "ir.PrimExpr";
static constexpr const uint32_t _type_child_slots = 40;
TVM_DECLARE_BASE_OBJECT_INFO(PrimExprNode, BaseExprNode);
};
Expand Down Expand Up @@ -161,7 +161,7 @@ class PrimExprConvertibleNode : public Object {
virtual ~PrimExprConvertibleNode() {}
virtual PrimExpr ToPrimExpr() const = 0;

static constexpr const char* _type_key = "PrimExprConvertible";
static constexpr const char* _type_key = "ir.PrimExprConvertible";
TVM_DECLARE_BASE_OBJECT_INFO(PrimExprConvertibleNode, Object);
};

Expand Down Expand Up @@ -433,7 +433,7 @@ class RelaxExprNode : public BaseExprNode {
refl::ObjectDef<RelaxExprNode>().def_ro("struct_info_", &RelaxExprNode::struct_info_);
}

static constexpr const char* _type_key = "RelaxExpr";
static constexpr const char* _type_key = "ir.RelaxExpr";
static constexpr const uint32_t _type_child_slots = 22;
TVM_DECLARE_BASE_OBJECT_INFO(RelaxExprNode, BaseExprNode);
};
Expand Down Expand Up @@ -478,7 +478,7 @@ class GlobalVarNode : public RelaxExprNode {
hash_reduce.FreeVarHashImpl(this);
}

static constexpr const char* _type_key = "GlobalVar";
static constexpr const char* _type_key = "ir.GlobalVar";
TVM_DECLARE_FINAL_OBJECT_INFO(GlobalVarNode, RelaxExprNode);
};

Expand Down Expand Up @@ -517,7 +517,7 @@ class IntImmNode : public PrimExprNode {
hash_reduce(value);
}

static constexpr const char* _type_key = "IntImm";
static constexpr const char* _type_key = "ir.IntImm";
TVM_DECLARE_FINAL_OBJECT_INFO(IntImmNode, PrimExprNode);
};

Expand Down Expand Up @@ -565,7 +565,7 @@ class FloatImmNode : public PrimExprNode {
hash_reduce(value);
}

static constexpr const char* _type_key = "FloatImm";
static constexpr const char* _type_key = "ir.FloatImm";
TVM_DECLARE_FINAL_OBJECT_INFO(FloatImmNode, PrimExprNode);
};

Expand Down Expand Up @@ -718,7 +718,7 @@ class RangeNode : public Object {
hash_reduce(extent);
}

static constexpr const char* _type_key = "Range";
static constexpr const char* _type_key = "ir.Range";
static constexpr const bool _type_has_method_sequal_reduce = true;
static constexpr const bool _type_has_method_shash_reduce = true;
TVM_DECLARE_FINAL_OBJECT_INFO(RangeNode, Object);
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class BaseFuncNode : public RelaxExprNode {
refl::ObjectDef<BaseFuncNode>().def_ro("attrs", &BaseFuncNode::attrs);
}

static constexpr const char* _type_key = "BaseFunc";
static constexpr const char* _type_key = "ir.BaseFunc";
static constexpr const uint32_t _type_child_slots = 2;
TVM_DECLARE_BASE_OBJECT_INFO(BaseFuncNode, RelaxExprNode);
};
Expand Down
6 changes: 3 additions & 3 deletions include/tvm/ir/global_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ using MemoryScope = String;
*/
class GlobalInfoNode : public Object {
public:
static constexpr const char* _type_key = "GlobalInfo";
static constexpr const char* _type_key = "ir.GlobalInfo";
static constexpr const bool _type_has_method_sequal_reduce = true;
static constexpr const bool _type_has_method_shash_reduce = true;
TVM_DECLARE_BASE_OBJECT_INFO(GlobalInfoNode, Object);
Expand Down Expand Up @@ -90,7 +90,7 @@ class VDeviceNode : public GlobalInfoNode {
hash_reduce(vdevice_id);
hash_reduce(memory_scope);
}
static constexpr const char* _type_key = "VDevice";
static constexpr const char* _type_key = "ir.VDevice";
TVM_DECLARE_FINAL_OBJECT_INFO(VDeviceNode, GlobalInfoNode);
};

Expand All @@ -116,7 +116,7 @@ class DummyGlobalInfoNode : public GlobalInfoNode {

static constexpr bool _type_has_method_visit_attrs = false;

static constexpr const char* _type_key = "DummyGlobalInfo";
static constexpr const char* _type_key = "ir.DummyGlobalInfo";

TVM_DLL bool SEqualReduce(const DummyGlobalInfoNode* other, SEqualReducer equal) const {
return true;
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/global_var_supply.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class GlobalVarSupplyNode : public Object {
/*! \brief The NameSupply used to generate unique name hints to GlobalVars. */
NameSupply name_supply_;

static constexpr const char* _type_key = "GlobalVarSupply";
static constexpr const char* _type_key = "ir.GlobalVarSupply";
static constexpr const bool _type_has_method_sequal_reduce = false;
static constexpr const bool _type_has_method_shash_reduce = false;
TVM_DECLARE_FINAL_OBJECT_INFO(GlobalVarSupplyNode, Object);
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class IRModuleNode : public Object {

TVM_OBJECT_ENABLE_SCRIPT_PRINTER();

static constexpr const char* _type_key = "IRModule";
static constexpr const char* _type_key = "ir.IRModule";
static constexpr const bool _type_has_method_sequal_reduce = true;
static constexpr const bool _type_has_method_shash_reduce = true;
TVM_DECLARE_FINAL_OBJECT_INFO(IRModuleNode, Object);
Expand Down
2 changes: 1 addition & 1 deletion include/tvm/ir/name_supply.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class NameSupplyNode : public Object {
// Prefix for all GlobalVar names. It can be empty.
std::string prefix_;

static constexpr const char* _type_key = "NameSupply";
static constexpr const char* _type_key = "ir.NameSupply";
static constexpr const bool _type_has_method_sequal_reduce = false;
static constexpr const bool _type_has_method_shash_reduce = false;
TVM_DECLARE_FINAL_OBJECT_INFO(NameSupplyNode, Object);
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 @@ -115,7 +115,7 @@ class OpNode : public RelaxExprNode {
hash_reduce(name);
}

static constexpr const char* _type_key = "Op";
static constexpr const char* _type_key = "ir.Op";
TVM_DECLARE_FINAL_OBJECT_INFO(OpNode, RelaxExprNode);

private:
Expand Down
10 changes: 5 additions & 5 deletions include/tvm/ir/source_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SourceNameNode : public Object {
return equal(name, other->name);
}

static constexpr const char* _type_key = "SourceName";
static constexpr const char* _type_key = "ir.SourceName";
TVM_DECLARE_FINAL_OBJECT_INFO(SourceNameNode, Object);
};

Expand Down Expand Up @@ -122,7 +122,7 @@ class SpanNode : public Object {
equal(end_column, other->end_column);
}

static constexpr const char* _type_key = "Span";
static constexpr const char* _type_key = "ir.Span";
TVM_DECLARE_BASE_OBJECT_INFO(SpanNode, Object);
};

Expand Down Expand Up @@ -151,7 +151,7 @@ class SequentialSpanNode : public SpanNode {

static constexpr bool _type_has_method_visit_attrs = false;

static constexpr const char* _type_key = "SequentialSpan";
static constexpr const char* _type_key = "ir.SequentialSpan";
TVM_DECLARE_FINAL_OBJECT_INFO(SequentialSpanNode, SpanNode);

bool SEqualReduce(const SequentialSpanNode* other, SEqualReducer equal) const {
Expand Down Expand Up @@ -208,7 +208,7 @@ class SourceNode : public Object {

static constexpr bool _type_has_method_visit_attrs = false;

static constexpr const char* _type_key = "Source";
static constexpr const char* _type_key = "ir.Source";
TVM_DECLARE_FINAL_OBJECT_INFO(SourceNode, Object);
};

Expand Down Expand Up @@ -243,7 +243,7 @@ class SourceMapObj : public Object {
return equal(source_map, other->source_map);
}

static constexpr const char* _type_key = "SourceMap";
static constexpr const char* _type_key = "ir.SourceMap";
TVM_DECLARE_FINAL_OBJECT_INFO(SourceMapObj, Object);
};

Expand Down
19 changes: 12 additions & 7 deletions include/tvm/ir/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class TypeNode : public Object {
*/
mutable Span span;

static constexpr const char* _type_key = "Type";
static constexpr const char* _type_key = "ir.Type";
static constexpr const bool _type_has_method_sequal_reduce = true;
static constexpr const bool _type_has_method_shash_reduce = true;
static constexpr const uint32_t _type_child_slots = 14;
Expand Down Expand Up @@ -124,7 +124,7 @@ class PrimTypeNode : public TypeNode {

void SHashReduce(SHashReducer hash_reduce) const { hash_reduce(dtype); }

static constexpr const char* _type_key = "PrimType";
static constexpr const char* _type_key = "ir.PrimType";
TVM_DECLARE_FINAL_OBJECT_INFO(PrimTypeNode, TypeNode);
};

Expand Down Expand Up @@ -187,7 +187,7 @@ class PointerTypeNode : public TypeNode {
hash_reduce(storage_scope.empty() ? "global" : storage_scope);
}

static constexpr const char* _type_key = "PointerType";
static constexpr const char* _type_key = "ir.PointerType";
TVM_DECLARE_FINAL_OBJECT_INFO(PointerTypeNode, TypeNode);
};

Expand Down Expand Up @@ -233,7 +233,7 @@ class TupleTypeNode : public TypeNode {

void SHashReduce(SHashReducer hash_reduce) const { hash_reduce(fields); }

static constexpr const char* _type_key = "TupleType";
static constexpr const char* _type_key = "ir.TupleType";
TVM_DECLARE_FINAL_OBJECT_INFO(TupleTypeNode, TypeNode);
};

Expand Down Expand Up @@ -308,7 +308,7 @@ class FuncTypeNode : public TypeNode {
hash_reduce(ret_type);
}

static constexpr const char* _type_key = "FuncType";
static constexpr const char* _type_key = "ir.FuncType";
TVM_DECLARE_FINAL_OBJECT_INFO(FuncTypeNode, TypeNode);
};

Expand Down Expand Up @@ -336,15 +336,20 @@ class FuncType : public Type {
*/
class TensorMapTypeNode : public TypeNode {
public:
void VisitAttrs(AttrVisitor* v) { v->Visit("span", &span); }
static void RegisterReflection() {
namespace refl = tvm::ffi::reflection;
refl::ObjectDef<TensorMapTypeNode>().def_ro("span", &TensorMapTypeNode::span);
}

static constexpr bool _type_has_method_visit_attrs = false;

bool SEqualReduce(const TensorMapTypeNode* other, SEqualReducer equal) const {
return equal(span, other->span);
}

void SHashReduce(SHashReducer hash_reduce) const { hash_reduce(span); }

static constexpr const char* _type_key = "TensorMapType";
static constexpr const char* _type_key = "ir.TensorMapType";
TVM_DECLARE_FINAL_OBJECT_INFO(TensorMapTypeNode, TypeNode);
};

Expand Down
Loading
Loading