[REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol. (#4161)
authorTianqi Chen <tqchen@users.noreply.github.com>
Mon, 21 Oct 2019 01:30:41 +0000 (18:30 -0700)
committerGitHub <noreply@github.com>
Mon, 21 Oct 2019 01:30:41 +0000 (18:30 -0700)
commit7895adb243ea6fbb1b434904ff3925c3a84f5693
tree388156cb3840224cd18ed8b3768db8584d15d3de
parent97ea31c8f5d460c5ec401b146cfb16481bef6641
[REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol. (#4161)

* [REFACTOR][NODE][RUNTIME] Move Node to the new Object protocol.

This PR removes the original node system, and make node as a subclass of Object.
This is a major refactor towards a better unified runtime object system.

List of changes in the refactor:

- We now hide data_ field, use Downcast explicitly to get a sub-class object.
- Removed the node system FFI in python.
- Removed the node C API, instead use PackedFunc for list and get attrs.
- Change relay::Op::set_attr_type_key(attr_key_name) to relay::Op::set_attr_type<AttrType>().
  - This change was necessary because of the new Object registration mechanism.
  - Subsequent changes to the op registrations
  - The change revealed a few previous problems that is now fixed.
- Patched up a few missing node type registration.
  - Now we will raise an error if we register object that is not registered.
- The original node.h and container.h are kept in the same location.
- Calling convention: kObjectHandle now equals the old kNodeHandle, kNodeHandle is removed.
- IRFunctor now dispatches on ObjectRef.
- Update to the new type checking API: is_type, derived_from are replaced by IsInstance.
- Removed .hash member function, instead use C++ convention hasher functors.

* Address review comments
185 files changed:
golang/src/value.go
include/tvm/api_registry.h
include/tvm/arithmetic.h
include/tvm/attrs.h
include/tvm/base.h
include/tvm/buffer.h
include/tvm/build_module.h
include/tvm/c_dsl_api.h [deleted file]
include/tvm/channel.h
include/tvm/data_layout.h
include/tvm/expr.h
include/tvm/ir.h
include/tvm/ir_functor_ext.h
include/tvm/ir_mutator.h
include/tvm/ir_visitor.h
include/tvm/lowered_func.h
include/tvm/node/container.h
include/tvm/node/ir_functor.h
include/tvm/node/memory.h [deleted file]
include/tvm/node/node.h
include/tvm/operation.h
include/tvm/packed_func_ext.h
include/tvm/relay/adt.h
include/tvm/relay/base.h
include/tvm/relay/expr.h
include/tvm/relay/expr_functor.h
include/tvm/relay/interpreter.h
include/tvm/relay/module.h
include/tvm/relay/op.h
include/tvm/relay/pattern_functor.h
include/tvm/relay/transform.h
include/tvm/relay/type.h
include/tvm/runtime/c_runtime_api.h
include/tvm/runtime/memory.h
include/tvm/runtime/node_base.h [deleted file]
include/tvm/runtime/object.h
include/tvm/runtime/packed_func.h
include/tvm/schedule.h
include/tvm/tensor.h
include/tvm/tensor_intrin.h
jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc
nnvm/include/nnvm/compiler/util.h
nnvm/src/compiler/compile_engine.cc
nnvm/src/compiler/compile_engine.h
nnvm/src/compiler/graph_runtime.h
nnvm/src/compiler/packed_func_ext.cc
nnvm/src/top/tensor/transform.cc
python/tvm/_ffi/_ctypes/function.py
python/tvm/_ffi/_ctypes/node.py [deleted file]
python/tvm/_ffi/_ctypes/object.py
python/tvm/_ffi/_cython/base.pxi
python/tvm/_ffi/_cython/core.pyx
python/tvm/_ffi/_cython/function.pxi
python/tvm/_ffi/_cython/node.pxi [deleted file]
python/tvm/_ffi/_cython/object.pxi
python/tvm/_ffi/node.py
python/tvm/_ffi/object.py
python/tvm/_ffi/runtime_ctypes.py
python/tvm/error.py
python/tvm/relay/backend/profiler_vm.py
python/tvm/relay/debug.py
rust/common/src/packed_func.rs
rust/frontend/src/function.rs
src/api/api_arith.cc
src/api/api_base.cc
src/api/api_codegen.cc
src/api/api_ir.cc
src/api/api_lang.cc
src/api/api_pass.cc
src/api/api_schedule.cc
src/api/dsl_api.cc
src/arithmetic/analyzer.cc
src/arithmetic/canonical_simplify.cc
src/arithmetic/const_int_bound.cc
src/arithmetic/detect_linear_equation.cc
src/arithmetic/int_set.cc
src/arithmetic/ir_mutator_with_analyzer.cc
src/arithmetic/ir_visitor_with_analyzer.h
src/arithmetic/modular_set.cc
src/codegen/build_module.cc
src/codegen/codegen_c.cc
src/codegen/llvm/codegen_llvm.cc
src/codegen/spirv/codegen_spirv.cc
src/contrib/hybrid/codegen_hybrid.cc
src/contrib/hybrid/codegen_hybrid.h
src/lang/attr_functor.h
src/lang/attrs.cc
src/lang/data_layout.cc
src/lang/expr.cc
src/lang/ir.cc
src/lang/reflection.cc
src/node/node.cc [deleted file]
src/op/compute_op.cc
src/op/hybrid_op.cc
src/op/op_util.cc
src/op/tensorize.cc
src/pass/arg_binder.cc
src/pass/coproc_sync.cc
src/pass/hoist_if_then_else.cc
src/pass/inject_copy_intrin.cc
src/pass/inject_double_buffer.cc
src/pass/inject_prefetch.cc
src/pass/inject_virtual_thread.cc
src/pass/ir_mutator.cc
src/pass/lift_attr_scope.cc
src/pass/lower_thread_allreduce.cc
src/pass/lower_warp_memory.cc
src/pass/make_api.cc
src/pass/narrow_channel_access.cc
src/pass/remap_thread_axis.cc
src/pass/split_host_device.cc
src/pass/split_pipeline.cc
src/pass/storage_access.cc
src/pass/storage_flatten.cc
src/pass/storage_rewrite.cc
src/pass/storage_sync.cc
src/pass/unroll_loop.cc
src/pass/vectorize_loop.cc
src/pass/verify_memory.cc
src/relay/backend/compile_engine.cc
src/relay/backend/compile_engine.h
src/relay/backend/graph_runtime_codegen.cc
src/relay/ir/alpha_equal.cc
src/relay/ir/expr_functor.cc
src/relay/ir/hash.cc
src/relay/ir/module.cc
src/relay/ir/op.cc
src/relay/ir/pretty_printer.cc
src/relay/ir/type_functor.h
src/relay/op/algorithm/argsort.cc
src/relay/op/algorithm/topk.cc
src/relay/op/debug.cc
src/relay/op/image/resize.cc
src/relay/op/nn/bitserial.cc
src/relay/op/nn/convolution.cc
src/relay/op/nn/nn.cc
src/relay/op/nn/pad.cc
src/relay/op/nn/pooling.cc
src/relay/op/nn/sparse.cc
src/relay/op/nn/upsampling.cc
src/relay/op/tensor/reduce.cc
src/relay/op/tensor/transform.cc
src/relay/op/tensor/unary.cc
src/relay/op/vision/multibox_op.cc
src/relay/op/vision/yolo.cc
src/relay/pass/alter_op_layout.cc
src/relay/pass/device_annotation.cc
src/relay/pass/eta_expand.cc
src/relay/pass/fold_constant.cc
src/relay/pass/fold_scale_axis.cc
src/relay/pass/partial_eval.cc
src/relay/pass/pass_manager.cc
src/relay/pass/quantize/annotate.cc
src/relay/pass/quantize/partition.cc
src/relay/pass/quantize/quantize.cc
src/relay/pass/quantize/quantize.h
src/relay/pass/quantize/realize.cc
src/relay/pass/type_infer.cc
src/relay/pass/type_solver.cc
src/relay/qnn/op/concatenate.cc
src/relay/qnn/op/convolution.cc
src/relay/qnn/op/dense.cc
src/relay/qnn/op/dequantize.cc
src/relay/qnn/op/quantize.cc
src/relay/qnn/op/requantize.cc
src/runtime/c_dsl_api.cc [deleted file]
src/runtime/c_runtime_api.cc
src/runtime/dsl_api.h [deleted file]
src/runtime/object.cc
src/schedule/graph.cc
src/schedule/schedule_dataflow_rewrite.cc
src/schedule/schedule_lang.cc
src/schedule/schedule_ops.cc
tests/cpp/expr_test.cc
tests/cpp/ir_functor_test.cc
tests/cpp/object_protocol_test.cc
tests/cpp/packed_func_test.cc
tests/python/unittest/test_lang_schedule.py
tests/python/unittest/test_runtime_vm_profiler.py
topi/include/topi/cuda/pooling.h
topi/include/topi/cuda/reduction.h
topi/include/topi/detail/constant_utils.h
topi/include/topi/generic/extern.h
topi/src/topi.cc
web/tvm_runtime.js