[REFACTOR][IR] Initialize Unified IR Expr Data Structure (#4673)
authorTianqi Chen <tqchen@users.noreply.github.com>
Sat, 11 Jan 2020 03:27:00 +0000 (19:27 -0800)
committerGitHub <noreply@github.com>
Sat, 11 Jan 2020 03:27:00 +0000 (19:27 -0800)
commit12e51e6c4a4578c39e6e19823742358386944776
tree0b9d469b819fd89dfb54e6d807bb1d0de2f4bc0a
parent86092de0b6fd22f22b0faa9c9fc56e09c3392dab
[REFACTOR][IR] Initialize Unified IR Expr Data Structure (#4673)

This PR moves a few base types from relay and low-level Expr into the ir sub-folder.
These classes will serve as a common type system across the stack.

Rationale:

- PrimExpr for low-level expressions
- RelayExpr for advanced features, including Function definition.
- Introduce BaseFunc to host all functions, including future PrimFunc(low-level expr functions, subject to discussion).

This is a minimum change we can do to unify the classes into a common hierarchy.
The main data structure that are variant specific will still be kept in the sub-namespaces.
We only include classes that is needed to allow a common Module class.
- BaseFunc
- GlobalVar
- Type definition part of ADT

We will only need the BaseFunc and their checked_type to decide the calling convention
across the function variants.
21 files changed:
include/tvm/expr.h
include/tvm/ir/adt.h [new file with mode: 0644]
include/tvm/ir/expr.h [new file with mode: 0644]
include/tvm/ir/type.h
include/tvm/relay/adt.h
include/tvm/relay/expr.h
include/tvm/relay/feature.h
include/tvm/relay/op.h
include/tvm/runtime/object.h
src/ir/adt.cc [new file with mode: 0644]
src/ir/expr.cc [new file with mode: 0644]
src/relay/backend/compile_engine.cc
src/relay/backend/vm/lambda_lift.cc
src/relay/ir/adt.cc
src/relay/ir/base.cc
src/relay/ir/expr.cc
src/relay/ir/module.cc
src/relay/pass/fold_constant.cc
src/relay/pass/to_cps.cc
src/relay/pass/type_solver.cc
tests/cpp/relay_pass_type_infer_test.cc