pytorch/test/cpp/tensorexpr
Raghavan Raman 13ac0019ae [NNC] Update loop-carried dependence check to handle all known dependences (#56354)
Summary:
This PR includes:
 * Update to the loop-carried dependence check API to correctly ignore loop-independent dependences and handle all kinds of loop-carried dependences like RAW, WAR and WAW.
 * Fix for the overlap API to look only for conflicting buffer accesses where at least one of them is a Store.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/56354

Reviewed By: bertmaher

Differential Revision: D27856202

Pulled By: navahgar

fbshipit-source-id: 206e4ec771fe0f7f2ccf4b11b29e35df7b9b18bc
2021-04-20 17:12:51 -07:00
..
CMakeLists.txt
gtest_assert_float_eq.h
padded_buffer.cpp
padded_buffer.h
README.md
test_approx.cpp
test_aten.cpp
test_base.h
test_boundsinference.cpp [NNC] Update loop-carried dependence check to handle all known dependences (#56354) 2021-04-20 17:12:51 -07:00
test_conv.cpp NNC depthwise conv2d implementation (#54920) 2021-04-08 21:56:53 -07:00
test_cpp_codegen.cpp
test_cuda.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00
test_expr.cpp [TensorExpr] Remove mask field from Load and Store classes. (#55825) 2021-04-13 12:08:51 -07:00
test_external_calls.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00
test_ir_printer.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00
test_ir_verifier.cpp [TensorExpr] Remove mask field from Load and Store classes. (#55825) 2021-04-13 12:08:51 -07:00
test_kernel.cpp [TensorExpr] Add support for constant tensors in tensorexpr kernel. (#56319) 2021-04-17 11:15:35 -07:00
test_llvm.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00
test_loopnest.cpp [NNC] Update loop-carried dependence check to handle all known dependences (#56354) 2021-04-20 17:12:51 -07:00
test_memdependency.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00
test_reductions.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00
test_registerizer.cpp [TensorExpr] Remove mask field from Load and Store classes. (#55825) 2021-04-13 12:08:51 -07:00
test_simplify.cpp [TensorExpr] Remove mask field from Load and Store classes. (#55825) 2021-04-13 12:08:51 -07:00
test_te_fuser_pass.cpp Reland: D27652485: [nnc] Enable CPU fusion only when num_threads == 1" (#56120) 2021-04-15 15:50:18 -07:00
test_train.cpp
test_train.h
test_train_impl.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00
test_type.cpp
test_utils.h
tutorial.cpp [TensorExpr] Rename Tensor::call to Tensor::load to be consistent with Buf and Placeholder. (#55826) 2021-04-13 12:08:53 -07:00

TensorExpr C++ Tests

How to add a new test

First, create a new test file. Test files should have be placed in this directory, with a name that starts with test_, like test_foo.cpp.

Here is an example test file you can copy-paste.

#include <test/cpp/tensorexpr/test_base.h>

// Tests go in torch::jit
namespace torch {
namespace jit {

// 1. Test cases are void() functions.
// 2. They start with the prefix `test`
void testCaseOne() {
    // ...
}

void testCaseTwo() {
    // ...
}
}
}

Then, register your test in tests.h:

// Add to TH_FORALL_TESTS_CUDA instead for CUDA-requiring tests
#define TH_FORALL_TESTS(_)             \
  _(ADFormulas)                        \
  _(Attributes)                        \
  ...
  _(CaseOne)  // note that the `test` prefix is omitted.
  _(CaseTwo)

We glob all the test files together in CMakeLists.txt so that you don't have to edit it every time you add a test. Unfortunately, this means that in order to get the build to pick up your new test file, you need to re-run cmake:

python setup.py build --cmake

How do I run the tests?

The following commands assume you are in PyTorch root.

# (re)build the test binary
ninja build/bin/test_tensorexpr
# run
build/bin/test_tensorexpr --gtest_filter='glob_style_filter*'