[NODE][REFACTOR] Rename IRFunctor->NodeFunctor, use func pointer (#4247)
authorTianqi Chen <tqchen@users.noreply.github.com>
Fri, 1 Nov 2019 23:34:42 +0000 (16:34 -0700)
committerGitHub <noreply@github.com>
Fri, 1 Nov 2019 23:34:42 +0000 (16:34 -0700)
commit9a3d2ec97cba92697a032ec32fecd122a34ecfa5
tree7b613db38f403dff4aeb3442e5334f1a6b60ea35
parent2083513fcd06e7126465a48fd1b0d6faa288df3e
[NODE][REFACTOR] Rename IRFunctor->NodeFunctor, use func pointer (#4247)

* [NODE][REFACTOR] Rename IRFunctor->NodeFunctor, use function pointer for dispatching.

Previously we used std::function for the functor dispatching.
It introduces additional overhead and problems during dll destruction(of std::function).

This PR changes the std::function to function pointers.
This change a bit restrictions around the set_dispatch that we can get around,
but will improve the general efficiency by reducing one level of indirection in the std::function.
We also no longer need special marcos to register functions to the Functor.
50 files changed:
include/tvm/expr.h
include/tvm/ir_functor_ext.h
include/tvm/ir_mutator.h
include/tvm/ir_visitor.h
include/tvm/node/functor.h [new file with mode: 0644]
include/tvm/node/ir_functor.h [deleted file]
include/tvm/node/reflection.h
include/tvm/relay/expr_functor.h
include/tvm/relay/pattern_functor.h
nnvm/src/compiler/compile_engine.cc
nnvm/src/compiler/graph_hash.cc
nnvm/src/compiler/graph_runtime.cc
src/arithmetic/const_int_bound.cc
src/arithmetic/int_set.cc
src/arithmetic/modular_set.cc
src/codegen/build_module.cc
src/lang/api_registry.cc
src/lang/attr_functor.h
src/lang/attrs.cc
src/lang/buffer.cc
src/lang/channel.cc
src/lang/data_layout.cc
src/lang/expr.cc
src/lang/ir.cc
src/lang/lowered_func.cc
src/lang/target_info.cc
src/lang/tensor.cc
src/op/compute_op.cc
src/op/extern_op.cc
src/op/hybrid_op.cc
src/op/placeholder_op.cc
src/op/scan_op.cc
src/op/tensor_compute_op.cc
src/pass/ir_mutator.cc
src/pass/ir_visitor.cc
src/relay/backend/graph_runtime_codegen.cc
src/relay/backend/interpreter.cc
src/relay/ir/adt.cc
src/relay/ir/base.cc
src/relay/ir/expr.cc
src/relay/ir/module.cc
src/relay/ir/op.cc
src/relay/ir/type.cc
src/relay/ir/type_functor.h
src/relay/pass/pass_manager.cc
src/relay/pass/quantize/quantize.cc
src/schedule/schedule_lang.cc
tests/cpp/attrs_test.cc
tests/cpp/ir_functor_test.cc
tests/cpp/ir_mutator_test.cc