[RUNTIME][OBJECT] Introduce static slots for common objects. (#5423)
authorTianqi Chen <tqchen@users.noreply.github.com>
Fri, 24 Apr 2020 19:49:05 +0000 (12:49 -0700)
committerGitHub <noreply@github.com>
Fri, 24 Apr 2020 19:49:05 +0000 (12:49 -0700)
commit3cc4971990b19ac250853b140e5bba20c332bf8d
tree3de34daa503e89de4c9729cdc64f66389409b8d3
parent96873076ebe895f967a04886cbcc95d209ee3980
[RUNTIME][OBJECT] Introduce static slots for common objects. (#5423)

The _type_child_slots can be used to enable quick type checking optimization
by checking the whether the type index is within the bound.

This PR enables these static slots:

- Introduce a static assert to avoid the scenario when a developer forget to
  _type_child_slots when the field is set for the type's parent.
- Revamp and assign static type index to common runtime objects
- Add a DumpTypeTable call to allow developer monitor the current situation
  of type table and offers suggestions for the slots(ideally the slots equals
  the number of children so there is no overflow.
29 files changed:
include/tvm/ir/expr.h
include/tvm/ir/function.h
include/tvm/ir/tensor_type.h
include/tvm/ir/type.h
include/tvm/relay/expr.h
include/tvm/runtime/container.h
include/tvm/runtime/ndarray.h
include/tvm/runtime/object.h
include/tvm/runtime/packed_func.h
include/tvm/runtime/vm.h
include/tvm/tir/stmt.h
include/tvm/tir/var.h
python/tvm/relay/quantize/quantize.py
python/tvm/runtime/container.py
python/tvm/runtime/ndarray.py
src/arith/canonical_simplify.cc
src/runtime/module.cc
src/runtime/object.cc
src/target/codegen.cc
src/target/opt/build_cuda_on.cc
src/target/source/codegen_opencl.cc
src/target/source/codegen_opengl.cc
src/target/spirv/build_vulkan.cc
src/target/stackvm/codegen_stackvm.cc
tests/cpp/build_module_test.cc
tests/cpp/object_protocol_test.cc
tests/cpp/relay_build_module_test.cc
tests/cpp/utvm_runtime_standalone_test.cc
tests/python/unittest/test_te_schedule_graph.py