[TensorExpr] Add a wrapper for all expr and stmt pointers. (#63195)
authorMikhail Zolotukhin <mvz@fb.com>
Tue, 17 Aug 2021 20:39:36 +0000 (13:39 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 17 Aug 2021 20:44:45 +0000 (13:44 -0700)
commit1dc2b52764a81288cb0e31bb7a72fe8c4cc826a1
tree0e28cb31dc09d6f0608c9d18819e998511440f99
parenta2db5d34a53e5c61042f1d152a975d1e2efb3a0b
[TensorExpr] Add a wrapper for all expr and stmt pointers. (#63195)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63195

This helps us to later switch from using KernelArena with raw pointers
to shared pointers without having to change all our source files at
once.

The changes are mechanical and should not affect any functionality.

With this PR, we're changing the following:
 * `Add*` --> `AddPtr`
 * `new Add(...)` --> `alloc<Add>(...)`
 * `dynamic_cast<Add*>` --> `to<Add>`
 * `static_cast<Add*>` --> `static_to<Add>`

Due to some complications with args forwarding, some places became more
verbose, e.g.:
 * `new Block({})` --> `new Block(std::vector<ExprPtr>())`

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D30292779

Pulled By: ZolotukhinM

fbshipit-source-id: 150301c7d2df56b608b035827b6a9a87f5e2d9e9
78 files changed:
test/cpp/tensorexpr/test_approx.cpp
test/cpp/tensorexpr/test_aten.cpp
test/cpp/tensorexpr/test_boundsinference.cpp
test/cpp/tensorexpr/test_conv.cpp
test/cpp/tensorexpr/test_cpp_codegen.cpp
test/cpp/tensorexpr/test_cuda.cpp
test/cpp/tensorexpr/test_expr.cpp
test/cpp/tensorexpr/test_external_calls.cpp
test/cpp/tensorexpr/test_ir_printer.cpp
test/cpp/tensorexpr/test_ir_verifier.cpp
test/cpp/tensorexpr/test_kernel.cpp
test/cpp/tensorexpr/test_llvm.cpp
test/cpp/tensorexpr/test_loopnest.cpp
test/cpp/tensorexpr/test_memdependency.cpp
test/cpp/tensorexpr/test_reductions.cpp
test/cpp/tensorexpr/test_registerizer.cpp
test/cpp/tensorexpr/test_simplify.cpp
test/cpp/tensorexpr/test_utils.h
test/cpp/tensorexpr/tutorial.cpp
torch/csrc/jit/runtime/static/ops.cpp
torch/csrc/jit/tensorexpr/analysis.h
torch/csrc/jit/tensorexpr/block_codegen.cpp
torch/csrc/jit/tensorexpr/block_codegen.h
torch/csrc/jit/tensorexpr/bounds_inference.cpp
torch/csrc/jit/tensorexpr/bounds_inference.h
torch/csrc/jit/tensorexpr/bounds_overlap.cpp
torch/csrc/jit/tensorexpr/bounds_overlap.h
torch/csrc/jit/tensorexpr/codegen.cpp
torch/csrc/jit/tensorexpr/codegen.h
torch/csrc/jit/tensorexpr/cpp_codegen.cpp
torch/csrc/jit/tensorexpr/cpp_codegen.h
torch/csrc/jit/tensorexpr/cuda_codegen.cpp
torch/csrc/jit/tensorexpr/cuda_codegen.h
torch/csrc/jit/tensorexpr/eval.cpp
torch/csrc/jit/tensorexpr/eval.h
torch/csrc/jit/tensorexpr/exceptions.h
torch/csrc/jit/tensorexpr/expr.cpp
torch/csrc/jit/tensorexpr/expr.h
torch/csrc/jit/tensorexpr/fwd_decls.h [new file with mode: 0644]
torch/csrc/jit/tensorexpr/half_support.h
torch/csrc/jit/tensorexpr/hash_provider.cpp
torch/csrc/jit/tensorexpr/hash_provider.h
torch/csrc/jit/tensorexpr/ir.cpp
torch/csrc/jit/tensorexpr/ir.h
torch/csrc/jit/tensorexpr/ir_cloner.cpp
torch/csrc/jit/tensorexpr/ir_cloner.h
torch/csrc/jit/tensorexpr/ir_mutator.cpp
torch/csrc/jit/tensorexpr/ir_mutator.h
torch/csrc/jit/tensorexpr/ir_printer.cpp
torch/csrc/jit/tensorexpr/ir_printer.h
torch/csrc/jit/tensorexpr/ir_simplifier.cpp
torch/csrc/jit/tensorexpr/ir_simplifier.h
torch/csrc/jit/tensorexpr/ir_verifier.cpp
torch/csrc/jit/tensorexpr/ir_verifier.h
torch/csrc/jit/tensorexpr/ir_visitor.cpp
torch/csrc/jit/tensorexpr/ir_visitor.h
torch/csrc/jit/tensorexpr/kernel.cpp
torch/csrc/jit/tensorexpr/kernel.h
torch/csrc/jit/tensorexpr/llvm_codegen.cpp
torch/csrc/jit/tensorexpr/llvm_codegen.h
torch/csrc/jit/tensorexpr/loopnest.cpp
torch/csrc/jit/tensorexpr/loopnest.h
torch/csrc/jit/tensorexpr/mem_dependency_checker.cpp
torch/csrc/jit/tensorexpr/mem_dependency_checker.h
torch/csrc/jit/tensorexpr/operators/conv2d.cpp
torch/csrc/jit/tensorexpr/operators/matmul.cpp
torch/csrc/jit/tensorexpr/operators/softmax.cpp
torch/csrc/jit/tensorexpr/reduction.cpp
torch/csrc/jit/tensorexpr/reduction.h
torch/csrc/jit/tensorexpr/registerizer.cpp
torch/csrc/jit/tensorexpr/registerizer.h
torch/csrc/jit/tensorexpr/stmt.h
torch/csrc/jit/tensorexpr/tensor.cpp
torch/csrc/jit/tensorexpr/tensor.h
torch/csrc/jit/tensorexpr/tensorexpr_init.cpp
torch/csrc/jit/tensorexpr/unique_name_manager.cpp
torch/csrc/jit/tensorexpr/unique_name_manager.h
torch/csrc/jit/tensorexpr/var_substitutor.h