[TIR] Improve Let/LetStmt support. (#5949)
authorTianqi Chen <tqchen@users.noreply.github.com>
Sun, 28 Jun 2020 16:22:11 +0000 (09:22 -0700)
committerGitHub <noreply@github.com>
Sun, 28 Jun 2020 16:22:11 +0000 (09:22 -0700)
commit4fbfaca5fc417b09330f7592b21efdc6fb1cf51b
tree83e078b2656bebc56461f7ebb5edfd0dfcae5e3a
parentbdc55470d503f8dfa1cb992a7e19164e111794a3
[TIR] Improve Let/LetStmt support. (#5949)

Let/LetStmt are useful primitives to create variable bindings.
While let binding are harmful for simplification and integer analysis,
they are useful for other cases:

- C0: LetStmt is useful to represent a step that has side effect(e.g. call a PRNG)
- C1: Let expression can be used to create deep nested expression for complicated functions.

This PR improves the let support in the following ways:
- Enable vectorization support for let
- Change let simplification strategy to simplify the most trivial case
  while ignore more complicated cases(to avoid deep nest explosion)
- Enhance arith module to handle const bound and modular set for let.

The overall recommendation is to only use Let in the cases when necessary(C0, C1).
23 files changed:
include/tvm/arith/analyzer.h
include/tvm/tir/op.h
src/arith/analyzer.cc
src/arith/const_int_bound.cc
src/arith/modular_set.cc
src/arith/rewrite_simplify.cc
src/arith/rewrite_simplify.h
src/contrib/hybrid/codegen_hybrid.cc
src/printer/tir_text_printer.cc
src/target/source/codegen_c.cc
src/target/source/codegen_cuda.cc
src/target/stackvm/codegen_stackvm.cc
src/tir/analysis/verify_ssa.cc
src/tir/op/op.cc
src/tir/transforms/loop_partition.cc
src/tir/transforms/simplify.cc
src/tir/transforms/split_host_device.cc
src/tir/transforms/vectorize_loop.cc
tests/python/unittest/test_arith_const_int_bound.py
tests/python/unittest/test_arith_modular_set.py
tests/python/unittest/test_tir_analysis_verify_ssa.py
tests/python/unittest/test_tir_nodes.py
tests/python/unittest/test_tir_transform_vectorize.py