[IR][TRANSFORM] Enable CopyOnWrite for passes. (#5309)
authorTianqi Chen <tqchen@users.noreply.github.com>
Sun, 12 Apr 2020 00:42:42 +0000 (17:42 -0700)
committerGitHub <noreply@github.com>
Sun, 12 Apr 2020 00:42:42 +0000 (17:42 -0700)
commite4b80bda71bfad9874c6d418ac8127f675d5b1d0
tree974f971e4f1df2595e075b1a40d4017e95b12372
parent5b37d4c15378e872c279ca5edbcb077d1a5fd20b
[IR][TRANSFORM] Enable CopyOnWrite for passes. (#5309)

This PR enables the copy on write optimizations passes:
- Enable COW for IRModule both TIR and relay passes.
- Enabled COW for PrimFunc in TIR passes.

Need more thoughts into whether/how to enable COW
for relay::Function, due to some function passes depend
on the presence of IRModule for context information,
and the std::move of the related function to nullptr
might affect the related behavior.
23 files changed:
include/tvm/ir/expr.h
include/tvm/ir/transform.h
include/tvm/runtime/data_type.h
include/tvm/runtime/object.h
include/tvm/runtime/packed_func.h
include/tvm/tir/transform.h
python/tvm/error.py
python/tvm/tir/transform/transform.py
src/ir/expr.cc
src/ir/module.cc
src/ir/transform.cc
src/node/container.cc
src/relay/ir/transform.cc
src/support/str_escape.h [new file with mode: 0644]
src/tir/ir/expr.cc
src/tir/ir/transform.cc
src/tir/transforms/narrow_datatype.cc
src/tir/transforms/split_host_device.cc
tests/cpp/packed_func_test.cc
tests/python/unittest/test_tir_transform_narrow_datatype.py
tests/python/unittest/test_tir_transform_prim_func_pass.py
topi/include/topi/util.h
topi/src/broadcast.cc