diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93aaab654c02e..bc18b82fd9070 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ project(taichi)
SET(TI_VERSION_MAJOR 0)
SET(TI_VERSION_MINOR 5)
-SET(TI_VERSION_PATCH 0)
+SET(TI_VERSION_PATCH 1)
execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
diff --git a/README.md b/README.md
index 1b495cb0d3e58..192e15ccbe83b 100644
--- a/README.md
+++ b/README.md
@@ -20,23 +20,13 @@ python3 -m pip install taichi-nightly-cuda-10-0
python3 -m pip install taichi-nightly-cuda-10-1
```
+## [Contribution Guidelines](https://taichi.readthedocs.io/en/latest/contributor_guide.html)
+
|| **Linux (CUDA)** | **OS X (10.14+)** | **Windows** |
|:------|:-----|:-----|:-----|
|**Build**|[![Build Status](http://f11.csail.mit.edu:8080/job/taichi/badge/icon)](http://f11.csail.mit.edu:8080/job/taichi/)| [![Build Status](https://travis-ci.com/taichi-dev/taichi.svg?branch=master)](https://travis-ci.com/taichi-dev/taichi) | [![Build status](https://ci.appveyor.com/api/projects/status/yxm0uniin8xty4j7/branch/master?svg=true)](https://ci.appveyor.com/project/yuanming-hu/taichi/branch/master)|
|**PyPI**|[![Build Status](https://travis-ci.com/yuanming-hu/taichi-wheels-test.svg?branch=master)](https://travis-ci.com/yuanming-hu/taichi-wheels-test)|[![Build Status](https://travis-ci.com/yuanming-hu/taichi-wheels-test.svg?branch=master)](https://travis-ci.com/yuanming-hu/taichi-wheels-test)|[![Build status](https://ci.appveyor.com/api/projects/status/39ar9wa8yd49je7o?svg=true)](https://ci.appveyor.com/project/IteratorAdvance/taichi-wheels-test)|
-## [Contribution Guidelines](https://taichi.readthedocs.io/en/latest/contributor_guide.html)
-
-## Related papers
-- [**(SIGGRAPH Asia 2019) High-Performance Computation on Sparse Data Structures**](http://taichi.graphics/wp-content/uploads/2019/09/taichi_lang.pdf) [[Video]](https://youtu.be/wKw8LMF3Djo) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/taichi_bibtex.txt)
- - by *Yuanming Hu, Tzu-Mao Li, Luke Anderson, Jonathan Ragan-Kelley, and Frédo Durand*
-- [**(ICLR 2020) Differentiable Programming for Physical Simulation**](https://arxiv.org/abs/1910.00935) [[Video]](https://www.youtube.com/watch?v=Z1xvAZve9aE) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/difftaichi_bibtex.txt) [[Code]](https://github.com/yuanming-hu/difftaichi)
- - by *Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand*
-
-
-
-
-
## Short-term goals
- (Done) Fully implement the LLVM backend to replace the legacy source-to-source C++/CUDA backends (By Dec 2019)
- The only missing features compared to the old source-to-source backends:
@@ -46,6 +36,14 @@ python3 -m pip install taichi-nightly-cuda-10-1
- (WIP) Tune the performance of the LLVM backend to match that of the legacy source-to-source backends (Hopefully by mid Feb, 2020. Current progress: setting up/tuning for final benchmarks)
## Updates
+- (Feb 16, 2020) v0.5.1 released
+ - Keyboard and mouse events supported in the GUI system. Check out [mpm128.py](https://github.com/taichi-dev/taichi/blob/master/examples/mpm128.py) for a interactive demo! (by **Yubin Peng [archibate] and Ye Kuang [k-ye]**)
+ - Basic algebraic simplification passes (by **Mingkuan Xu [xumingkuan]**)
+ - (For developers) `ti` (`ti.exe`) command supported on Windows after setting `%PATH%` correctly (by **Mingkuan Xu [xumingkuan]**)
+ - General power operator `x ** y` now supported in Taichi kernels (by **Yubin Peng [archibate]**)
+ - `.dense(...).pointer()` now abbreviated as `.pointer(...)`. `pointer` now stands for a dense pointer array. This leads to cleaner code and better performance. (by **Kenneth Lozes [KLozes]**)
+ - (Advanced struct-fors only) `for i in X` now iterates all child instances of `X` instead of `X` itself. Skip this if you only use `X=leaf node` such as `ti.f32/i32/Vector/Matrix`.
+ - Fixed cuda random number generator racing conditions
- (Feb 14, 2020) **v0.5.0 released with a new Apple Metal GPU backend for Mac OS X users!** (by **Ye Kuang [k-ye]**)
- Just initialize your program with `ti.init(..., arch=ti.metal)` and run Taichi on your Mac GPUs!
- A few takeaways if you do want to use the Metal backend:
@@ -103,3 +101,14 @@ python3 -m pip install taichi-nightly-cuda-10-1
- Doc updated
- [Full changelog](changelog.md)
+
+
+## Related papers
+- [**(SIGGRAPH Asia 2019) High-Performance Computation on Sparse Data Structures**](http://taichi.graphics/wp-content/uploads/2019/09/taichi_lang.pdf) [[Video]](https://youtu.be/wKw8LMF3Djo) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/taichi_bibtex.txt)
+ - by *Yuanming Hu, Tzu-Mao Li, Luke Anderson, Jonathan Ragan-Kelley, and Frédo Durand*
+- [**(ICLR 2020) Differentiable Programming for Physical Simulation**](https://arxiv.org/abs/1910.00935) [[Video]](https://www.youtube.com/watch?v=Z1xvAZve9aE) [[BibTex]](https://raw.githubusercontent.com/yuanming-hu/taichi/master/misc/difftaichi_bibtex.txt) [[Code]](https://github.com/yuanming-hu/difftaichi)
+ - by *Yuanming Hu, Luke Anderson, Tzu-Mao Li, Qi Sun, Nathan Carr, Jonathan Ragan-Kelley, and Frédo Durand*
+
+
+
+
diff --git a/appveyor.yml b/appveyor.yml
index 7fdcd2d22d168..2813e3619df61 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -33,6 +33,8 @@ skip_commits:
- '.*'
build_script:
+ - set TAICHI_REPO_DIR=C:\taichi
+ # - 'if %PYTHON% %TAICHI_REPO_DIR%\misc\appveyor_filter.py; then exit 0; fi'
- cd C:\
- curl --retry 10 --retry-delay 5 https://github.com/yuanming-hu/taichi_assets/releases/download/llvm8/taichi-llvm-8.0.1-msvc2017.zip -LO
- 7z x taichi-llvm-8.0.1-msvc2017.zip -otaichi_llvm
@@ -40,7 +42,6 @@ build_script:
- 7z x clang-7.0.1-win.zip -otaichi_clang
- set PATH=C:\taichi_llvm\bin;%PATH%;
- set PATH=C:\taichi_clang\bin;%PATH%
- - set TAICHI_REPO_DIR=C:\taichi
- set PYTHONPATH=%TAICHI_REPO_DIR%/python
- set PATH=%TAICHI_REPO_DIR%\bin;%PATH%
- clang --version
diff --git a/benchmarks/fill_sparse.py b/benchmarks/fill_sparse.py
index 0e4d72533f362..0ba80f6f8d31a 100644
--- a/benchmarks/fill_sparse.py
+++ b/benchmarks/fill_sparse.py
@@ -6,7 +6,7 @@ def benchmark_nested_struct():
@ti.layout
def place():
- ti.root.dense(ti.ij, [N, N]).pointer().dense(ti.ij, [8, 8]).place(a)
+ ti.root.pointer(ti.ij, [N, N]).dense(ti.ij, [8, 8]).place(a)
@ti.kernel
def fill():
@@ -24,7 +24,7 @@ def benchmark_nested_struct_fill_and_clear():
@ti.layout
def place():
- ti.root.dense(ti.ij, [N, N]).pointer().dense(ti.ij, [8, 8]).place(a)
+ ti.root.pointer(ti.ij, [N, N]).dense(ti.ij, [8, 8]).place(a)
@ti.kernel
def fill():
diff --git a/ci_setup.py b/ci_setup.py
index 5b91d49d6c34b..dbe0637cc8748 100644
--- a/ci_setup.py
+++ b/ci_setup.py
@@ -47,7 +47,7 @@ def get_shell_rc_name():
def get_username():
if build_type == 'ci':
- os.environ['TC_CI'] = '1'
+ os.environ['TI_CI'] = '1'
username = 'travis'
else:
assert get_os_name() != 'win'
diff --git a/cmake/TaichiCXXFlags.cmake b/cmake/TaichiCXXFlags.cmake
index 588ca9ba6db76..b03a90593404c 100644
--- a/cmake/TaichiCXXFlags.cmake
+++ b/cmake/TaichiCXXFlags.cmake
@@ -1,6 +1,6 @@
message("Using C++ compiler: " ${CMAKE_CXX_COMPILER})
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_ISE_NONE")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_ISE_NONE")
option(BUILD_WITH_ADDRESS_SANITIZER "Build with clang address sanitizer" OFF)
@@ -49,19 +49,19 @@ if (USE_STDCPP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_PASS_EXCEPTION_TO_PYTHON")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_PASS_EXCEPTION_TO_PYTHON")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_INCLUDED")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_INCLUDED")
-if ($ENV{TC_USE_DOUBLE})
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_USE_DOUBLE")
+if ($ENV{TI_USE_DOUBLE})
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_USE_DOUBLE")
message("Using float64 (double) precision as real")
else()
message("Using float32 (single) precision as real")
endif()
-if (TC_USE_MPI)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTC_USE_MPI")
+if (TI_USE_MPI)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_USE_MPI")
message("Using MPI")
endif ()
diff --git a/cmake/TaichiCore.cmake b/cmake/TaichiCore.cmake
index b831df4405943..803b7c79fc601 100644
--- a/cmake/TaichiCore.cmake
+++ b/cmake/TaichiCore.cmake
@@ -40,7 +40,7 @@ if (TI_WITH_CUDA)
message("Building with CUDA ${CUDA_VERSION}")
set(CUDA_ARCH 61)
message("Found CUDA. Arch = ${CUDA_ARCH}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCUDA_FOUND -DTI_WITH_CUDA")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTI_WITH_CUDA")
if (MSVC)
include_directories(${CUDA_TOOLKIT_ROOT_DIR}/include)
target_link_libraries(${LIBRARY_NAME} ${CUDA_TOOLKIT_ROOT_DIR}/lib/x64/cudart.lib ${CUDA_TOOLKIT_ROOT_DIR}/lib/x64/cuda.lib)
@@ -83,7 +83,7 @@ llvm_map_components_to_libnames(llvm_libs
)
target_link_libraries(${LIBRARY_NAME} ${llvm_libs})
-if (CUDA_FOUND)
+if (TI_WITH_CUDA)
llvm_map_components_to_libnames(llvm_ptx_libs NVPTX)
target_link_libraries(${LIBRARY_NAME} ${llvm_ptx_libs})
endif()
diff --git a/docs/cpp_style.rst b/docs/cpp_style.rst
index b9c8295bac726..6104b5b861124 100644
--- a/docs/cpp_style.rst
+++ b/docs/cpp_style.rst
@@ -5,7 +5,7 @@ Naming
--------------------------------------------------------------------------
- Variable names should consist of lowercase words connected by underscores, e.g. ``llvm_context``.
- Class and struct names should consist of words with first letters capitalized, e.g. ``CodegenLLVM``.
-- Macros should be capital start with ``TC``, such as ``TC_INFO``, ``TC_IMPLEMENTATION``.
+- Macros should be capital start with ``TC``, such as ``TI_INFO``, ``TI_IMPLEMENTATION``.
- We do not encourage the use of macro, although there are cases where macros are inevitable.
diff --git a/docs/utilities.rst b/docs/utilities.rst
index 55642ac85f719..3e14f5fe53e56 100644
--- a/docs/utilities.rst
+++ b/docs/utilities.rst
@@ -47,45 +47,45 @@ Serialization
The serialization module of taichi allows you to serialize/deserialize objects into/from binary strings.
-You can use ``TC_IO`` macros to explicit define fields necessary in Taichi.
+You can use ``TI_IO`` macros to explicit define fields necessary in Taichi.
.. code-block:: cpp
- // TC_IO_DEF
+ // TI_IO_DEF
struct Particle {
Vector3f position, velocity;
real mass;
string name;
- TC_IO_DEF(position, velocity, mass, name);
+ TI_IO_DEF(position, velocity, mass, name);
}
- // TC_IO_DECL
+ // TI_IO_DECL
struct Particle {
Vector3f position, velocity;
real mass;
bool has_name
string name;
- TC_IO_DECL() {
- TC_IO(position);
- TC_IO(velocity);
- TC_IO(mass);
- TC_IO(has_name);
+ TI_IO_DECL() {
+ TI_IO(position);
+ TI_IO(velocity);
+ TI_IO(mass);
+ TI_IO(has_name);
// More flexibility:
if (has_name) {
- TC_IO(name);
+ TI_IO(name);
}
}
}
- // TC_IO_DEF_VIRT();
+ // TI_IO_DEF_VIRT();
Progress Notification
----------------------------------
-The taichi messager can send an email to ``$TC_MONITOR_EMAIL`` when the task finished or crashed.
+The taichi messager can send an email to ``$TI_MONITOR_EMAIL`` when the task finished or crashed.
To enable:
.. code-block:: python
diff --git a/docs/version b/docs/version
index 8f0916f768f04..4b9fcbec101a6 100644
--- a/docs/version
+++ b/docs/version
@@ -1 +1 @@
-0.5.0
+0.5.1
diff --git a/examples/cpp/cnn.cpp b/examples/cpp/cnn.cpp
index 457fdbe0b7adb..04e2faeb12d5b 100644
--- a/examples/cpp/cnn.cpp
+++ b/examples/cpp/cnn.cpp
@@ -3,7 +3,7 @@
#include
#include
-TC_NAMESPACE_BEGIN
+TI_NAMESPACE_BEGIN
using namespace Tlang;
@@ -12,10 +12,10 @@ constexpr int n = 256;
constexpr int num_ch1 = 16, num_ch2 = 16;
auto cnn = [](std::vector cli_param) {
- TC_WARN(
+ TI_WARN(
"After refactoring the Texture class from Taichi is removed. Need to "
"read from the raw bunny binary.");
- TC_NOT_IMPLEMENTED
+ TI_NOT_IMPLEMENTED
#if (0)
CoreState::set_trigger_gdb_when_crash(true);
auto param = parse_param(cli_param);
@@ -24,7 +24,7 @@ auto cnn = [](std::vector cli_param) {
auto cache_l1 = param.get("cache_l1", true);
auto use_dense = param.get("use_dense", false);
auto write_input_voxel = param.get("write_input", true);
- TC_P(use_dense);
+ TI_P(use_dense);
Program prog(gpu ? Arch::gpu : Arch::x86_64);
prog.config.simplify_before_lower_access = opt;
@@ -228,6 +228,6 @@ auto cnn = [](std::vector cli_param) {
#endif
#endif
};
-TC_REGISTER_TASK(cnn);
+TI_REGISTER_TASK(cnn);
-TC_NAMESPACE_END
+TI_NAMESPACE_END
diff --git a/examples/cpp/diff_conv.cpp b/examples/cpp/diff_conv.cpp
index 46466ef5756e5..e35cee5ef5a8b 100644
--- a/examples/cpp/diff_conv.cpp
+++ b/examples/cpp/diff_conv.cpp
@@ -1,23 +1,23 @@
#include
-TC_NAMESPACE_BEGIN
+TI_NAMESPACE_BEGIN
auto diff_conv = [](const std::vector args) {
int grid_resolution = 254;
- TC_ASSERT(args.size() == 3);
+ TI_ASSERT(args.size() == 3);
float th = std::stof(args[2]);
- TC_P(th);
+ TI_P(th);
auto f = fopen(args[0].c_str(), "rb");
int n = pow<3>(grid_resolution);
- TC_ASSERT(f);
+ TI_ASSERT(f);
std::vector ret1(n);
trash(std::fread(ret1.data(), sizeof(float32), ret1.size(), f));
std::fclose(f);
f = fopen(args[1].c_str(), "rb");
- TC_ASSERT(f);
+ TI_ASSERT(f);
std::vector ret2(n);
trash(std::fread(ret2.data(), sizeof(float32), ret2.size(), f));
std::fclose(f);
@@ -53,19 +53,19 @@ auto diff_conv = [](const std::vector args) {
// fprintf(stderr, "ret1:%f, ret2:%f\n", ret1[i], ret2[i]);
//}
}
- TC_INFO("same {} {}%", counter[0], 100.0f * counter[0] / n);
- TC_INFO("non zero same {} {}%", counter[0],
+ TI_INFO("same {} {}%", counter[0], 100.0f * counter[0] / n);
+ TI_INFO("non zero same {} {}%", counter[0],
100.0f * counter[1] / total_non_zero);
- TC_P(sum1 / n);
- TC_P(sum2 / n);
- TC_P(sum1 / total_non_zero);
- TC_P(sum2 / total_non_zero);
- TC_P(max1);
- TC_P(max2);
- TC_P(non_zero1);
- TC_P(non_zero2);
+ TI_P(sum1 / n);
+ TI_P(sum2 / n);
+ TI_P(sum1 / total_non_zero);
+ TI_P(sum2 / total_non_zero);
+ TI_P(max1);
+ TI_P(max2);
+ TI_P(non_zero1);
+ TI_P(non_zero2);
};
-TC_REGISTER_TASK(diff_conv);
+TI_REGISTER_TASK(diff_conv);
-TC_NAMESPACE_END
+TI_NAMESPACE_END
diff --git a/examples/cpp/fem.cpp b/examples/cpp/fem.cpp
index 45ddc351d8e29..df1a89b5b08c6 100644
--- a/examples/cpp/fem.cpp
+++ b/examples/cpp/fem.cpp
@@ -5,7 +5,7 @@
#include
#include
-TC_NAMESPACE_BEGIN
+TI_NAMESPACE_BEGIN
#include "fem_coeff.h"
@@ -30,30 +30,30 @@ auto fem = [](std::vector cli_param) {
auto param = parse_param(cli_param);
bool gpu = param.get("gpu", false);
- TC_P(gpu);
+ TI_P(gpu);
bool vectorization = param.get("vec", true);
- TC_P(vectorization);
+ TI_P(vectorization);
int threads = param.get("threads", 8);
- TC_P(threads);
+ TI_P(threads);
bool use_cache = param.get("cache", true);
- TC_P(use_cache);
+ TI_P(use_cache);
bool compute_gt = param.get("compute_gt", false);
- TC_P(compute_gt);
+ TI_P(compute_gt);
Program prog(gpu ? Arch::gpu : Arch::x86_64);
prog.config.simplify_before_lower_access = param.get("simp1", true);
- TC_P(prog.config.simplify_before_lower_access);
+ TI_P(prog.config.simplify_before_lower_access);
prog.config.lower_access = param.get("lower_access", true);
- TC_P(prog.config.lower_access);
+ TI_P(prog.config.lower_access);
prog.config.print_ir = param.get("print_ir", false);
- TC_P(prog.config.print_ir);
+ TI_P(prog.config.print_ir);
prog.config.simplify_after_lower_access = param.get("simp2", true);
- TC_P(prog.config.simplify_after_lower_access);
+ TI_P(prog.config.simplify_after_lower_access);
prog.config.attempt_vectorized_load_cpu = param.get("vec_load_cpu", true);
- TC_P(prog.config.attempt_vectorized_load_cpu);
+ TI_P(prog.config.attempt_vectorized_load_cpu);
bool use_pointer = param.get("use_pointer", true);
- TC_P(use_pointer);
+ TI_P(use_pointer);
bool block_soa = param.get("block_soa", true);
- TC_P(block_soa);
+ TI_P(block_soa);
prog.config.lazy_compilation = false;
Vector x(DataType::f32, dim), r(DataType::f32, dim), p(DataType::f32, dim),
@@ -261,7 +261,7 @@ auto fem = [](std::vector cli_param) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - 1; j++) {
for (int k = 0; k < n - 1; k++) {
- TC_ASSERT(!active[i][j][k]);
+ TI_ASSERT(!active[i][j][k]);
}
}
}
@@ -275,16 +275,16 @@ auto fem = [](std::vector cli_param) {
auto old_rTr = sum.val();
for (int i = 0; i < 1000; i++) {
- TC_P(i);
+ TI_P(i);
compute_Ap();
sum.val() = 0;
reduce_pAp();
auto pAp = sum.val();
// alpha = rTr / pTAp
alpha.val() = old_rTr / pAp;
- TC_P(old_rTr);
- // TC_P(pAp);
- // TC_P(alpha.val());
+ TI_P(old_rTr);
+ // TI_P(pAp);
+ // TI_P(alpha.val());
// x = x + alpha p
update_x();
// r = r - alpha Ap
@@ -293,12 +293,12 @@ auto fem = [](std::vector cli_param) {
sum.val() = 0;
reduce_r();
auto new_rTr = sum.val();
- // TC_P(new_rTr);
+ // TI_P(new_rTr);
if (new_rTr < 1e-5f)
break;
// beta = new rTr / old rTr
beta.val() = new_rTr / old_rTr;
- // TC_P(beta.val());
+ // TI_P(beta.val());
// p = r + beta p
update_p();
old_rTr = new_rTr;
@@ -326,7 +326,7 @@ auto fem = [](std::vector cli_param) {
}
}
}
- TC_P(residual);
+ TI_P(residual);
auto difference = 0.0f;
auto difference_max = 0.0f;
for (int i = 0; i < n; i++) {
@@ -341,8 +341,8 @@ auto fem = [](std::vector cli_param) {
}
}
}
- TC_P(difference);
- TC_P(difference_max);
+ TI_P(difference);
+ TI_P(difference_max);
int gui_res = 512;
GUI gui("FEM", Vector2i(gui_res + 200, gui_res), false);
@@ -371,6 +371,6 @@ auto fem = [](std::vector cli_param) {
gui.update();
}
};
-TC_REGISTER_TASK(fem);
+TI_REGISTER_TASK(fem);
-TC_NAMESPACE_END
+TI_NAMESPACE_END
diff --git a/examples/cpp/mgpcg.cpp b/examples/cpp/mgpcg.cpp
index 1276e9cd58d32..b1a5268d654eb 100644
--- a/examples/cpp/mgpcg.cpp
+++ b/examples/cpp/mgpcg.cpp
@@ -4,7 +4,7 @@
#include
#include
-TC_NAMESPACE_BEGIN
+TI_NAMESPACE_BEGIN
using namespace Tlang;
@@ -19,15 +19,15 @@ auto mgpcg_poisson = [](std::vector cli_param) {
int block_size = 8;
int threads = param.get("threads", 8);
- TC_P(threads);
+ TI_P(threads);
bool vec_option = param.get("vec", true);
int vec = vec_option ? block_size : 1;
- TC_ASSERT(vec == 1 || vec == block_size);
- TC_P(vec);
+ TI_ASSERT(vec == 1 || vec == block_size);
+ TI_P(vec);
bool load_gt = param.get("load_gt", false);
- TC_P(load_gt)
+ TI_P(load_gt)
bool gpu = param.get("gpu", false);
- TC_P(gpu)
+ TI_P(gpu)
CoreState::set_trigger_gdb_when_crash(true);
@@ -35,15 +35,15 @@ auto mgpcg_poisson = [](std::vector cli_param) {
// prog.config.print_ir = true;
prog.config.simplify_before_lower_access = param.get("simp1", true);
- TC_P(prog.config.simplify_before_lower_access);
+ TI_P(prog.config.simplify_before_lower_access);
prog.config.lower_access = param.get("lower_access", true);
- TC_P(prog.config.lower_access);
+ TI_P(prog.config.lower_access);
prog.config.print_ir = param.get("print_ir", false);
- TC_P(prog.config.print_ir);
+ TI_P(prog.config.print_ir);
prog.config.simplify_after_lower_access = param.get("simp2", true);
- TC_P(prog.config.simplify_after_lower_access);
+ TI_P(prog.config.simplify_after_lower_access);
prog.config.attempt_vectorized_load_cpu = param.get("vec_load_cpu", true);
- TC_P(prog.config.attempt_vectorized_load_cpu);
+ TI_P(prog.config.attempt_vectorized_load_cpu);
prog.config.lazy_compilation = false;
@@ -278,7 +278,7 @@ auto mgpcg_poisson = [](std::vector cli_param) {
sum.val() = 0;
reduce_r();
auto initial_rTr = sum.val();
- TC_P(initial_rTr);
+ TI_P(initial_rTr);
// r = b - Ax = b since x = 0
// p = r = r + 0 p
@@ -291,16 +291,16 @@ auto mgpcg_poisson = [](std::vector cli_param) {
// CG
auto t = Time::get_time();
for (int i = 0; i < 400; i++) {
- TC_P(i);
+ TI_P(i);
compute_Ap();
sum.val() = 0;
reduce_pAp();
auto pAp = sum.val();
// alpha = rTr / pTAp
alpha.val() = old_zTr / pAp;
- // TC_P(old_zTr);
- // TC_P(pAp);
- // TC_P(alpha.val());
+ // TI_P(old_zTr);
+ // TI_P(pAp);
+ // TI_P(alpha.val());
// x = x + alpha p
update_x();
// r = r - alpha Ap
@@ -311,21 +311,21 @@ auto mgpcg_poisson = [](std::vector cli_param) {
sum.val() = 0;
reduce_zTr();
auto new_zTr = sum.val();
- // TC_P(new_zTr);
+ // TI_P(new_zTr);
sum.val() = 0;
reduce_r();
auto rTr = sum.val();
- TC_P(rTr);
+ TI_P(rTr);
if (rTr < initial_rTr * 1e-12f)
break;
// beta = new rTr / old rTr
beta.val() = new_zTr / old_zTr;
- // TC_P(beta.val());
+ // TI_P(beta.val());
// p = z + beta p
update_p();
old_zTr = new_zTr;
}
- TC_P(Time::get_time() - t);
+ TI_P(Time::get_time() - t);
get_current_program().profiler_print();
compute_Ap();
@@ -339,8 +339,8 @@ auto mgpcg_poisson = [](std::vector cli_param) {
}
}
}
- TC_P(residual);
- // TC_P(difference_max);
+ TI_P(residual);
+ // TI_P(difference_max);
std::vector ref_input(pow<3>(n / 2));
if (load_gt) {
@@ -351,7 +351,7 @@ auto mgpcg_poisson = [](std::vector cli_param) {
for (auto r : ref_input) {
absmax = std::max(std::abs(absmax), r);
}
- TC_P(absmax);
+ TI_P(absmax);
int gui_res = 512;
GUI gui("MGPCG Poisson", Vector2i(gui_res + 200, gui_res), false);
@@ -376,6 +376,6 @@ auto mgpcg_poisson = [](std::vector cli_param) {
gui.update();
}
};
-TC_REGISTER_TASK(mgpcg_poisson);
+TI_REGISTER_TASK(mgpcg_poisson);
-TC_NAMESPACE_END
+TI_NAMESPACE_END
diff --git a/examples/cpp/mpm_benchmark.cpp b/examples/cpp/mpm_benchmark.cpp
index 618492974513f..74d34a4ce40b1 100644
--- a/examples/cpp/mpm_benchmark.cpp
+++ b/examples/cpp/mpm_benchmark.cpp
@@ -6,7 +6,7 @@
#include
#include
-TC_NAMESPACE_BEGIN
+TI_NAMESPACE_BEGIN
using namespace Tlang;
@@ -15,18 +15,18 @@ auto mpm_benchmark = [](std::vector cli_param) {
auto param = parse_param(cli_param);
bool particle_soa = param.get("particle_soa", false);
- TC_P(particle_soa);
+ TI_P(particle_soa);
bool block_soa = param.get("block_soa", true);
- TC_P(block_soa);
+ TI_P(block_soa);
bool use_cache = param.get("use_cache", true);
- TC_P(use_cache);
+ TI_P(use_cache);
bool initial_reorder = param.get("initial_reorder", true);
- TC_P(initial_reorder);
+ TI_P(initial_reorder);
bool initial_shuffle = param.get("initial_shuffle", false);
- TC_P(initial_shuffle);
+ TI_P(initial_shuffle);
prog.config.lower_access = param.get("lower_access", false);
int stagger = param.get("stagger", true);
- TC_P(stagger);
+ TI_P(stagger);
constexpr int dim = 3, n = 256, grid_block_size = 4, n_particles = 775196;
const real dt = 1e-5_f * 256 / n, dx = 1.0_f / n, inv_dx = 1.0_f / dx;
@@ -45,7 +45,7 @@ auto mpm_benchmark = [](std::vector cli_param) {
p_x.resize(n_particles);
std::vector benchmark_particles;
auto f = fopen("dragon_particles.bin", "rb");
- TC_ASSERT_INFO(f, "./dragon_particles.bin not found");
+ TI_ASSERT_INFO(f, "./dragon_particles.bin not found");
benchmark_particles.resize(n_particles * 3);
if (std::fread(benchmark_particles.data(), sizeof(float), n_particles * 3,
f)) {
@@ -81,7 +81,7 @@ auto mpm_benchmark = [](std::vector cli_param) {
place(particle_x(i));
for (int i = 0; i < dim; i++)
place(particle_v(i));
- TC_ASSERT(n % grid_block_size == 0);
+ TI_ASSERT(n % grid_block_size == 0);
auto &block = root.dense({i, j, k}, n / grid_block_size).pointer();
if (block_soa) {
block.dense({i, j, k}, grid_block_size).place(grid_v(0));
@@ -253,7 +253,7 @@ auto mpm_benchmark = [](std::vector cli_param) {
}
prog.profiler_print();
auto ms_per_substep = (Time::get_time() - t) / 200 * 1000;
- TC_P(ms_per_substep);
+ TI_P(ms_per_substep);
};
#if (0)
@@ -323,6 +323,6 @@ auto mpm_benchmark = [](std::vector cli_param) {
}
#endif
};
-TC_REGISTER_TASK(mpm_benchmark);
+TI_REGISTER_TASK(mpm_benchmark);
-TC_NAMESPACE_END
+TI_NAMESPACE_END
diff --git a/examples/cpp/mpm_full.cpp b/examples/cpp/mpm_full.cpp
index bcfa7aa495ca4..7272bf62d59b3 100644
--- a/examples/cpp/mpm_full.cpp
+++ b/examples/cpp/mpm_full.cpp
@@ -5,7 +5,7 @@
#include
#include "volume_renderer.h"
-TC_NAMESPACE_BEGIN
+TI_NAMESPACE_BEGIN
using namespace Tlang;
@@ -37,16 +37,16 @@ auto mpm_full = [](std::vector cli_param) {
int seeding_frames = param.get("seeding_frames", 300);
real G = -1000.0f;
- TC_P(total_frames);
- TC_P(seeding_frames);
- TC_P(dt);
+ TI_P(total_frames);
+ TI_P(seeding_frames);
+ TI_P(dt);
dt = frame_dt / std::ceil(frame_dt / dt - 1e-5f);
- TC_P(dt);
- TC_P(frame_dt);
+ TI_P(dt);
+ TI_P(frame_dt);
int visualize_interval = param.get("visualize_interval", 5);
- TC_P(visualize_interval);
+ TI_P(visualize_interval);
real ground_friction = param.get("ground_friction", 0.2f);
- TC_P(ground_friction);
+ TI_P(ground_friction);
auto particle_mass = 1.0_f, vol = 1.0_f;
auto E = param.get("E", 1e4), nu = 0.3f;
real mu_0 = E / (2 * (1 + nu)), lambda_0 = E * nu / ((1 + nu) * (1 - 2 * nu));
@@ -61,7 +61,7 @@ auto mpm_full = [](std::vector cli_param) {
bool bbox = param.get("bbox", false);
int scene = param.get("scene", 0);
if (scene == 0) {
- TC_INFO(
+ TI_INFO(
"Scene: [1] ball smash [2] one jet [3] two static jets [4] two "
"moving jets [5] particle curtain");
exit(0);
@@ -78,12 +78,12 @@ auto mpm_full = [](std::vector cli_param) {
} else if (material_name == "jelly") {
material = MPMMaterial::jelly;
} else {
- TC_ERROR("Unknown material {}", material_name);
+ TI_ERROR("Unknown material {}", material_name);
}
- TC_P(material_name);
- TC_P(bbox);
- TC_P(scene);
+ TI_P(material_name);
+ TI_P(bbox);
+ TI_P(scene);
Vector particle_x("x", f32, dim), particle_v("v", f32, dim);
Global(particle_color, i32);
@@ -105,9 +105,9 @@ auto mpm_full = [](std::vector cli_param) {
if (benchmark_dragon) {
n_particles = 775196;
p_x.resize(n_particles);
- TC_ASSERT(n_particles <= max_n_particles);
+ TI_ASSERT(n_particles <= max_n_particles);
auto f = fopen("dragon_particles.bin", "rb");
- TC_ASSERT_INFO(f, "./dragon_particles.bin not found");
+ TI_ASSERT_INFO(f, "./dragon_particles.bin not found");
benchmark_particles.resize(n_particles * 3);
if (std::fread(benchmark_particles.data(), sizeof(float), n_particles * 3,
f)) {
@@ -141,7 +141,7 @@ auto mpm_full = [](std::vector cli_param) {
}
}
- TC_ASSERT(n_particles <= max_n_particles);
+ TI_ASSERT(n_particles <= max_n_particles);
auto sample_unit_sphere = [&] {
Vector3 offset = Vector3::rand() - Vector3(0.5_f);
@@ -186,7 +186,7 @@ auto mpm_full = [](std::vector cli_param) {
place(particle_J);
place(particle_color);
- TC_ASSERT(n % grid_block_size == 0);
+ TI_ASSERT(n % grid_block_size == 0);
auto &block = root.dense({i, j, k}, grid_n / 4 / grid_block_size)
.pointer()
.dense({i, j, k}, 4)
@@ -215,7 +215,7 @@ auto mpm_full = [](std::vector cli_param) {
// prog.visualize_layout("layout.tex");
- TC_ASSERT(bit::is_power_of_two(n));
+ TI_ASSERT(bit::is_power_of_two(n));
Kernel(summarize).def([&] {
BlockDim(512);
@@ -560,15 +560,15 @@ auto mpm_full = [](std::vector cli_param) {
->clear_data_and_deactivate();
auto t = Time::get_time();
for (int f = 0; f < std::round(frame_dt / dt); f++) {
- TC_PROFILE("p2g", p2g());
- TC_PROFILE("grid_op", grid_op());
- TC_PROFILE("g2p", g2p());
+ TI_PROFILE("p2g", p2g());
+ TI_PROFILE("grid_op", grid_op());
+ TI_PROFILE("g2p", g2p());
}
prog.profiler_print();
auto ms_per_substep = (Time::get_time() - t) / 200 * 1000;
- TC_P(ms_per_substep);
+ TI_P(ms_per_substep);
auto sec_per_frame = Time::get_time() - t;
- TC_P(sec_per_frame);
+ TI_P(sec_per_frame);
};
Kernel(set_renderer_volume).def([&] {
@@ -584,7 +584,7 @@ auto mpm_full = [](std::vector cli_param) {
for (int frame = 0; frame < total_frames; frame++) {
float32 current_t = frame_dt * frame;
if (frame < seeding_frames) {
- TC_P(scene);
+ TI_P(scene);
if (scene == 2) {
int N = 10000;
if (n_particles + N <= max_n_particles) {
@@ -625,7 +625,7 @@ auto mpm_full = [](std::vector cli_param) {
n_particles += N;
} else if (scene == 5) {
int N = 10000;
- TC_P(N);
+ TI_P(N);
if (n_particles + N <= max_n_particles) {
for (int i = 0; i < N; i++) {
Vector3 color(0.5, 0.6, 0.4);
@@ -640,7 +640,7 @@ auto mpm_full = [](std::vector cli_param) {
}
}
}
- TC_P(n_particles)
+ TI_P(n_particles)
simulate_frame();
// auto res = canvas.img.get_res();
@@ -656,11 +656,11 @@ auto mpm_full = [](std::vector cli_param) {
auto ot = Time::get_time();
std::vector particle_data(max_n_particles * 7);
summarize();
-#if defined(CUDA_FOUND)
+#if defined(TI_WITH_CUDA)
cudaMemcpy(particle_data.data(), &particle_buffer.val(0),
particle_data.size() * sizeof(float), cudaMemcpyDeviceToHost);
#else
- TC_ERROR("No CUDA.");
+ TI_ERROR("No CUDA.");
#endif
for (int i = 0; i < n_particles; i++) {
@@ -672,7 +672,7 @@ auto mpm_full = [](std::vector cli_param) {
std::max(renderer.parameters.box_max[k], v);
}
}
- TC_P(Time::get_time() - ot);
+ TI_P(Time::get_time() - ot);
create_directories(fmt::format("final_particles/{}", output));
/*
write_to_binary_file(
@@ -714,9 +714,9 @@ auto mpm_full = [](std::vector cli_param) {
print_profile_info();
}
};
-TC_REGISTER_TASK(mpm_full);
+TI_REGISTER_TASK(mpm_full);
-TC_NAMESPACE_END
+TI_NAMESPACE_END
// demos:
// two sand jets:
diff --git a/examples/cpp/ray_march.cpp b/examples/cpp/ray_march.cpp
index 86fd8e9a52c2d..bf697c0c4637e 100644
--- a/examples/cpp/ray_march.cpp
+++ b/examples/cpp/ray_march.cpp
@@ -137,6 +137,6 @@ auto ray_march = [] {
gui.update();
}
};
-TC_REGISTER_TASK(ray_march);
+TI_REGISTER_TASK(ray_march);
TLANG_NAMESPACE_END
diff --git a/examples/cpp/smoke_renderer.cpp b/examples/cpp/smoke_renderer.cpp
index d3e61645fd6c1..74db4fdfb9cd6 100644
--- a/examples/cpp/smoke_renderer.cpp
+++ b/examples/cpp/smoke_renderer.cpp
@@ -9,10 +9,10 @@ extern bool use_gui;
auto smoke_renderer = [](std::vector cli_param_) {
auto cli_param = parse_param(cli_param_);
bool gpu = cli_param.get("gpu", true);
- TC_P(gpu);
+ TI_P(gpu);
Program prog(gpu ? Arch::gpu : Arch::x86_64);
bool benchmark = true; // benchmark the bunny cloud against tungsten?
- TC_ASSERT(benchmark);
+ TI_ASSERT(benchmark);
// CoreState::set_trigger_gdb_when_crash(true);
// prog.config.print_ir = true;
float32 target_max_density = 50.f;
@@ -37,7 +37,7 @@ auto smoke_renderer = [](std::vector cli_param_) {
if (benchmark) {
auto f = fopen("bunny_cloud.bin", "rb");
- TC_ASSERT_INFO(f, "./bunny_cloud.bin not found");
+ TI_ASSERT_INFO(f, "./bunny_cloud.bin not found");
int box_sizes[3]{584, 576, 440};
int total_voxels = box_sizes[0] * box_sizes[1] * box_sizes[2];
std::vector density_field(total_voxels);
@@ -50,7 +50,7 @@ auto smoke_renderer = [](std::vector cli_param_) {
max_density = std::max(max_density, density_field[i]);
}
- TC_P(max_density);
+ TI_P(max_density);
for (int i = 0; i < total_voxels; i++) {
density_field[i] /= max_density; // normalize to 1 first
@@ -125,13 +125,13 @@ auto smoke_renderer = [](std::vector cli_param_) {
}
}
};
-TC_REGISTER_TASK(smoke_renderer);
+TI_REGISTER_TASK(smoke_renderer);
auto smoke_renderer_gui = [](std::vector cli_param) {
use_gui = true;
smoke_renderer(cli_param);
};
-TC_REGISTER_TASK(smoke_renderer_gui);
+TI_REGISTER_TASK(smoke_renderer_gui);
TLANG_NAMESPACE_END
diff --git a/examples/cpp/smoke_renderer.h b/examples/cpp/smoke_renderer.h
index be7399f9ac63f..4673eee5211f7 100644
--- a/examples/cpp/smoke_renderer.h
+++ b/examples/cpp/smoke_renderer.h
@@ -29,8 +29,8 @@ class SmokeRenderer {
depth_limit = param.get("depth_limit", 128);
output_res = param.get("output_res", Vector2i(1024, 512));
- TC_ASSERT(bit::is_power_of_two(output_res.x));
- TC_ASSERT(bit::is_power_of_two(output_res.y));
+ TI_ASSERT(bit::is_power_of_two(output_res.x));
+ TI_ASSERT(bit::is_power_of_two(output_res.y));
sky_map_size = Vector2i(512, 128);
n_sky_samples = 1024;
@@ -373,12 +373,12 @@ class SmokeRenderer {
std::FILE *f;
if (use_sky_map) {
f = fopen("sky_map.bin", "rb");
- TC_ASSERT_INFO(f, "./sky_map.bin not found");
+ TI_ASSERT_INFO(f, "./sky_map.bin not found");
std::vector sky_map_data(sky_map_size.prod() * 3);
std::fread(sky_map_data.data(), sizeof(uint32), sky_map_data.size(), f);
f = fopen("sky_samples.bin", "rb");
- TC_ASSERT_INFO(f, "./sky_samples.bin not found");
+ TI_ASSERT_INFO(f, "./sky_samples.bin not found");
std::vector sky_sample_data(n_sky_samples * 5);
trash(std::fread(sky_sample_data.data(), sizeof(uint32),
sky_sample_data.size(), f));
diff --git a/examples/cpp/volume_renderer.cpp b/examples/cpp/volume_renderer.cpp
index b4f1608a93001..ea5fe7e1e8f3a 100644
--- a/examples/cpp/volume_renderer.cpp
+++ b/examples/cpp/volume_renderer.cpp
@@ -4,7 +4,7 @@ TLANG_NAMESPACE_BEGIN
bool use_gui = false;
TLANG_NAMESPACE_END
-#if defined(CUDA_FOUND)
+#if defined(TI_WITH_CUDA)
#include
TLANG_NAMESPACE_BEGIN
@@ -13,9 +13,9 @@ auto volume_renderer = [](std::vector cli_param) {
auto param = parse_param(cli_param);
bool gpu = param.get("gpu", true);
- TC_P(gpu);
+ TI_P(gpu);
std::string fn = param.get("fn", "snow_density_256.bin");
- TC_P(fn);
+ TI_P(fn);
CoreState::set_trigger_gdb_when_crash(true);
Program prog(gpu ? Arch::gpu : Arch::x86_64);
TRenderer renderer((Dict()));
@@ -71,7 +71,7 @@ auto volume_renderer = [](std::vector cli_param) {
last_voxel_level = voxel_level;
std::vector particles;
auto f = fopen(fn.c_str(), "rb");
- TC_WARN_IF(!f, "{} not found", fn);
+ TI_WARN_IF(!f, "{} not found", fn);
if (!f)
return;
@@ -91,7 +91,7 @@ auto volume_renderer = [](std::vector cli_param) {
max_density = std::max(max_density, density_field[i]);
}
- TC_P(max_density);
+ TI_P(max_density);
for (int i = 0; i < pow<3>(grid_resolution); i++) {
density_field[i] /= max_density; // normalize to 1 first
@@ -135,11 +135,11 @@ auto volume_renderer = [](std::vector cli_param) {
} else if (voxel_level == 4) {
coarsening = 64;
} else {
- TC_ASSERT(false);
+ TI_ASSERT(false);
}
renderer.parameters.grid_resolution = 256 / coarsening;
renderer.check_param_update();
- TC_P(particles.size());
+ TI_P(particles.size());
rasterize();
}
for (int d = 0; d < 3; d++) {
@@ -267,17 +267,17 @@ auto volume_renderer = [](std::vector cli_param) {
frame += video_step - 1;
gui->canvas->img.write_as_image(fmt::format("gui/{:05d}.png", frame));
Time::sleep(0.03);
- TC_P(Time::get_time() - ft);
+ TI_P(Time::get_time() - ft);
}
};
-TC_REGISTER_TASK(volume_renderer);
+TI_REGISTER_TASK(volume_renderer);
auto volume_renderer_gui = [](std::vector cli_param) {
use_gui = true;
volume_renderer(cli_param);
};
-TC_REGISTER_TASK(volume_renderer_gui);
+TI_REGISTER_TASK(volume_renderer_gui);
TLANG_NAMESPACE_END
#endif
diff --git a/examples/cpp/volume_renderer.h b/examples/cpp/volume_renderer.h
index 853a68eadee32..a21c404137f6a 100644
--- a/examples/cpp/volume_renderer.h
+++ b/examples/cpp/volume_renderer.h
@@ -67,7 +67,7 @@ class TRenderer {
}
void place_data() {
- TC_ASSERT(output_res == Vector2i(1280, 720));
+ TI_ASSERT(output_res == Vector2i(1280, 720));
root.dense(Index(0), 1024 * 1024).place(buffer(0), buffer(1), buffer(2));
root.dense(Indices(0, 1, 2), 4)
@@ -669,14 +669,14 @@ class TRenderer {
std::FILE *f;
if (use_sky_map) {
f = fopen("sky_map.bin", "rb");
- TC_ASSERT_INFO(f, "./sky_map.bin not found");
+ TI_ASSERT_INFO(f, "./sky_map.bin not found");
std::vector sky_map_data(sky_map_size.prod() * 3);
if (std::fread(sky_map_data.data(), sizeof(uint32), sky_map_data.size(),
f)) {
}
f = fopen("sky_samples.bin", "rb");
- TC_ASSERT_INFO(f, "./sky_samples.bin not found");
+ TI_ASSERT_INFO(f, "./sky_samples.bin not found");
std::vector sky_sample_data(n_sky_samples * 5);
if (std::fread(sky_sample_data.data(), sizeof(uint32),
(int)sky_sample_data.size(), f)) {
diff --git a/examples/cpp/voxel_renderer.cpp b/examples/cpp/voxel_renderer.cpp
index 99ffb0e5b7054..bf0122d6042fc 100644
--- a/examples/cpp/voxel_renderer.cpp
+++ b/examples/cpp/voxel_renderer.cpp
@@ -9,7 +9,7 @@ auto voxel_renderer = [](const std::vector ¶ms) {
int n = 512;
if (params.size() < 2) {
- TC_INFO("Usage: ti voxel renderer filename.bin resolution");
+ TI_INFO("Usage: ti voxel renderer filename.bin resolution");
exit(-1);
}
@@ -183,7 +183,7 @@ auto voxel_renderer = [](const std::vector ¶ms) {
fn = fmt::format(params[0], frame);
}
auto f = fopen(fn.c_str(), "rb");
- TC_ERROR_UNLESS(f, "File {} not found", params[0]);
+ TI_ERROR_UNLESS(f, "File {} not found", params[0]);
std::vector density_field(pow<3>(grid_resolution), 0);
trash(std::fread(density_field.data(), sizeof(char), density_field.size(),
f));
@@ -214,6 +214,6 @@ auto voxel_renderer = [](const std::vector ¶ms) {
gui.canvas->img.write_as_image(fn + ".png");
}
};
-TC_REGISTER_TASK(voxel_renderer);
+TI_REGISTER_TASK(voxel_renderer);
TLANG_NAMESPACE_END
diff --git a/examples/mpm128.py b/examples/mpm128.py
index 2e7f207080b9e..ffdfdacf3da4a 100644
--- a/examples/mpm128.py
+++ b/examples/mpm128.py
@@ -98,7 +98,7 @@ def reset():
Jp.fill(1)
C.fill(0)
-print("[Hint] Use WSAD/arrow keys to control gravity. Use left/right mouse bottons to attract/repel. (OS X not yet supported)")
+print("[Hint] Use WSAD/arrow keys to control gravity. Use left/right mouse bottons to attract/repel.")
gui = ti.GUI("Taichi MLS-MPM-128", res=512, background_color=0x112F41)
reset()
diff --git a/examples/renderer.py b/examples/renderer.py
index ab56aa2a5f975..4fd8862328872 100644
--- a/examples/renderer.py
+++ b/examples/renderer.py
@@ -60,8 +60,7 @@ def buffers():
ti.root.dense(ti.ijk, 2).dense(ti.ijk, particle_grid_res // 8).dense(
ti.ijk, 8).place(voxel_has_particle)
- ti.root.dense(ti.ijk, 4).dense(
- ti.ijk, particle_grid_res // 8).pointer().dense(ti.ijk, 8).dynamic(
+ ti.root.dense(ti.ijk, 4).pointer(ti.ijk, particle_grid_res // 8).dense(ti.ijk, 8).dynamic(
ti.l, max_num_particles_per_cell, 512).place(pid)
ti.root.dense(ti.l, max_num_particles).place(particle_x, particle_v,
diff --git a/examples/taichi_sparse.py b/examples/taichi_sparse.py
index c4bd2a53d04ef..be8abd2c2c03b 100644
--- a/examples/taichi_sparse.py
+++ b/examples/taichi_sparse.py
@@ -7,9 +7,9 @@
res = n + n // 4 + n // 16 + n // 64
img = ti.var(ti.f32, shape=(res, res))
-block1 = ti.root.dense(ti.ij, n // 64).pointer()
-block2 = block1.dense(ti.ij, 4).pointer()
-block3 = block2.dense(ti.ij, 4).pointer()
+block1 = ti.root.pointer(ti.ij, n // 64)
+block2 = block1.pointer(ti.ij, 4)
+block3 = block2.pointer(ti.ij, 4)
block3.dense(ti.ij, 4).place(x)
@ti.func
diff --git a/external/include/miniz.h b/external/include/miniz.h
index 2ef07e3cd77a5..68cd8717d3153 100644
--- a/external/include/miniz.h
+++ b/external/include/miniz.h
@@ -4297,7 +4297,7 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#define MZ_FFLUSH fflush
#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
#define MZ_DELETE_FILE remove
-#elif defined(__GNUC__) && _LARGEFILE64_SOURCE && !defined(TC_PLATFORM_OSX)
+#elif defined(__GNUC__) && _LARGEFILE64_SOURCE && !defined(TI_PLATFORM_OSX)
#ifndef MINIZ_NO_TIME
#include
#endif
diff --git a/external/include/stb_image.h b/external/include/stb_image.h
index de04259da53b9..aa053383b4b8e 100644
--- a/external/include/stb_image.h
+++ b/external/include/stb_image.h
@@ -1,4 +1,4 @@
-#if defined(TC_IMAGE_IO)
+#if defined(TI_IMAGE_IO)
/* stb_image - v2.16 - public domain image loader - http://nothings.org/stb_image.h
no warranty implied; use at your own risk
diff --git a/external/include/stb_image_write.h b/external/include/stb_image_write.h
index b53ae306d57b7..7b4c1c3df6dc0 100644
--- a/external/include/stb_image_write.h
+++ b/external/include/stb_image_write.h
@@ -1,4 +1,4 @@
-#if defined(TC_IMAGE_IO)
+#if defined(TI_IMAGE_IO)
/* stb_image_write - v1.07 - public domain - http://nothings.org/stb/stb_image_write.h
writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015
no warranty implied; use at your own risk
diff --git a/misc/amalgamate.py b/misc/amalgamate.py
index d6dfe56f571a4..893dd1e76c130 100644
--- a/misc/amalgamate.py
+++ b/misc/amalgamate.py
@@ -66,7 +66,7 @@ def include(self, fn):
if l == '#endif':
protected = False
continue
- if l == '#if !defined(TC_AMALGAMATED)':
+ if l == '#if !defined(TI_AMALGAMATED)':
protected = True
continue
match = re.search(include_template, l)
@@ -109,9 +109,9 @@ def run(self):
print(
"// DO NOT EDIT MANUALLY, unless you know that you are doing.",
file=self.output_f)
- print("#define TC_INCLUDED", file=self.output_f)
- print("#define TC_AMALGAMATED", file=self.output_f)
- print("#define TC_ISE_NONE", file=self.output_f)
+ print("#define TI_INCLUDED", file=self.output_f)
+ print("#define TI_AMALGAMATED", file=self.output_f)
+ print("#define TI_ISE_NONE", file=self.output_f)
for f in self.files:
self.include(f)
print("Included files:")
@@ -130,7 +130,7 @@ def test(self):
Vector4 v(21);
auto x = v + v;
fmt::print("{}\\n", x.x);
- TC_P(x);
+ TI_P(x);
}
''')
t = time.time()
diff --git a/misc/appveyor_filter.py b/misc/appveyor_filter.py
new file mode 100644
index 0000000000000..289daaf781f34
--- /dev/null
+++ b/misc/appveyor_filter.py
@@ -0,0 +1,8 @@
+import sys
+import os
+
+msg = os.environ["APPVEYOR_REPO_COMMIT_MESSAGE"]
+if msg.startswith('[release]') or sys.version_info[1] == 6:
+ exit(0) # Build for this configuration (starts with '[release]', or python version is 3.6)
+else:
+ exit(1) # Do not build this configuration. See appveyor.yml
diff --git a/misc/obsolete_cpp_tests/allocator.cpp b/misc/obsolete_cpp_tests/allocator.cpp
index 0e9184ae2ec2a..7cac37e5191c6 100644
--- a/misc/obsolete_cpp_tests/allocator.cpp
+++ b/misc/obsolete_cpp_tests/allocator.cpp
@@ -4,7 +4,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("gpu_gc_basics") {
+TI_TEST("gpu_gc_basics") {
for (auto arch : {Arch::gpu}) {
int n = 32;
Program prog(arch);
@@ -27,26 +27,26 @@ TC_TEST("gpu_gc_basics") {
})();
auto stat = x.parent().parent().snode()->stat();
- TC_CHECK(stat.num_resident_blocks == n - 1);
+ TI_CHECK(stat.num_resident_blocks == n - 1);
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
- TC_CHECK(x.val(i, j) == i + j);
+ TI_CHECK(x.val(i, j) == i + j);
}
}
x.parent().parent().snode()->clear_data_and_deactivate();
stat = x.parent().parent().snode()->stat();
- TC_CHECK(stat.num_resident_blocks == 0);
- TC_CHECK(stat.num_recycled_blocks == 0);
+ TI_CHECK(stat.num_resident_blocks == 0);
+ TI_CHECK(stat.num_recycled_blocks == 0);
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
- TC_CHECK(x.val(i, j) == 0);
+ TI_CHECK(x.val(i, j) == 0);
}
}
}
};
-TC_TEST("parallel_particle_sort") {
+TI_TEST("parallel_particle_sort") {
Program prog(Arch::gpu);
CoreState::set_trigger_gdb_when_crash(true);
@@ -76,7 +76,7 @@ TC_TEST("parallel_particle_sort") {
p_x[i] = Vector3(0.5_f) + offset * 0.7f;
}
- TC_ASSERT(n_particles <= max_n_particles);
+ TI_ASSERT(n_particles <= max_n_particles);
auto i = Index(0), j = Index(1), k = Index(2);
auto p = Index(3);
@@ -89,14 +89,14 @@ TC_TEST("parallel_particle_sort") {
root.dense(i, max_n_particles).place(flag);
- TC_ASSERT(n % grid_block_size == 0);
+ TI_ASSERT(n % grid_block_size == 0);
root.dense({i, j, k}, n / grid_block_size)
.pointer()
.dense({i, j, k}, grid_block_size)
.place(grid_m);
});
- TC_ASSERT(bit::is_power_of_two(n));
+ TI_ASSERT(bit::is_power_of_two(n));
Kernel(sort).def([&] {
BlockDim(256);
@@ -121,7 +121,7 @@ TC_TEST("parallel_particle_sort") {
sort();
prog.synchronize();
for (int k = 0; k < max_n_particles; k++) {
- TC_CHECK(flag.val(k) == 1);
+ TI_CHECK(flag.val(k) == 1);
}
auto stat = grid_m.parent().parent().snode()->stat();
int nb = stat.num_resident_blocks;
@@ -129,14 +129,14 @@ TC_TEST("parallel_particle_sort") {
last_nb = nb;
} else {
if (last_nb != nb) {
- TC_P(i);
+ TI_P(i);
}
- TC_CHECK(last_nb == nb);
+ TI_CHECK(last_nb == nb);
}
}
};
-TC_TEST("struct_for") {
+TI_TEST("struct_for") {
Program prog(Arch::gpu);
CoreState::set_trigger_gdb_when_crash(true);
@@ -166,7 +166,7 @@ TC_TEST("struct_for") {
p_x[i] = Vector3(0.5_f) + offset * 0.7f;
}
- TC_ASSERT(n_particles <= max_n_particles);
+ TI_ASSERT(n_particles <= max_n_particles);
auto i = Index(0), j = Index(1), k = Index(2);
auto p = Index(3);
@@ -201,8 +201,8 @@ TC_TEST("struct_for") {
big_count += 1;
}
}
- TC_CHECK(zero_count == 0);
- TC_CHECK(big_count == 0);
+ TI_CHECK(zero_count == 0);
+ TI_CHECK(big_count == 0);
}
};
diff --git a/misc/obsolete_cpp_tests/atomics.cpp b/misc/obsolete_cpp_tests/atomics.cpp
index 055f8e606555d..5183caf3fe523 100644
--- a/misc/obsolete_cpp_tests/atomics.cpp
+++ b/misc/obsolete_cpp_tests/atomics.cpp
@@ -4,7 +4,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("atomics") {
+TI_TEST("atomics") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 10000000;
Program prog(Arch::x86_64);
@@ -23,11 +23,11 @@ TC_TEST("atomics") {
func();
- TC_CHECK(sum.val() == n);
- TC_CHECK(fsum.val() == 0);
+ TI_CHECK(sum.val() == n);
+ TI_CHECK(fsum.val() == 0);
};
-TC_TEST("atomics2") {
+TI_TEST("atomics2") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 1000;
Program prog(Arch::x86_64);
@@ -42,10 +42,10 @@ TC_TEST("atomics2") {
func();
- TC_CHECK(fsum.val() == 1000);
+ TI_CHECK(fsum.val() == 1000);
};
-TC_TEST("parallel_reduce") {
+TI_TEST("parallel_reduce") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 1024 * 1024 * 32;
Program prog(Arch::x86_64);
@@ -70,7 +70,7 @@ TC_TEST("parallel_reduce") {
reduce();
prog.profiler_print();
- TC_CHECK(fsum.val() == (n / 2) * (n - 1) * 10);
+ TI_CHECK(fsum.val() == (n / 2) * (n - 1) * 10);
};
TLANG_NAMESPACE_END
diff --git a/misc/obsolete_cpp_tests/compiler_basics.cpp b/misc/obsolete_cpp_tests/compiler_basics.cpp
index 5c91df12fac10..349924776b8fe 100644
--- a/misc/obsolete_cpp_tests/compiler_basics.cpp
+++ b/misc/obsolete_cpp_tests/compiler_basics.cpp
@@ -5,7 +5,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("compiler_linalg") {
+TI_TEST("compiler_linalg") {
CoreState::set_trigger_gdb_when_crash(true);
Program prog(Arch::x86_64);
@@ -33,7 +33,7 @@ TC_TEST("compiler_linalg") {
})();
};
-TC_TEST("select") {
+TI_TEST("select") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 128;
Program prog(Arch::x86_64);
@@ -53,11 +53,11 @@ TC_TEST("select") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == (2 - i % 2) * i);
+ TI_CHECK(a.val(i) == (2 - i % 2) * i);
}
};
-TC_TEST("compiler_basics") {
+TI_TEST("compiler_basics") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 128;
Program prog(Arch::x86_64);
@@ -79,11 +79,11 @@ TC_TEST("compiler_basics") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == (2 - i % 2) * i);
+ TI_CHECK(a.val(i) == (2 - i % 2) * i);
}
};
-TC_TEST("simplify_access") {
+TI_TEST("simplify_access") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 128;
Program prog(Arch::x86_64);
@@ -96,7 +96,7 @@ TC_TEST("simplify_access") {
kernel([&]() { For(a, [&](Expr i) { a[i] = b[i] + 1; }); })();
};
-TC_TEST("fancy_for") {
+TI_TEST("fancy_for") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 128;
Program prog(Arch::x86_64);
@@ -118,11 +118,11 @@ TC_TEST("fancy_for") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == (2 - i % 2) * i);
+ TI_CHECK(a.val(i) == (2 - i % 2) * i);
}
};
-TC_TEST("simd_if") {
+TI_TEST("simd_if") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 128;
Program prog(Arch::x86_64);
@@ -144,11 +144,11 @@ TC_TEST("simd_if") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == (2 - i % 2) * i);
+ TI_CHECK(a.val(i) == (2 - i % 2) * i);
}
};
-TC_TEST("simd_if2") {
+TI_TEST("simd_if2") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 32;
Program prog(Arch::x86_64);
@@ -170,7 +170,7 @@ TC_TEST("simd_if2") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == (1 + i % 3) * i);
+ TI_CHECK(a.val(i) == (1 + i % 3) * i);
}
};
@@ -206,9 +206,9 @@ auto test_circle = [] {
gui.update();
}
};
-TC_REGISTER_TASK(test_circle);
+TI_REGISTER_TASK(test_circle);
-TC_TEST("vectorize") {
+TI_TEST("vectorize") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 128;
Program prog(Arch::x86_64);
@@ -223,11 +223,11 @@ TC_TEST("vectorize") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == i);
+ TI_CHECK(a.val(i) == i);
}
};
-TC_TEST("rand") {
+TI_TEST("rand") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 4;
Program prog(Arch::x86_64);
@@ -239,7 +239,7 @@ TC_TEST("rand") {
kernel([&]() { For(0, n, [&](Expr i) { Print(Rand()); }); })();
};
-TC_TEST("while") {
+TI_TEST("while") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 4096;
Program prog(Arch::x86_64);
@@ -262,11 +262,11 @@ TC_TEST("while") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == (i - 1) * i / 2);
+ TI_CHECK(a.val(i) == (i - 1) * i / 2);
}
};
-TC_TEST("slp") {
+TI_TEST("slp") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 16;
Program prog(Arch::x86_64);
@@ -290,14 +290,14 @@ TC_TEST("slp") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == 1);
- TC_CHECK(b.val(i) == 2);
- TC_CHECK(c.val(i) == 3);
- TC_CHECK(d.val(i) == 4);
+ TI_CHECK(a.val(i) == 1);
+ TI_CHECK(b.val(i) == 2);
+ TI_CHECK(c.val(i) == 3);
+ TI_CHECK(d.val(i) == 4);
}
};
-TC_TEST("slp1") {
+TI_TEST("slp1") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 16;
for (auto slp1 : {true, false}) {
@@ -322,13 +322,13 @@ TC_TEST("slp1") {
for (int i = 0; i < n; i++) {
for (int d = 0; d < 4; d++) {
- TC_CHECK(grid(d).val(i) == d);
+ TI_CHECK(grid(d).val(i) == d);
}
}
}
};
-TC_TEST("slp2") {
+TI_TEST("slp2") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 16;
Program prog(Arch::x86_64);
@@ -348,12 +348,12 @@ TC_TEST("slp2") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == 1 + i * 7);
- TC_CHECK(b.val(i) == 2 + i * 9);
+ TI_CHECK(a.val(i) == 1 + i * 7);
+ TI_CHECK(b.val(i) == 2 + i * 9);
}
};
-TC_TEST("slp3") {
+TI_TEST("slp3") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 16;
Program prog(Arch::x86_64);
@@ -375,12 +375,12 @@ TC_TEST("slp3") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == 1 + i * 7);
- TC_CHECK(b.val(i) == 2 + i * 9);
+ TI_CHECK(a.val(i) == 1 + i * 7);
+ TI_CHECK(b.val(i) == 2 + i * 9);
}
};
-TC_TEST("slpmatvecmul") {
+TI_TEST("slpmatvecmul") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 16;
Program prog(Arch::x86_64);
@@ -414,14 +414,14 @@ TC_TEST("slpmatvecmul") {
/*
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == 1 + i * 7);
- TC_CHECK(b.val(i) == 2 + i * 9);
+ TI_CHECK(a.val(i) == 1 + i * 7);
+ TI_CHECK(b.val(i) == 2 + i * 9);
}
*/
};
// scalar a * scalar b * vec c
-TC_TEST("mixed_simd1") {
+TI_TEST("mixed_simd1") {
for (auto vec_size : {4, 8, 16}) {
Program prog;
@@ -461,14 +461,14 @@ TC_TEST("mixed_simd1") {
for (int j = 0; j < vec_size; j++) {
auto val = v(j).val(i);
float32 gt = i * j * 2;
- TC_CHECK_EQUAL(gt, val, 1e-3_f);
+ TI_CHECK_EQUAL(gt, val, 1e-3_f);
}
}
}
}
// Vec reduction
-TC_TEST("mixed_simd2") {
+TI_TEST("mixed_simd2") {
int n = 64;
for (auto vec_size : {4, 8, 16}) {
@@ -514,13 +514,13 @@ TC_TEST("mixed_simd2") {
for (int i = 0; i < n; i++) {
auto val = sum.val(i);
float32 gt = vec_size * (vec_size - 1) / 2 + i * vec_size;
- TC_CHECK_EQUAL(gt, val, 1e-5_f);
+ TI_CHECK_EQUAL(gt, val, 1e-5_f);
}
}
}
// reduce(vec_a ** 2 - vec_b ** 2) * vec_c<2n>
-TC_TEST("mixed_simd3_slp") {
+TI_TEST("mixed_simd3_slp") {
for (auto vec_size : {16}) {
// why vec_size = 16 fails??
Program prog;
@@ -581,13 +581,13 @@ TC_TEST("mixed_simd3_slp") {
for (int j = 0; j < vec_size * 2; j++) {
auto val = c(j).val(i);
auto gt = s * (i - 2 + j);
- TC_CHECK_EQUAL(gt, val, 1e-3_f);
+ TI_CHECK_EQUAL(gt, val, 1e-3_f);
}
}
}
}
-TC_TEST("vector_split1") {
+TI_TEST("vector_split1") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 32;
Program prog(Arch::x86_64);
@@ -603,11 +603,11 @@ TC_TEST("vector_split1") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == i);
+ TI_CHECK(a.val(i) == i);
}
};
-TC_TEST("vector_split_slp") {
+TI_TEST("vector_split_slp") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 256;
Program prog(Arch::x86_64);
@@ -632,14 +632,14 @@ TC_TEST("vector_split_slp") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == 1 + i);
- TC_CHECK(b.val(i) == 2 + i);
- TC_CHECK(c.val(i) == 3 + i);
- TC_CHECK(d.val(i) == 4 + i);
+ TI_CHECK(a.val(i) == 1 + i);
+ TI_CHECK(b.val(i) == 2 + i);
+ TI_CHECK(c.val(i) == 3 + i);
+ TI_CHECK(d.val(i) == 4 + i);
}
};
-TC_TEST("union_cast") {
+TI_TEST("union_cast") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 16;
@@ -660,13 +660,13 @@ TC_TEST("union_cast") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) ==
+ TI_CHECK(a.val(i) ==
union_cast(union_cast(i * 1000) + 1234.0f));
}
}
};
-TC_TEST("logic_not") {
+TI_TEST("logic_not") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 16;
@@ -685,14 +685,14 @@ TC_TEST("logic_not") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val() == 0);
- TC_CHECK(b.val() != 0);
- TC_CHECK(c.val() == 0);
+ TI_CHECK(a.val() == 0);
+ TI_CHECK(b.val() != 0);
+ TI_CHECK(c.val() == 0);
}
}
};
-TC_TEST("simd_if_5") {
+TI_TEST("simd_if_5") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64}) {
for (auto vec : {1, 4, 8}) {
@@ -713,13 +713,13 @@ TC_TEST("simd_if_5") {
});
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(c.val(i) == 1);
+ TI_CHECK(c.val(i) == 1);
}
}
}
};
-TC_TEST("point_inside_box") {
+TI_TEST("point_inside_box") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64}) {
for (auto vec : {1, 4, 8}) {
@@ -746,13 +746,13 @@ TC_TEST("point_inside_box") {
});
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(bool(c.val(i)) == true);
+ TI_CHECK(bool(c.val(i)) == true);
}
}
}
};
-TC_TEST("while_in_while") {
+TI_TEST("while_in_while") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64}) {
for (auto vec : {1, 4, 8}) {
@@ -782,13 +782,13 @@ TC_TEST("while_in_while") {
});
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(c.val(i) == ((i + 1) % 2) * 100);
+ TI_CHECK(c.val(i) == ((i + 1) % 2) * 100);
}
}
}
};
-TC_TEST("cmp") {
+TI_TEST("cmp") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64}) {
for (auto vec : {1, 4, 8}) {
@@ -812,7 +812,7 @@ TC_TEST("cmp") {
For(0, n, [&](Expr i) { c[i] = a[i] OP b[i]; }); \
})(); \
for (int i = 0; i < n; i++) { \
- TC_CHECK(bool(c.val(i)) == \
+ TI_CHECK(bool(c.val(i)) == \
bool(a.val(i) OP b.val(i))); \
}
diff --git a/misc/obsolete_cpp_tests/dynamic.cpp b/misc/obsolete_cpp_tests/dynamic.cpp
index 2d7c1e832c9a2..6d866ff4f6e75 100644
--- a/misc/obsolete_cpp_tests/dynamic.cpp
+++ b/misc/obsolete_cpp_tests/dynamic.cpp
@@ -4,7 +4,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("append_and_probe") {
+TI_TEST("append_and_probe") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 32;
@@ -31,12 +31,12 @@ TC_TEST("append_and_probe") {
})();
for (int i = 0; i < n; i++)
- TC_CHECK(x.val(i) == i);
- TC_CHECK(len.val() == n);
+ TI_CHECK(x.val(i) == i);
+ TI_CHECK(len.val() == n);
}
};
-TC_TEST("activate") {
+TI_TEST("activate") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 32;
Program prog(arch);
@@ -66,13 +66,13 @@ TC_TEST("activate") {
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
- TC_CHECK(x.val(i, j) == i + j);
+ TI_CHECK(x.val(i, j) == i + j);
}
}
}
};
-TC_TEST("task_list") {
+TI_TEST("task_list") {
for (auto arch : {Arch::gpu}) {
int n = 262144;
int m = 64;
@@ -105,13 +105,13 @@ TC_TEST("task_list") {
for (int i = 0; i < n; i++) {
if (i % 5 == 4)
for (int j = 0; j < m; j++) {
- TC_CHECK(x.val(i, j) == i + j + P);
+ TI_CHECK(x.val(i, j) == i + j + P);
}
}
}
};
-TC_TEST("task_list_dynamic") {
+TI_TEST("task_list_dynamic") {
for (auto arch : {Arch::gpu}) {
int n = 262144;
int m = 64;
@@ -142,13 +142,13 @@ TC_TEST("task_list_dynamic") {
for (int i = 0; i < n; i++) {
if (i % 5 == 4)
for (int j = 0; j < 1; j++) {
- TC_CHECK(x.val(i, j) == i + j + P);
+ TI_CHECK(x.val(i, j) == i + j + P);
}
}
}
};
-TC_TEST("parallel_append") {
+TI_TEST("parallel_append") {
for (auto arch : {Arch::gpu}) {
int n = 32;
Program prog(arch);
@@ -178,18 +178,18 @@ TC_TEST("parallel_append") {
else
append();
auto stat = x.parent().parent().snode()->stat();
- TC_CHECK(stat.num_resident_blocks == n);
+ TI_CHECK(stat.num_resident_blocks == n);
if (i % 2)
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
- TC_CHECK(x.val(i, j) == 0);
+ TI_CHECK(x.val(i, j) == 0);
}
}
}
}
};
-TC_TEST("append_2d") {
+TI_TEST("append_2d") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 32;
Program prog(arch);
@@ -211,13 +211,13 @@ TC_TEST("append_2d") {
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
- TC_CHECK(x.val(i, j) == i + j);
+ TI_CHECK(x.val(i, j) == i + j);
}
}
}
};
-TC_TEST("clear") {
+TI_TEST("clear") {
CoreState::set_trigger_gdb_when_crash(true);
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 32;
@@ -249,15 +249,15 @@ TC_TEST("clear") {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (j < i)
- TC_CHECK(x.val(i, j) == i + j);
+ TI_CHECK(x.val(i, j) == i + j);
else
- TC_CHECK(x.val(i, j) == 0);
+ TI_CHECK(x.val(i, j) == 0);
}
}
}
};
-TC_TEST("sort") {
+TI_TEST("sort") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 4;
Program prog(arch);
@@ -273,7 +273,7 @@ TC_TEST("sort") {
Global(c, i32);
Global(coord, i32);
Global(p, i32);
- TC_P(particles);
+ TI_P(particles);
layout([&]() {
auto i = Index(0);
auto j = Index(1);
@@ -309,12 +309,12 @@ TC_TEST("sort") {
})();
for (int i = 0; i < n * n; i++) {
- TC_CHECK(c.val(i) == count[i]);
+ TI_CHECK(c.val(i) == count[i]);
}
}
};
-TC_TEST("dilate") {
+TI_TEST("dilate") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
for (auto ds : {1}) {
int n = 32;
@@ -350,16 +350,16 @@ TC_TEST("dilate") {
for (int i = 0; i < n; i++) {
int bid = i / bs;
- TC_CHECK(x.val(i) == (1 <= bid && bid < 4));
+ TI_CHECK(x.val(i) == (1 <= bid && bid < 4));
}
for (int i = 0; i < n / bs; i++) {
- TC_CHECK(y.val(i) == (1 <= i && i < 4));
+ TI_CHECK(y.val(i) == (1 <= i && i < 4));
}
}
}
};
-TC_TEST("dynamic_sort") {
+TI_TEST("dynamic_sort") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
int n = 4;
Program prog(arch);
@@ -375,7 +375,7 @@ TC_TEST("dynamic_sort") {
Global(c, i32);
Global(coord, i32);
Global(p, i32);
- TC_P(particles);
+ TI_P(particles);
layout([&]() {
auto i = Index(0);
auto j = Index(1);
@@ -414,7 +414,7 @@ TC_TEST("dynamic_sort") {
})();
for (int i = 0; i < n * n; i++) {
- TC_CHECK(c.val(i) == count[i]);
+ TI_CHECK(c.val(i) == count[i]);
}
}
};
@@ -434,7 +434,7 @@ auto reset_grid_benchmark = []() {
auto i = Index(0), j = Index(1), k = Index(2);
layout([&]() {
- TC_ASSERT(n % grid_block_size == 0);
+ TI_ASSERT(n % grid_block_size == 0);
auto &block = root.dense({i, j, k}, n / grid_block_size);
constexpr bool block_soa = false;
if (block_soa) {
@@ -449,7 +449,7 @@ auto reset_grid_benchmark = []() {
}
});
- TC_ASSERT(bit::is_power_of_two(n));
+ TI_ASSERT(bit::is_power_of_two(n));
auto &reset_grid = kernel([&]() {
Declare(i);
@@ -464,8 +464,8 @@ auto reset_grid_benchmark = []() {
});
while (1)
- TC_TIME(reset_grid());
+ TI_TIME(reset_grid());
};
-TC_REGISTER_TASK(reset_grid_benchmark);
+TI_REGISTER_TASK(reset_grid_benchmark);
TLANG_NAMESPACE_END
diff --git a/misc/obsolete_cpp_tests/gpu.cpp b/misc/obsolete_cpp_tests/gpu.cpp
index 3b34b3cdab72b..ea7d6a46e4222 100644
--- a/misc/obsolete_cpp_tests/gpu.cpp
+++ b/misc/obsolete_cpp_tests/gpu.cpp
@@ -4,7 +4,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("compiler_basics_gpu") {
+TI_TEST("compiler_basics_gpu") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 128;
Program prog(Arch::gpu);
@@ -24,18 +24,18 @@ TC_TEST("compiler_basics_gpu") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == (2 - i % 2) * i);
+ TI_CHECK(a.val(i) == (2 - i % 2) * i);
}
};
-#if defined(CUDA_FOUND)
-TC_TEST("cuda_malloc_managed") {
+#if defined(TI_WITH_CUDA)
+TI_TEST("cuda_malloc_managed") {
void *ptr;
cudaMallocManaged(&ptr, 1LL << 40);
int *data = (int *)ptr;
for (int i = 0; i < 100000; i++) {
- TC_CHECK(data[i * 749] == 0);
+ TI_CHECK(data[i * 749] == 0);
}
cudaFree(ptr);
}
diff --git a/misc/obsolete_cpp_tests/hash.cpp b/misc/obsolete_cpp_tests/hash.cpp
index 6c8bf4e16bbb0..a8c1aaec439ee 100644
--- a/misc/obsolete_cpp_tests/hash.cpp
+++ b/misc/obsolete_cpp_tests/hash.cpp
@@ -3,7 +3,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("hash") {
+TI_TEST("hash") {
for (auto arch : {Arch::gpu, Arch::x86_64}) {
Program prog(arch);
CoreState::set_trigger_gdb_when_crash(true);
@@ -22,10 +22,10 @@ TC_TEST("hash") {
})();
for (int i = 0; i < n * n / 2; i++) {
- TC_CHECK(u.val(i) == i * 2);
+ TI_CHECK(u.val(i) == i * 2);
}
for (int i = n * n / 2; i < n * n; i++) {
- TC_CHECK(u.val(i) == 0);
+ TI_CHECK(u.val(i) == 0);
}
}
}
diff --git a/misc/obsolete_cpp_tests/micro_access_ops.cpp b/misc/obsolete_cpp_tests/micro_access_ops.cpp
index 031c033895cee..8f38699acd1b1 100644
--- a/misc/obsolete_cpp_tests/micro_access_ops.cpp
+++ b/misc/obsolete_cpp_tests/micro_access_ops.cpp
@@ -3,7 +3,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("lower_access_basics") {
+TI_TEST("lower_access_basics") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
for (auto vec : {1, 4, 8}) {
CoreState::set_trigger_gdb_when_crash(true);
@@ -21,7 +21,7 @@ TC_TEST("lower_access_basics") {
func();
for (int i = 0; i < n; i++) {
- TC_CHECK(a.val(i) == i);
+ TI_CHECK(a.val(i) == i);
}
}
}
diff --git a/misc/obsolete_cpp_tests/opt.cpp b/misc/obsolete_cpp_tests/opt.cpp
index 39d539321f0f6..0fe75557e3779 100644
--- a/misc/obsolete_cpp_tests/opt.cpp
+++ b/misc/obsolete_cpp_tests/opt.cpp
@@ -4,7 +4,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("access_simp") {
+TI_TEST("access_simp") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 16;
Program prog(Arch::x86_64);
@@ -29,10 +29,10 @@ TC_TEST("access_simp") {
});
})();
- TC_CHECK(sum.val() == 16);
+ TI_CHECK(sum.val() == 16);
};
-TC_TEST("root_leaf_path_weakening") {
+TI_TEST("root_leaf_path_weakening") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 16;
Program prog(Arch::x86_64);
diff --git a/misc/obsolete_cpp_tests/scalar_svd.h b/misc/obsolete_cpp_tests/scalar_svd.h
index 6dc470a7de91f..925f75c4e42b8 100644
--- a/misc/obsolete_cpp_tests/scalar_svd.h
+++ b/misc/obsolete_cpp_tests/scalar_svd.h
@@ -37,7 +37,7 @@ A. McAdams, A. Selle, R. Tamstorf, J. Teran and E. Sifakis
// POSSIBILITY OF SUCH DAMAGE.
//#####################################################################
-TC_FORCE_INLINE float rsqrt(const float f) {
+TI_FORCE_INLINE float rsqrt(const float f) {
return 1.0f / std::sqrt(f);
}
@@ -48,7 +48,7 @@ constexpr float Cosine_Pi_Over_Eight =
0.9238795325112867f; //.5 * sqrt(2. + sqrt(2.));
template
-TC_FORCE_INLINE void svd(const float a11,
+TI_FORCE_INLINE void svd(const float a11,
const float a12,
const float a13,
const float a21,
diff --git a/misc/obsolete_cpp_tests/scratch_pad.cpp b/misc/obsolete_cpp_tests/scratch_pad.cpp
index 5a7e2e1a17d65..99ef7a3596c64 100644
--- a/misc/obsolete_cpp_tests/scratch_pad.cpp
+++ b/misc/obsolete_cpp_tests/scratch_pad.cpp
@@ -4,7 +4,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("scratch_pad_bounds") {
+TI_TEST("scratch_pad_bounds") {
Program prog;
int N = 8;
@@ -22,26 +22,26 @@ TC_TEST("scratch_pad_bounds") {
pad.access({1, 2, -3}, ScratchPad::AccessFlag::read);
- TC_CHECK(pad.bounds[0][0] == 1);
- TC_CHECK(pad.bounds[0][1] == 2);
- TC_CHECK(pad.bounds[0][2] == -3);
+ TI_CHECK(pad.bounds[0][0] == 1);
+ TI_CHECK(pad.bounds[0][1] == 2);
+ TI_CHECK(pad.bounds[0][2] == -3);
- TC_CHECK(pad.bounds[1][0] == 2);
- TC_CHECK(pad.bounds[1][1] == 3);
- TC_CHECK(pad.bounds[1][2] == -2);
+ TI_CHECK(pad.bounds[1][0] == 2);
+ TI_CHECK(pad.bounds[1][1] == 3);
+ TI_CHECK(pad.bounds[1][2] == -2);
pad.access({4, -2, 5}, ScratchPad::AccessFlag::read);
- TC_CHECK(pad.bounds[0][0] == 1);
- TC_CHECK(pad.bounds[0][1] == -2);
- TC_CHECK(pad.bounds[0][2] == -3);
+ TI_CHECK(pad.bounds[0][0] == 1);
+ TI_CHECK(pad.bounds[0][1] == -2);
+ TI_CHECK(pad.bounds[0][2] == -3);
- TC_CHECK(pad.bounds[1][0] == 5);
- TC_CHECK(pad.bounds[1][1] == 3);
- TC_CHECK(pad.bounds[1][2] == 6);
+ TI_CHECK(pad.bounds[1][0] == 5);
+ TI_CHECK(pad.bounds[1][1] == 3);
+ TI_CHECK(pad.bounds[1][2] == 6);
}
-TC_TEST("range_assumption") {
+TI_TEST("range_assumption") {
CoreState::set_trigger_gdb_when_crash(true);
Program prog(Arch::gpu);
@@ -70,7 +70,7 @@ TC_TEST("range_assumption") {
})();
};
-TC_TEST("scratch_pad_3d") {
+TI_TEST("scratch_pad_3d") {
CoreState::set_trigger_gdb_when_crash(true);
int n = 10000000;
Program prog(Arch::gpu);
@@ -157,14 +157,14 @@ TC_TEST("scratch_pad_3d") {
x_val(i, j + 1, k) - x_val(i - 1, j, k) -
x_val(i + 1, j, k);
if (std::abs(gt - y.val(i, j, k)) > 1) {
- TC_P(d);
- TC_P(gt);
- TC_P(y.val(i, j, k));
- TC_P(i);
- TC_P(j);
- TC_P(k);
+ TI_P(d);
+ TI_P(gt);
+ TI_P(y.val(i, j, k));
+ TI_P(i);
+ TI_P(j);
+ TI_P(k);
}
- TC_CHECK_EQUAL(gt, y.val(i, j, k),
+ TI_CHECK_EQUAL(gt, y.val(i, j, k),
1e-1f / domain_size / domain_size);
}
}
diff --git a/misc/obsolete_cpp_tests/stencil1d.cpp b/misc/obsolete_cpp_tests/stencil1d.cpp
index e71fefcb38355..82a071527fac5 100644
--- a/misc/obsolete_cpp_tests/stencil1d.cpp
+++ b/misc/obsolete_cpp_tests/stencil1d.cpp
@@ -197,7 +197,7 @@ void benchmark_layers() {
}
};
- TC_P(measure_cpe(test_hash_table, n));
+ TI_P(measure_cpe(test_hash_table, n));
auto &tile = data.begin()->second;
@@ -210,13 +210,13 @@ void benchmark_layers() {
}
};
- TC_P(measure_cpe(test_block, n));
- TC_P(cnt);
+ TI_P(measure_cpe(test_block, n));
+ TI_P(cnt);
}
TLANG_NAMESPACE_BEGIN
-TC_TEST("stencil1d") {
+TI_TEST("stencil1d") {
CoreState::set_trigger_gdb_when_crash(true);
Program prog;
@@ -277,24 +277,24 @@ TC_TEST("stencil1d") {
}
}
}
- TC_P(total_tiles);
- TC_P(total_blocks);
- TC_P(total_nodes);
+ TI_P(total_tiles);
+ TI_P(total_blocks);
+ TI_P(total_nodes);
}
// benchmark_layers();
- // TC_P(measure_cpe(stencil, total_nodes));
+ // TI_P(measure_cpe(stencil, total_nodes));
for (int i = 0; i < 10; i++)
- TC_TIME(copy_ref());
+ TI_TIME(copy_ref());
for (int i = 0; i < 10; i++)
- TC_TIME(copy_optimized());
+ TI_TIME(copy_optimized());
for (int i = 0; i < 10; i++)
- TC_TIME(copy());
+ TI_TIME(copy());
for (int i = 0; i < 10; i++)
- TC_TIME(copy_parallelized());
+ TI_TIME(copy_parallelized());
// test copy to x
for (auto &it : data) {
@@ -305,25 +305,25 @@ TC_TEST("stencil1d") {
continue;
for (int n = 0; n < ::Block::size; n++) {
int i = it.first * dim0 + b * dim1 + n;
- TC_CHECK(block->nodes[n].y == y.val(i));
+ TI_CHECK(block->nodes[n].y == y.val(i));
}
}
}
for (int i = 0; i < 10; i++)
- TC_TIME(stencil_ref());
+ TI_TIME(stencil_ref());
for (int i = 0; i < 10; i++)
- TC_TIME(stencil_optimized());
+ TI_TIME(stencil_optimized());
for (int i = 0; i < 10; i++)
- TC_TIME(stencil_optimized2());
+ TI_TIME(stencil_optimized2());
for (int i = 0; i < 10; i++)
- TC_TIME(stencil_optimized3());
+ TI_TIME(stencil_optimized3());
for (int i = 0; i < 10; i++)
- TC_TIME(stencil());
+ TI_TIME(stencil());
// test stencil to x
for (auto &it : data) {
@@ -334,7 +334,7 @@ TC_TEST("stencil1d") {
continue;
for (int n = 0; n < ::Block::size; n++) {
int i = it.first * dim0 + b * dim1 + n;
- TC_CHECK_EQUAL(block->nodes[n].y, y.val(i), 1e-5f);
+ TI_CHECK_EQUAL(block->nodes[n].y, y.val(i), 1e-5f);
}
}
}
diff --git a/misc/obsolete_cpp_tests/struct.cpp b/misc/obsolete_cpp_tests/struct.cpp
index 139572d07c24d..48432e732d77c 100644
--- a/misc/obsolete_cpp_tests/struct.cpp
+++ b/misc/obsolete_cpp_tests/struct.cpp
@@ -3,7 +3,7 @@
TLANG_NAMESPACE_BEGIN
-TC_TEST("snode") {
+TI_TEST("snode") {
Program prog(Arch::x86_64);
auto i = Index(0);
@@ -19,11 +19,11 @@ TC_TEST("snode") {
}
for (int i = 0; i < n; i++) {
- TC_CHECK_EQUAL(u.val(i), i + 1, 0);
+ TI_CHECK_EQUAL(u.val(i), i + 1, 0);
}
}
-TC_TEST("snode_loop") {
+TI_TEST("snode_loop") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
Program prog(arch);
CoreState::set_trigger_gdb_when_crash(true);
@@ -43,12 +43,12 @@ TC_TEST("snode_loop") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK_EQUAL(u.val(i), i * 2, 0);
+ TI_CHECK_EQUAL(u.val(i), i * 2, 0);
}
}
}
-TC_TEST("snode_loop2") {
+TI_TEST("snode_loop2") {
for (auto arch : {Arch::x86_64, Arch::gpu}) {
Program prog(arch);
CoreState::set_trigger_gdb_when_crash(true);
@@ -65,10 +65,10 @@ TC_TEST("snode_loop2") {
root.dense(j, n).place(v);
});
- TC_ASSERT(
+ TI_ASSERT(
u.cast()->snode->physical_index_position[0] ==
0);
- TC_ASSERT(
+ TI_ASSERT(
v.cast()->snode->physical_index_position[0] ==
1);
@@ -83,13 +83,13 @@ TC_TEST("snode_loop2") {
})();
for (int i = 0; i < n; i++) {
- TC_CHECK_EQUAL(u.val(i), i * 2, 0);
- TC_CHECK_EQUAL(v.val(i), i * 3, 0);
+ TI_CHECK_EQUAL(u.val(i), i * 2, 0);
+ TI_CHECK_EQUAL(v.val(i), i * 3, 0);
}
}
}
-TC_TEST("2d_blocked_array") {
+TI_TEST("2d_blocked_array") {
int n = 8, block_size = 4;
for (auto arch : {Arch::x86_64, Arch::gpu})
@@ -103,7 +103,7 @@ TC_TEST("2d_blocked_array") {
auto i = Index(0);
auto j = Index(1);
if (blocked) {
- TC_ASSERT(n % block_size == 0);
+ TI_ASSERT(n % block_size == 0);
root.dense({i, j}, {n / block_size, n * 2 / block_size})
.dense({i, j}, {block_size, block_size})
.place(a, b);
@@ -124,14 +124,14 @@ TC_TEST("2d_blocked_array") {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n * 2; j++) {
- TC_CHECK(a.val(i, j) == i + j * 3);
- TC_CHECK(b.val(i, j) == i * 2 + j * 3);
+ TI_CHECK(a.val(i, j) == i + j * 3);
+ TI_CHECK(b.val(i, j) == i * 2 + j * 3);
}
}
}
}
-TC_TEST("2d_blocked_array_morton") {
+TI_TEST("2d_blocked_array_morton") {
int n = 16, block_size = 4;
for (auto arch : {Arch::x86_64}) {
@@ -143,7 +143,7 @@ TC_TEST("2d_blocked_array_morton") {
layout([&] {
auto i = Index(0);
auto j = Index(1);
- TC_ASSERT(n % block_size == 0);
+ TI_ASSERT(n % block_size == 0);
root.dense({i, j}, {n / block_size, n / block_size})
.morton()
.dense({i, j}, {block_size, block_size})
@@ -160,14 +160,14 @@ TC_TEST("2d_blocked_array_morton") {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
- TC_CHECK(a.val