|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| CMakeLists.txt | H A D | 25-Apr-2025 | 3 KiB | 82 | 72 |
| README.md | H A D | 25-Apr-2025 | 1.3 KiB | 56 | 46 |
| gtest_assert_float_eq.h | H A D | 25-Apr-2025 | 4.6 KiB | 120 | 31 |
| padded_buffer.cpp | H A D | 25-Apr-2025 | 947 | 38 | 31 |
| padded_buffer.h | H A D | 25-Apr-2025 | 6.9 KiB | 243 | 203 |
| test_approx.cpp | H A D | 25-Apr-2025 | 2.9 KiB | 97 | 76 |
| test_aten.cpp | H A D | 25-Apr-2025 | 30.6 KiB | 1,069 | 860 |
| test_base.h | H A D | 25-Apr-2025 | 2.8 KiB | 90 | 80 |
| test_boundsinference.cpp | H A D | 25-Apr-2025 | 34.3 KiB | 1,023 | 700 |
| test_conv.cpp | H A D | 25-Apr-2025 | 6.7 KiB | 235 | 185 |
| test_cpp_codegen.cpp | H A D | 25-Apr-2025 | 7 KiB | 260 | 222 |
| test_cuda.cpp | H A D | 25-Apr-2025 | 72 KiB | 2,345 | 1,853 |
| test_dynamic_shapes.cpp | H A D | 25-Apr-2025 | 24.4 KiB | 702 | 549 |
| test_expr.cpp | H A D | 25-Apr-2025 | 25.5 KiB | 837 | 668 |
| test_external_calls.cpp | H A D | 25-Apr-2025 | 36.7 KiB | 1,059 | 882 |
| test_graph_opt.cpp | H A D | 25-Apr-2025 | 10.4 KiB | 320 | 264 |
| test_ir_printer.cpp | H A D | 25-Apr-2025 | 2.3 KiB | 91 | 71 |
| test_ir_verifier.cpp | H A D | 25-Apr-2025 | 6.6 KiB | 192 | 143 |
| test_kernel.cpp | H A D | 25-Apr-2025 | 75.8 KiB | 2,134 | 1,774 |
| test_llvm.cpp | H A D | 25-Apr-2025 | 49.8 KiB | 1,800 | 1,494 |
| test_loopnest.cpp | H A D | 25-Apr-2025 | 206.7 KiB | 6,954 | 5,108 |
| test_memdependency.cpp | H A D | 25-Apr-2025 | 101.3 KiB | 3,253 | 1,771 |
| test_memplanning.cpp | H A D | 25-Apr-2025 | 21.1 KiB | 709 | 399 |
| test_ops.cpp | H A D | 25-Apr-2025 | 2.5 KiB | 79 | 65 |
| test_quantization.cpp | H A D | 25-Apr-2025 | 16.8 KiB | 453 | 408 |
| test_reductions.cpp | H A D | 25-Apr-2025 | 51 KiB | 1,935 | 1,480 |
| test_registerizer.cpp | H A D | 25-Apr-2025 | 87.4 KiB | 3,703 | 1,972 |
| test_simplify.cpp | H A D | 25-Apr-2025 | 170.8 KiB | 5,683 | 4,022 |
| test_te_fuser_pass.cpp | H A D | 25-Apr-2025 | 13.2 KiB | 403 | 328 |
| test_type.cpp | H A D | 25-Apr-2025 | 5.2 KiB | 203 | 148 |
| test_type_specializations.cpp | H A D | 25-Apr-2025 | 2 KiB | 76 | 61 |
| test_utils.h | H A D | 25-Apr-2025 | 2.6 KiB | 79 | 65 |
| tutorial.cpp | H A D | 25-Apr-2025 | 22 KiB | 543 | 171 |
README.md
1# TensorExpr C++ Tests
2
3## How to add a new test
4First, create a new test file. Test files should have be placed in this
5directory, with a name that starts with `test_`, like `test_foo.cpp`.
6
7Here is an example test file you can copy-paste.
8```cpp
9#include <test/cpp/tensorexpr/test_base.h>
10
11// Tests go in torch::jit
12namespace torch {
13namespace jit {
14
15// 1. Test cases are void() functions.
16// 2. They start with the prefix `test`
17void testCaseOne() {
18 // ...
19}
20
21void testCaseTwo() {
22 // ...
23}
24}
25}
26```
27
28Then, register your test in `tests.h`:
29```cpp
30// Add to TH_FORALL_TESTS_CUDA instead for CUDA-requiring tests
31#define TH_FORALL_TESTS(_) \
32 _(ADFormulas) \
33 _(Attributes) \
34 ...
35 _(CaseOne) // note that the `test` prefix is omitted.
36 _(CaseTwo)
37```
38
39We glob all the test files together in `CMakeLists.txt` so that you don't
40have to edit it every time you add a test. Unfortunately, this means that in
41order to get the build to pick up your new test file, you need to re-run
42cmake:
43```
44python setup.py build --cmake
45```
46
47## How do I run the tests?
48The following commands assume you are in PyTorch root.
49
50 ```bash
51 # (re)build the test binary
52 ninja build/bin/test_tensorexpr
53 # run
54 build/bin/test_tensorexpr --gtest_filter='glob_style_filter*'
55 ```
56