Deprecation Notice
- Using sparse data structures on the Metal backend is now deprecated. The support for Dynamic SNode has been removed in v1.3.0, and the support for Pointer/Bitmasked SNode will be removed in v1.4.0.
- The
packed
switch inti.init()
is now deprecated and will be removed in v1.4.0. See the feature introduction below for details. ti.Matrix.rotation2d()
is now deprecated and will be removed in v1.4.0. Useti.math.rotation2d()
instead.- To clearly distinguish vectors from matrices,
transpose()
on a vector is no longer allowed. If you want something likea @ b.transpose()
, writea.outer_product(b)
instead. - Ndarray: The arguments of ndarray type annotation
element_dim
,element_shape
andfield_dim
will be deprecated in v1.4.0. Thefield_dim
is renamed tondim
to make it more intuitive.element_dim
andelement_shape
will be replaced by passing a matrix type intodtype
argument. For example, theti.types.ndarray(element_dim=2, element_shape=(3,3))
will be replaced byti.types.ndarray(dtype=ti.matrix(3,3))
.
New features
Dynamic SNode
To support variable-length fields, Taichi provides dynamic SNodes.
You can now use the dynamic SNode on fields of different data types, even struct fields and matrix fields.
You can use x[i].append(...)
to append an element, use x[i].length()
to get the length, and use x[i].deactivate()
to clear the list as shown in the following code snippet.
pair = ti.types.struct(a=ti.i16, b=ti.i64)
pair_field = pair.field()
block = ti.root.dense(ti.i, 4)
pixel = block.dynamic(ti.j, 100, chunk_size=4)
pixel.place(pair_field)
l = ti.field(ti.i32)
ti.root.dense(ti.i, 5).place(l)
@ti.kernel
def dynamic_pair():
for i in range(4):
pair_field[i].deactivate()
for j in range(i * i):
pair_field[i].append(pair(i, j + 1))
# pair_field = [[],
# [(1, 1)],
# [(2, 1), (2, 2), (2, 3), (2, 4)],
# [(3, 1), (3, 2), ... , (3, 8), (3, 9)]]
l[i] = pair_field[i].length() # l = [0, 1, 4, 9]
Packed Mode
Packed mode was introduced in v0.8.0 to allow users to trade runtime performance for memory usage. In v1.3.0, after the elimination of runtime overhead in common cases, packed mode has become the default mode. There's no longer any automatic padding behavior behind the scenes, so users can use fields and SNodes without surprise.
Sparse Matrix
We introduce the experimental sparse matrix and sparse solver on the CUDA backend. The API of using is the same as CPU backend. Currently, only the f32
data type and LLT linear solver are supported on CUDA. You can only use ti.ndarray
to compute SpMV and linear solver operation. Float64 data type and other linear solvers are under implementation.
Improvements
Python Frontend
- Matrix slicing now supports augmented assign (e.g. +=) besides assign.
Taichi Examples
- Our user https://github.com/Linyou contributed an excellent example on instant ngp renderer PR #6673. Run
taichi_ngp
to check it out!
[Developers only] LLVM15 upgrade
Starting from v1.3.0, Taichi has upgraded its LLVM dependency to version 15.0.0. If you're interested in contributing or simply building Taichi from source, please follow our installation doc for developers.
Note this change has no impact on Taichi users.
Highlights
- Documentation
- Language and syntax
- Add deprecation warning for the removal of the packed switch (#6753) (by Yi Xu)
- Metal backend
- Raise deprecate warning and error when using sparse snodes on metal (#6739) (by Lin Jiang)
Full changelog
- [aot] Revert C-API Device capability improvements (#6772) (by PENGUINLIONG)
- [aot] C-API Device capability improvements (#6702) (by PENGUINLIONG)
- [aot] C-API to get available archs (#6766) (by PENGUINLIONG)
- [doc] Update sparse matrix document (#6719) (by pengyu)
- [autodiff] Separate non-linear operators to an individual class (#6700) (by Mingrui Zhang)
- [bug] Fix dereferencing nullptr (#6763) (by Yi Xu)
- [Doc] Update the documentation about Dynamic SNode (#6752) (by Lin Jiang)
- [doc] Update dev install about clang version (#6759) (by Ailing)
- [build] Improve TI_WITH_CUDA guards for CUDA related test cases (#6698) (by Zhanlue Yang)
- [Lang] Add deprecation warning for the removal of the packed switch (#6753) (by Yi Xu)
- [lang] Improve sparse matrix building on GPU (#6748) (by pengyu)
- [aot] JSON serde (#6754) (by PENGUINLIONG)
- [bug] MatrixType bug fix: Fix error with to_numpy() and from_numpy() (#6726) (by Zhanlue Yang)
- [Doc] Stop mentioning packed mode (#6755) (by Yi Xu)
- [lang] Get the length of dynamic SNode by x.length() (#6750) (by Lin Jiang)
- [llvm] Support nested struct with matrix return value on real function (#6734) (by Lin Jiang)
- [Metal] [error] Raise deprecate warning and error when using sparse snodes on metal (#6739) (by Lin Jiang)
- [build] Integrate backward_cpp to test targets for enabling C++ stack trace (#6697) (by Zhanlue Yang)
- [aot] Load AOT module from memory (#6692) (#6714) (by PENGUINLIONG)
- [ci] Add dockerfile.ubuntu-18.04.amdgpu (#6736) (by Zeyu Li)
- [doc] Update LLVM10 -> LLVM15 in installation guide (#6747) (by Zhanlue Yang)
- [misc] Fix warnings of taichi examples (#6740) (by PGZXB)
- [example] Ti-example: instant ngp renderer (#6673) (by Youtian Lin)
- [build] Use a separate prebuilt llvm15 binary for manylinux environment (#6732) (by Ailing)