diff --git a/docs/lang/articles/advanced/odop.md b/docs/lang/articles/advanced/odop.md index 7d008adf104c3..0384482c8fb01 100644 --- a/docs/lang/articles/advanced/odop.md +++ b/docs/lang/articles/advanced/odop.md @@ -41,7 +41,7 @@ a = TiArray(32) a.inc() ``` -Programmers used to define Taichi fields in `__init__` functions of `@ti.data_oriented` classes. With the new **Dynamic SNode** feature (released in `v0.8.0`, see [Field (advanced)](/lang/articles/advanced/layout.md#dynamic-field-allocation-and-destruction) for more details), you can define Taichi fields **at any places** of Python-scope functions. For example, +Programmers used to define Taichi fields in `__init__` functions of `@ti.data_oriented` classes. With the new **Dynamic SNode** feature (released in `v0.8.0`, see [Field (advanced)](layout.md#dynamic-field-allocation-and-destruction) for more details), you can define Taichi fields **at any places** of Python-scope functions. For example, ```python {21,25} import taichi as ti diff --git a/docs/lang/articles/advanced/sparse.md b/docs/lang/articles/advanced/sparse.md index ff7557f3dadab..2a9b4389e5c97 100644 --- a/docs/lang/articles/advanced/sparse.md +++ b/docs/lang/articles/advanced/sparse.md @@ -5,7 +5,7 @@ sidebar_position: 3 # Sparse spatial data structures :::note -Prerequisite: please read the [Fields](lang/articles/basic/field.md), [Fields (advanced)](lang/articles/advanced/layout.md), and [SNodes](lang/articles/misc/internal.md#data-structure-organization) first. +Prerequisite: please read the [Fields](../basic/field.md), [Fields (advanced)](layout.md), and [SNodes](../misc/internal.md#data-structure-organization) first. ::: ![image](https://raw.githubusercontent.com/taichi-dev/public_files/master/taichi/doc/sparse_grids_3d.jpg) @@ -14,7 +14,7 @@ Figure: A 3D fluid simulation that uses both particles and grids. Left to right: ## Motivation High-resolution 2D/3D grids are often needed in large-scale spatial computation, such as physical simulation, rendering, and 3D reconstruction. -However, these grids tend to consume a huge amount of memory space and computation if we use dense data structures (see [field](lang/articles/basic/field.md) and [field advanced](lang/articles/advanced/layout.md)). +However, these grids tend to consume a huge amount of memory space and computation if we use dense data structures (see [field](../basic/field.md) and [field advanced](layout.md)). While a programmer may allocate large dense grids to store spatial data (especially physical quantities such as a density or velocity field), oftentimes, they only care about a small fraction of this dense grid since the rest may be empty space (vacuum or air). @@ -48,7 +48,7 @@ In Taichi, programmers can compose data structures similar to VDB and SPGrid wit :::note -Sparse matrices are usually **not** implemented in Taichi via sparse spatial data structures. See [sparse matrix](lang/articles/advanced/sparse_matrix.md) instead. +Sparse matrices are usually **not** implemented in Taichi via sparse spatial data structures. See [sparse matrix](sparse_matrix.md) instead. ::: ## Sparse spatial data structures in Taichi diff --git a/docs/lang/articles/basic/differences_between_taichi_and_python_programs.md b/docs/lang/articles/basic/differences_between_taichi_and_python_programs.md index c2c6b7dbd7bc3..0404eb8f33f5c 100644 --- a/docs/lang/articles/basic/differences_between_taichi_and_python_programs.md +++ b/docs/lang/articles/basic/differences_between_taichi_and_python_programs.md @@ -53,7 +53,7 @@ def discarded_after_first_return(a: ti.i32) -> ti.i32: discarded_after_first_return(0) # OK: returns 1 ``` -- If there are [compile-time evaluations](/lang/articles/advanced/meta.md#compile-time-evaluations) in the code, make sure there is a return statement under all circumstances. +- If there are [compile-time evaluations](../advanced/meta.md#compile-time-evaluations) in the code, make sure there is a return statement under all circumstances. Otherwise, error occurs when a branch is chosen which does not have return statement. ```python {7-8,15-16,21,23-24} @ti.kernel @@ -123,7 +123,7 @@ Currently, Taichi does not support `set`. List and dictionary before assigning to a variable works as the python list and dictionary. However, after assigning to a variable, the content of the list and the values (not keys) of the dictionary are converted to Taichi variables. -Taichi does not have a runtime implementation of `in` currently. Therefore, operator `in` and `not in` only works in [static scope](/lang/articles/advanced/meta.md#static-scope) (inside `ti.static()`). +Taichi does not have a runtime implementation of `in` currently. Therefore, operator `in` and `not in` only works in [static scope](../advanced/meta.md#static-scope) (inside `ti.static()`). ```python {3,11-12,20} @ti.kernel @@ -155,7 +155,7 @@ Taichi partially supports list comprehension and dictionary comprehension, but does not support set comprehension. For list comprehensions and dictionary comprehensions, the `if`s and `for`s in them are evaluated at compile time. -The iterators and conditions are implicitly in [static scope](/lang/articles/advanced/meta.md#static-scope). +The iterators and conditions are implicitly in [static scope](../advanced/meta.md#static-scope). ### Operator `is` diff --git a/docs/lang/articles/basic/field.md b/docs/lang/articles/basic/field.md index 60e83fde7c44f..8fdd4fd6a94b7 100644 --- a/docs/lang/articles/basic/field.md +++ b/docs/lang/articles/basic/field.md @@ -74,7 +74,7 @@ while gui.running: ``` :::tip -With Taichi versions earlier than v0.8.0, you cannot allocate new fields after executing a kernel. Starting from v0.8.0, you can use the `FieldsBuilder` class to dynamically allocate or destruct fields. See the [Field (advanced)](/lang/articles/advanced/layout.md) for more information. +With Taichi versions earlier than v0.8.0, you cannot allocate new fields after executing a kernel. Starting from v0.8.0, you can use the `FieldsBuilder` class to dynamically allocate or destruct fields. See the [Field (advanced)](./advanced/layout.md) for more information. ::: :::caution WARNING diff --git a/docs/lang/articles/basic/overview.md b/docs/lang/articles/basic/overview.md index 6944c360a3f90..2eeda69a778f6 100644 --- a/docs/lang/articles/basic/overview.md +++ b/docs/lang/articles/basic/overview.md @@ -17,7 +17,7 @@ To be fair, a domain-specific language (DSL) with a Python frontend is not somet * Taichi heavily optimizes the source code using various compiler technologies: common subexpression elimination, dead code elimination, control flow graph analysis, etc. These optimizations are backend neutral, because Taichi hosts its own intermediate representation (IR) layer. * JIT compilation provides additional optimization opportunities. -That said, Taichi goes beyond a Python JIT transpiler. One of the initial design goals is to *decouple the computation from the data structures*. The mechanism that Taichi provides is a set of generic data containers, called *SNode* (/ˈsnoʊd/). SNodes can be used to compose hierarchical, dense or sparse, multi-dimensional fields conveniently. Switching between array-of-structures and structure-of-arrays layouts is usually a matter of ≤10 lines of code. This has sparked many use cases in numerical simulation. If you are interested to learn them, please check out [Fields (advanced)](https://docs.taichi-lang.org/lang/articles/layout), [Sparse spatial data structures](https://docs.taichi-lang.org/lang/articles/sparse), or [the original Taichi paper](https://yuanming.taichi.graphics/publication/2019-taichi/taichi-lang.pdf). +That said, Taichi goes beyond a Python JIT transpiler. One of the initial design goals is to *decouple the computation from the data structures*. The mechanism that Taichi provides is a set of generic data containers, called *SNode* (/ˈsnoʊd/). SNodes can be used to compose hierarchical, dense or sparse, multi-dimensional fields conveniently. Switching between array-of-structures and structure-of-arrays layouts is usually a matter of ≤10 lines of code. This has sparked many use cases in numerical simulation. If you are interested to learn them, please check out [Fields (advanced)](../advanced/layout.md), [Sparse spatial data structures](../advanced/sparse.md), or [the original Taichi paper](https://yuanming.taichi.graphics/publication/2019-taichi/taichi-lang.pdf). The concept of decoupling is further extended to the type system. With GPU memory capacity and bandwidth becoming the major bottlenecks nowadays, it is vital to be able to pack more data per memory unit. Since 2021, Taichi has introduced customizable quantized types, allowing for the definition of fixed point or floating point numbers with arbitrary bits (still needs to be under 64). This has allowed an MPM simulation of over 400 million particles on a single GPU device. Learn more details in [the QuanTaichi paper](https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf). diff --git a/docs/lang/articles/reference.md b/docs/lang/articles/reference.md index 41026974fc8c6..3af07ef06a1c3 100644 --- a/docs/lang/articles/reference.md +++ b/docs/lang/articles/reference.md @@ -235,8 +235,8 @@ attributeref ::= primary "." identifier Attribute references are evaluated at compile time. The `primary` must be evaluated to a Python value with an attribute named `identifier`. Common use cases in Taichi include metadata queries of -[field](https://docs.taichi-lang.org/lang/articles/meta#field-metadata) and -[matrices](https://docs.taichi-lang.org/lang/articles/meta#matrix--vector-metadata). +[field](advanced/meta.md#field-metadata) and +[matrices](advanced/meta.md#matrix--vector-metadata). #### Subscriptions @@ -440,9 +440,9 @@ The `positional_arguments` is evaluated at compile time, and the items inside mu - When multiple arguments are passed in, it returns a tuple containing all the arguments in the same order as they are passed. The static expressions work as a mechanism to trigger many metaprogramming functions in Taichi, -such as [compile-time loop unrolling and compile-time branching](lang/articles/advanced/meta.md#compile-time-evaluations). +such as [compile-time loop unrolling and compile-time branching](advanced/meta.md#compile-time-evaluations). -The static expressions can also be used to [create aliases for Taichi fields and Taichi functions](lang/articles/advanced/syntax_sugars.md#aliases). +The static expressions can also be used to [create aliases for Taichi fields and Taichi functions](advanced/syntax_sugars.md#aliases). ### Expression lists @@ -728,7 +728,7 @@ The `iter_expression` of ndrange `for` statement must be a call to `ti.ndrange() - If the `iter_expression` is a call to `ti.range()`, it is a normal ndrange `for`. - If the `iter_expression` is a call to `ti.grouped(ti.range())`, it is a grouped ndrange `for`. -You can use grouped `for` loops to write [dimensionality-independent programs](lang/articles/advanced/meta.md#dimensionality-independent-programming-using-grouped-indices). +You can use grouped `for` loops to write [dimensionality-independent programs](advanced/meta.md#dimensionality-independent-programming-using-grouped-indices). `ti.ndrange` receives arbitrary numbers of arguments. The k-th argument represents the iteration range of the k-th dimension,