gstaichi 0.1.21.dev0__cp310-cp310-win_amd64.whl → 0.1.25.dev0__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gstaichi/CHANGELOG.md +9 -0
- {taichi → gstaichi}/__init__.py +9 -13
- {taichi → gstaichi}/_funcs.py +8 -8
- {taichi → gstaichi}/_kernels.py +19 -19
- gstaichi/_lib/__init__.py +3 -0
- taichi/_lib/core/taichi_python.cp310-win_amd64.pyd → gstaichi/_lib/core/gstaichi_python.cp310-win_amd64.pyd +0 -0
- taichi/_lib/core/taichi_python.pyi → gstaichi/_lib/core/gstaichi_python.pyi +382 -522
- {taichi → gstaichi}/_lib/runtime/runtime_cuda.bc +0 -0
- {taichi → gstaichi}/_lib/runtime/runtime_x64.bc +0 -0
- {taichi → gstaichi}/_lib/utils.py +15 -15
- {taichi → gstaichi}/_logging.py +1 -1
- {taichi → gstaichi}/_main.py +24 -31
- gstaichi/_snode/__init__.py +5 -0
- {taichi → gstaichi}/_snode/fields_builder.py +27 -29
- {taichi → gstaichi}/_snode/snode_tree.py +5 -5
- gstaichi/_test_tools/__init__.py +0 -0
- gstaichi/_test_tools/load_kernel_string.py +30 -0
- gstaichi/_version.py +1 -0
- {taichi → gstaichi}/_version_check.py +8 -5
- gstaichi/ad/__init__.py +3 -0
- {taichi → gstaichi}/ad/_ad.py +26 -26
- {taichi → gstaichi}/algorithms/_algorithms.py +7 -7
- {taichi → gstaichi}/examples/minimal.py +1 -1
- {taichi → gstaichi}/experimental.py +1 -1
- gstaichi/lang/__init__.py +50 -0
- {taichi → gstaichi}/lang/_ndarray.py +30 -26
- {taichi → gstaichi}/lang/_ndrange.py +8 -8
- gstaichi/lang/_template_mapper.py +199 -0
- {taichi → gstaichi}/lang/_texture.py +19 -19
- {taichi → gstaichi}/lang/_wrap_inspect.py +7 -7
- {taichi → gstaichi}/lang/any_array.py +13 -13
- {taichi → gstaichi}/lang/argpack.py +29 -29
- gstaichi/lang/ast/__init__.py +5 -0
- {taichi → gstaichi}/lang/ast/ast_transformer.py +94 -582
- {taichi → gstaichi}/lang/ast/ast_transformer_utils.py +54 -41
- gstaichi/lang/ast/ast_transformers/__init__.py +0 -0
- gstaichi/lang/ast/ast_transformers/call_transformer.py +267 -0
- gstaichi/lang/ast/ast_transformers/function_def_transformer.py +320 -0
- {taichi → gstaichi}/lang/ast/checkers.py +5 -5
- gstaichi/lang/ast/transform.py +9 -0
- {taichi → gstaichi}/lang/common_ops.py +12 -12
- gstaichi/lang/exception.py +80 -0
- {taichi → gstaichi}/lang/expr.py +22 -22
- {taichi → gstaichi}/lang/field.py +29 -27
- {taichi → gstaichi}/lang/impl.py +116 -121
- {taichi → gstaichi}/lang/kernel_arguments.py +16 -16
- {taichi → gstaichi}/lang/kernel_impl.py +330 -363
- {taichi → gstaichi}/lang/matrix.py +119 -115
- {taichi → gstaichi}/lang/matrix_ops.py +6 -6
- {taichi → gstaichi}/lang/matrix_ops_utils.py +4 -4
- {taichi → gstaichi}/lang/mesh.py +22 -22
- {taichi → gstaichi}/lang/misc.py +39 -68
- {taichi → gstaichi}/lang/ops.py +146 -141
- {taichi → gstaichi}/lang/runtime_ops.py +2 -2
- {taichi → gstaichi}/lang/shell.py +3 -3
- {taichi → gstaichi}/lang/simt/__init__.py +1 -1
- {taichi → gstaichi}/lang/simt/block.py +7 -7
- {taichi → gstaichi}/lang/simt/grid.py +1 -1
- {taichi → gstaichi}/lang/simt/subgroup.py +1 -1
- {taichi → gstaichi}/lang/simt/warp.py +1 -1
- {taichi → gstaichi}/lang/snode.py +46 -44
- {taichi → gstaichi}/lang/source_builder.py +13 -13
- {taichi → gstaichi}/lang/struct.py +33 -33
- {taichi → gstaichi}/lang/util.py +24 -24
- gstaichi/linalg/__init__.py +8 -0
- {taichi → gstaichi}/linalg/matrixfree_cg.py +14 -14
- {taichi → gstaichi}/linalg/sparse_cg.py +10 -10
- {taichi → gstaichi}/linalg/sparse_matrix.py +23 -23
- {taichi → gstaichi}/linalg/sparse_solver.py +21 -21
- {taichi → gstaichi}/math/__init__.py +1 -1
- {taichi → gstaichi}/math/_complex.py +21 -20
- {taichi → gstaichi}/math/mathimpl.py +56 -56
- gstaichi/profiler/__init__.py +6 -0
- {taichi → gstaichi}/profiler/kernel_metrics.py +11 -11
- {taichi → gstaichi}/profiler/kernel_profiler.py +30 -36
- {taichi → gstaichi}/profiler/memory_profiler.py +1 -1
- {taichi → gstaichi}/profiler/scoped_profiler.py +2 -2
- {taichi → gstaichi}/sparse/_sparse_grid.py +7 -7
- {taichi → gstaichi}/tools/__init__.py +4 -4
- {taichi → gstaichi}/tools/diagnose.py +10 -17
- gstaichi/types/__init__.py +19 -0
- {taichi → gstaichi}/types/annotations.py +1 -1
- {taichi → gstaichi}/types/compound_types.py +8 -8
- {taichi → gstaichi}/types/enums.py +1 -1
- {taichi → gstaichi}/types/ndarray_type.py +7 -7
- {taichi → gstaichi}/types/primitive_types.py +17 -14
- {taichi → gstaichi}/types/quant.py +9 -9
- {taichi → gstaichi}/types/texture_type.py +5 -5
- {taichi → gstaichi}/types/utils.py +1 -1
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/bin/SPIRV-Tools-shared.dll +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/SPIRV-Tools-diff.lib +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/SPIRV-Tools-link.lib +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/SPIRV-Tools-lint.lib +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/SPIRV-Tools-opt.lib +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/SPIRV-Tools-reduce.lib +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/SPIRV-Tools-shared.lib +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/SPIRV-Tools.lib +0 -0
- {gstaichi-0.1.21.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/METADATA +13 -16
- gstaichi-0.1.25.dev0.dist-info/RECORD +138 -0
- gstaichi-0.1.25.dev0.dist-info/entry_points.txt +2 -0
- gstaichi-0.1.25.dev0.dist-info/top_level.txt +1 -0
- gstaichi-0.1.21.dev0.data/data/include/GLFW/glfw3.h +0 -6389
- gstaichi-0.1.21.dev0.data/data/include/GLFW/glfw3native.h +0 -594
- gstaichi-0.1.21.dev0.data/data/lib/cmake/glfw3/glfw3Config.cmake +0 -3
- gstaichi-0.1.21.dev0.data/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +0 -65
- gstaichi-0.1.21.dev0.data/data/lib/cmake/glfw3/glfw3Targets-release.cmake +0 -19
- gstaichi-0.1.21.dev0.data/data/lib/cmake/glfw3/glfw3Targets.cmake +0 -107
- gstaichi-0.1.21.dev0.data/data/lib/glfw3.lib +0 -0
- gstaichi-0.1.21.dev0.dist-info/RECORD +0 -198
- gstaichi-0.1.21.dev0.dist-info/entry_points.txt +0 -2
- gstaichi-0.1.21.dev0.dist-info/top_level.txt +0 -1
- taichi/CHANGELOG.md +0 -17
- taichi/_lib/__init__.py +0 -3
- taichi/_lib/c_api/bin/taichi_c_api.dll +0 -0
- taichi/_lib/c_api/include/taichi/cpp/taichi.hpp +0 -1401
- taichi/_lib/c_api/include/taichi/taichi.h +0 -29
- taichi/_lib/c_api/include/taichi/taichi_core.h +0 -1111
- taichi/_lib/c_api/include/taichi/taichi_cpu.h +0 -29
- taichi/_lib/c_api/include/taichi/taichi_cuda.h +0 -36
- taichi/_lib/c_api/include/taichi/taichi_platform.h +0 -55
- taichi/_lib/c_api/include/taichi/taichi_unity.h +0 -64
- taichi/_lib/c_api/include/taichi/taichi_vulkan.h +0 -151
- taichi/_lib/c_api/lib/taichi_c_api.lib +0 -0
- taichi/_lib/c_api/runtime/runtime_cuda.bc +0 -0
- taichi/_lib/c_api/runtime/runtime_x64.bc +0 -0
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfig.cmake +0 -29
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfigVersion.cmake +0 -65
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake +0 -121
- taichi/_lib/runtime/slim_libdevice.10.bc +0 -0
- taichi/_snode/__init__.py +0 -5
- taichi/_ti_module/__init__.py +0 -3
- taichi/_ti_module/cppgen.py +0 -309
- taichi/_ti_module/module.py +0 -145
- taichi/_version.py +0 -1
- taichi/ad/__init__.py +0 -3
- taichi/aot/__init__.py +0 -12
- taichi/aot/_export.py +0 -28
- taichi/aot/conventions/__init__.py +0 -3
- taichi/aot/conventions/gfxruntime140/__init__.py +0 -38
- taichi/aot/conventions/gfxruntime140/dr.py +0 -244
- taichi/aot/conventions/gfxruntime140/sr.py +0 -613
- taichi/aot/module.py +0 -253
- taichi/aot/utils.py +0 -151
- taichi/graph/__init__.py +0 -3
- taichi/graph/_graph.py +0 -292
- taichi/lang/__init__.py +0 -50
- taichi/lang/ast/__init__.py +0 -5
- taichi/lang/ast/transform.py +0 -9
- taichi/lang/exception.py +0 -80
- taichi/linalg/__init__.py +0 -8
- taichi/profiler/__init__.py +0 -6
- taichi/shaders/Circles_vk.frag +0 -29
- taichi/shaders/Circles_vk.vert +0 -45
- taichi/shaders/Circles_vk_frag.spv +0 -0
- taichi/shaders/Circles_vk_vert.spv +0 -0
- taichi/shaders/Lines_vk.frag +0 -9
- taichi/shaders/Lines_vk.vert +0 -11
- taichi/shaders/Lines_vk_frag.spv +0 -0
- taichi/shaders/Lines_vk_vert.spv +0 -0
- taichi/shaders/Mesh_vk.frag +0 -71
- taichi/shaders/Mesh_vk.vert +0 -68
- taichi/shaders/Mesh_vk_frag.spv +0 -0
- taichi/shaders/Mesh_vk_vert.spv +0 -0
- taichi/shaders/Particles_vk.frag +0 -95
- taichi/shaders/Particles_vk.vert +0 -73
- taichi/shaders/Particles_vk_frag.spv +0 -0
- taichi/shaders/Particles_vk_vert.spv +0 -0
- taichi/shaders/SceneLines2quad_vk_comp.spv +0 -0
- taichi/shaders/SceneLines_vk.frag +0 -9
- taichi/shaders/SceneLines_vk.vert +0 -12
- taichi/shaders/SceneLines_vk_frag.spv +0 -0
- taichi/shaders/SceneLines_vk_vert.spv +0 -0
- taichi/shaders/SetImage_vk.frag +0 -21
- taichi/shaders/SetImage_vk.vert +0 -15
- taichi/shaders/SetImage_vk_frag.spv +0 -0
- taichi/shaders/SetImage_vk_vert.spv +0 -0
- taichi/shaders/Triangles_vk.frag +0 -16
- taichi/shaders/Triangles_vk.vert +0 -29
- taichi/shaders/Triangles_vk_frag.spv +0 -0
- taichi/shaders/Triangles_vk_vert.spv +0 -0
- taichi/shaders/lines2quad_vk_comp.spv +0 -0
- taichi/types/__init__.py +0 -19
- {taichi → gstaichi}/__main__.py +0 -0
- {taichi → gstaichi}/_lib/core/__init__.py +0 -0
- {taichi → gstaichi}/_lib/core/py.typed +0 -0
- {taichi/_lib/c_api → gstaichi/_lib}/runtime/slim_libdevice.10.bc +0 -0
- {taichi → gstaichi}/algorithms/__init__.py +0 -0
- {taichi → gstaichi}/assets/.git +0 -0
- {taichi → gstaichi}/assets/Go-Regular.ttf +0 -0
- {taichi → gstaichi}/assets/static/imgs/ti_gallery.png +0 -0
- {taichi → gstaichi}/lang/ast/symbol_resolver.py +0 -0
- {taichi → gstaichi}/sparse/__init__.py +0 -0
- {taichi → gstaichi}/tools/np2ply.py +0 -0
- {taichi → gstaichi}/tools/vtk.py +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools/cmake/SPIRV-ToolsConfig.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools/cmake/SPIRV-ToolsTarget-release.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools/cmake/SPIRV-ToolsTarget.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffConfig.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffTargets-release.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffTargets.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkConfig.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkTargets-release.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkTargets.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintConfig.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintTargets-release.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintTargets.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optConfig.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optTargets-release.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optTargets.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceConfig.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceTarget-release.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceTarget.cmake +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/instrument.hpp +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.h +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.hpp +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/linker.hpp +0 -0
- {gstaichi-0.1.21.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/optimizer.hpp +0 -0
- {gstaichi-0.1.21.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/WHEEL +0 -0
- {gstaichi-0.1.21.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/licenses/LICENSE +0 -0
@@ -1,10 +1,10 @@
|
|
1
1
|
# type: ignore
|
2
2
|
|
3
|
-
import
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
7
|
-
from
|
3
|
+
import gstaichi.lang.ops as ops_mod
|
4
|
+
from gstaichi.lang.impl import static
|
5
|
+
from gstaichi.lang.kernel_impl import func, pyfunc
|
6
|
+
from gstaichi.lang.matrix import Matrix, Vector
|
7
|
+
from gstaichi.lang.matrix_ops_utils import (
|
8
8
|
arg_at,
|
9
9
|
arg_foreach_check,
|
10
10
|
assert_list,
|
@@ -18,7 +18,7 @@ from taichi.lang.matrix_ops_utils import (
|
|
18
18
|
same_shapes,
|
19
19
|
square_matrix,
|
20
20
|
)
|
21
|
-
from
|
21
|
+
from gstaichi.types.annotations import template
|
22
22
|
|
23
23
|
|
24
24
|
@preconditions(arg_at(0, assert_tensor))
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
import functools
|
4
4
|
|
5
|
-
from
|
6
|
-
from
|
7
|
-
from
|
5
|
+
from gstaichi.lang.exception import GsTaichiCompilationError
|
6
|
+
from gstaichi.lang.expr import Expr
|
7
|
+
from gstaichi.lang.matrix import Matrix
|
8
8
|
|
9
9
|
|
10
10
|
def do_check(checker_fns, *args, **kwargs):
|
@@ -21,7 +21,7 @@ def preconditions(*checker_funcs):
|
|
21
21
|
def wrapper(*args, **kwargs):
|
22
22
|
ok, msg = do_check(checker_funcs, *args, **kwargs)
|
23
23
|
if not ok:
|
24
|
-
raise
|
24
|
+
raise GsTaichiCompilationError(msg)
|
25
25
|
return func(*args, **kwargs)
|
26
26
|
|
27
27
|
return wrapper
|
{taichi → gstaichi}/lang/mesh.py
RENAMED
@@ -4,17 +4,17 @@ import json
|
|
4
4
|
|
5
5
|
import numpy as np
|
6
6
|
|
7
|
-
from
|
8
|
-
from
|
9
|
-
from
|
10
|
-
from
|
11
|
-
from
|
12
|
-
from
|
13
|
-
from
|
14
|
-
from
|
15
|
-
from
|
16
|
-
from
|
17
|
-
from
|
7
|
+
from gstaichi import lang
|
8
|
+
from gstaichi._lib import core as _ti_core
|
9
|
+
from gstaichi.lang import impl
|
10
|
+
from gstaichi.lang.exception import GsTaichiSyntaxError
|
11
|
+
from gstaichi.lang.field import Field, ScalarField
|
12
|
+
from gstaichi.lang.matrix import Matrix, MatrixField
|
13
|
+
from gstaichi.lang.struct import StructField
|
14
|
+
from gstaichi.lang.util import python_scope
|
15
|
+
from gstaichi.types import u16, u32
|
16
|
+
from gstaichi.types.compound_types import CompoundType
|
17
|
+
from gstaichi.types.enums import Layout
|
18
18
|
|
19
19
|
MeshTopology = _ti_core.MeshTopology
|
20
20
|
MeshElementType = _ti_core.MeshElementType
|
@@ -119,7 +119,7 @@ class MeshElementField:
|
|
119
119
|
layout: ti.Layout.AoS/ti.Layout.SoA
|
120
120
|
|
121
121
|
Example::
|
122
|
-
>>> import
|
122
|
+
>>> import meshgstaichi_patcher as Patcher
|
123
123
|
>>> vec3 = ti.types.vector(3, ti.f32)
|
124
124
|
>>> mesh = Patcher.load_mesh("bunny.obj", relations=['FV'])
|
125
125
|
>>> mesh.faces.place({'area' : ti.f32}) # declares a mesh attribute `area` for each face element.
|
@@ -128,11 +128,11 @@ class MeshElementField:
|
|
128
128
|
|
129
129
|
for key, dtype in members.items():
|
130
130
|
if key in {"verts", "edges", "faces", "cells"}:
|
131
|
-
raise
|
132
|
-
f"'{key}' cannot use as attribute name. It has been reserved as
|
131
|
+
raise GsTaichiSyntaxError(
|
132
|
+
f"'{key}' cannot use as attribute name. It has been reserved as MeshGsTaichi's keyword."
|
133
133
|
)
|
134
134
|
if key in self.attr_dict:
|
135
|
-
raise
|
135
|
+
raise GsTaichiSyntaxError(f"'{key}' has already use as attribute name.")
|
136
136
|
|
137
137
|
# init attr type
|
138
138
|
self.attr_dict[key] = MeshAttrType(key, dtype, reorder, needs_grad)
|
@@ -269,8 +269,8 @@ class MeshElement:
|
|
269
269
|
"""
|
270
270
|
for key, dtype in members.items():
|
271
271
|
if key in {"verts", "edges", "faces", "cells"}:
|
272
|
-
raise
|
273
|
-
f"'{key}' cannot use as attribute name. It has been reserved as
|
272
|
+
raise GsTaichiSyntaxError(
|
273
|
+
f"'{key}' cannot use as attribute name. It has been reserved as MeshGsTaichi's keyword."
|
274
274
|
)
|
275
275
|
self.attr_dict[key] = MeshAttrType(key, dtype, reorder, needs_grad)
|
276
276
|
|
@@ -318,7 +318,7 @@ class MeshInstance:
|
|
318
318
|
"""
|
319
319
|
if hasattr(self, "_vert_position"):
|
320
320
|
return self._vert_position
|
321
|
-
raise
|
321
|
+
raise GsTaichiSyntaxError("Position info is not in the file.")
|
322
322
|
|
323
323
|
def set_owned_offset(self, element_type: MeshElementType, owned_offset: ScalarField):
|
324
324
|
_ti_core.set_owned_offset(self.mesh_ptr, element_type, owned_offset.vars[0].ptr.snode())
|
@@ -443,7 +443,7 @@ class MeshMetadata:
|
|
443
443
|
class MeshBuilder:
|
444
444
|
def __init__(self):
|
445
445
|
if not lang.misc.is_extension_supported(impl.current_cfg().arch, lang.extension.mesh):
|
446
|
-
raise Exception("Backend " + str(impl.current_cfg().arch) + " doesn't support
|
446
|
+
raise Exception("Backend " + str(impl.current_cfg().arch) + " doesn't support MeshGsTaichi extension")
|
447
447
|
|
448
448
|
self.verts = MeshElement(MeshElementType.Vertex, self)
|
449
449
|
self.edges = MeshElement(MeshElementType.Edge, self)
|
@@ -501,11 +501,11 @@ class MeshBuilder:
|
|
501
501
|
class Mesh:
|
502
502
|
"""The Mesh type class.
|
503
503
|
|
504
|
-
|
504
|
+
MeshGsTaichi offers first-class support for triangular/tetrahedral meshes
|
505
505
|
and allows efficient computation on these irregular data structures,
|
506
506
|
only available for backends supporting `ti.extension.mesh`.
|
507
507
|
|
508
|
-
See more details in https://github.com/taichi-dev/
|
508
|
+
See more details in https://github.com/taichi-dev/meshgstaichi
|
509
509
|
"""
|
510
510
|
|
511
511
|
def __init__(self):
|
@@ -616,7 +616,7 @@ class MeshElementFieldProxy:
|
|
616
616
|
),
|
617
617
|
)
|
618
618
|
elif isinstance(attr, StructField):
|
619
|
-
raise RuntimeError("
|
619
|
+
raise RuntimeError("MeshGsTaichi has not support StructField yet")
|
620
620
|
else: # isinstance(attr, Field)
|
621
621
|
var = attr._get_field_members()[0].ptr
|
622
622
|
setattr(
|
{taichi → gstaichi}/lang/misc.py
RENAMED
@@ -1,22 +1,21 @@
|
|
1
1
|
# type: ignore
|
2
2
|
|
3
3
|
import atexit
|
4
|
-
import functools
|
5
4
|
import os
|
6
5
|
import shutil
|
7
6
|
import tempfile
|
8
7
|
import warnings
|
9
8
|
from copy import deepcopy as _deepcopy
|
10
9
|
|
11
|
-
from
|
12
|
-
from
|
13
|
-
from
|
14
|
-
from
|
15
|
-
from
|
16
|
-
from
|
17
|
-
from
|
10
|
+
from gstaichi import _logging, _snode, _version_check
|
11
|
+
from gstaichi._lib import core as _ti_core
|
12
|
+
from gstaichi.lang import impl
|
13
|
+
from gstaichi.lang.expr import Expr
|
14
|
+
from gstaichi.lang.impl import axes, get_runtime
|
15
|
+
from gstaichi.profiler.kernel_profiler import get_default_kernel_profiler
|
16
|
+
from gstaichi.types.primitive_types import f32, f64, i32, i64
|
18
17
|
|
19
|
-
warnings.filterwarnings("once", category=DeprecationWarning, module="
|
18
|
+
warnings.filterwarnings("once", category=DeprecationWarning, module="gstaichi")
|
20
19
|
|
21
20
|
# ----------------------
|
22
21
|
i = axes(0)
|
@@ -129,37 +128,17 @@ metal = _ti_core.metal
|
|
129
128
|
"""
|
130
129
|
# ----------------------
|
131
130
|
|
132
|
-
opengl = _ti_core.opengl
|
133
|
-
"""The OpenGL backend. OpenGL 4.3 required.
|
134
|
-
"""
|
135
|
-
# ----------------------
|
136
|
-
|
137
|
-
gles = _ti_core.gles
|
138
|
-
"""The OpenGL ES backend. OpenGL ES 3.1 required.
|
139
|
-
"""
|
140
|
-
# ----------------------
|
141
|
-
|
142
131
|
vulkan = _ti_core.vulkan
|
143
132
|
"""The Vulkan backend.
|
144
133
|
"""
|
145
134
|
# ----------------------
|
146
135
|
|
147
|
-
|
148
|
-
"""The DX11 backend.
|
149
|
-
"""
|
150
|
-
# ----------------------
|
151
|
-
|
152
|
-
dx12 = _ti_core.dx12
|
153
|
-
"""The DX11 backend.
|
154
|
-
"""
|
155
|
-
# ----------------------
|
156
|
-
|
157
|
-
gpu = [cuda, metal, vulkan, opengl, dx11, dx12, gles, amdgpu]
|
136
|
+
gpu = [cuda, metal, vulkan, amdgpu]
|
158
137
|
"""A list of GPU backends supported on the current system.
|
159
|
-
Currently contains 'cuda', 'metal', '
|
138
|
+
Currently contains 'cuda', 'metal', 'vulkan', 'amdgpu'.
|
160
139
|
|
161
|
-
When this is used,
|
162
|
-
GPU is detected,
|
140
|
+
When this is used, GsTaichi automatically picks the matching GPU backend. If no
|
141
|
+
GPU is detected, GsTaichi falls back to the CPU backend.
|
163
142
|
"""
|
164
143
|
# ----------------------
|
165
144
|
|
@@ -167,7 +146,7 @@ cpu = _ti_core.host_arch()
|
|
167
146
|
"""A list of CPU backends supported on the current system.
|
168
147
|
Currently contains 'x64', 'x86_64', 'arm64'.
|
169
148
|
|
170
|
-
When this is used,
|
149
|
+
When this is used, GsTaichi automatically picks the matching CPU backend.
|
171
150
|
"""
|
172
151
|
# ----------------------
|
173
152
|
|
@@ -181,7 +160,7 @@ def timeline_save(fn):
|
|
181
160
|
|
182
161
|
|
183
162
|
extension = _ti_core.Extension
|
184
|
-
"""An instance of
|
163
|
+
"""An instance of GsTaichi extension.
|
185
164
|
|
186
165
|
The list of currently available extensions is ['sparse', 'quant', \
|
187
166
|
'mesh', 'quant_basic', 'data64', 'adstack', 'bls', 'assertion', \
|
@@ -193,8 +172,8 @@ def is_extension_supported(arch, ext):
|
|
193
172
|
"""Checks whether an extension is supported on an arch.
|
194
173
|
|
195
174
|
Args:
|
196
|
-
arch (
|
197
|
-
ext (
|
175
|
+
arch (gstaichi_python.Arch): Specified arch.
|
176
|
+
ext (gstaichi_python.Extension): Specified extension.
|
198
177
|
|
199
178
|
Returns:
|
200
179
|
bool: Whether `ext` is supported on `arch`.
|
@@ -203,7 +182,7 @@ def is_extension_supported(arch, ext):
|
|
203
182
|
|
204
183
|
|
205
184
|
def reset():
|
206
|
-
"""Resets
|
185
|
+
"""Resets GsTaichi to its initial state.
|
207
186
|
This will destroy all the allocated fields and kernels, and restore
|
208
187
|
the runtime to its default configuration.
|
209
188
|
|
@@ -271,11 +250,11 @@ class _SpecialConfig:
|
|
271
250
|
def prepare_sandbox():
|
272
251
|
"""
|
273
252
|
Returns a temporary directory, which will be automatically deleted on exit.
|
274
|
-
It may contain the
|
253
|
+
It may contain the gstaichi_python shared object or some misc. files.
|
275
254
|
"""
|
276
|
-
tmp_dir = tempfile.mkdtemp(prefix="
|
255
|
+
tmp_dir = tempfile.mkdtemp(prefix="gstaichi-")
|
277
256
|
atexit.register(shutil.rmtree, tmp_dir)
|
278
|
-
print(f"[
|
257
|
+
print(f"[GsTaichi] preparing sandbox at {tmp_dir}")
|
279
258
|
os.mkdir(os.path.join(tmp_dir, "runtime/"))
|
280
259
|
return tmp_dir
|
281
260
|
|
@@ -317,7 +296,7 @@ def check_require_version(require_version):
|
|
317
296
|
|
318
297
|
if not match:
|
319
298
|
raise Exception(
|
320
|
-
f"
|
299
|
+
f"GsTaichi version mismatch. Required version >= {major}.{minor}.{patch}, installed version = {_ti_core.get_version_string()}."
|
321
300
|
)
|
322
301
|
|
323
302
|
|
@@ -330,32 +309,32 @@ def init(
|
|
330
309
|
require_version=None,
|
331
310
|
**kwargs,
|
332
311
|
):
|
333
|
-
"""Initializes the
|
312
|
+
"""Initializes the GsTaichi runtime.
|
334
313
|
|
335
|
-
This should always be the entry point of your
|
314
|
+
This should always be the entry point of your GsTaichi program. Most
|
336
315
|
importantly, it sets the backend used throughout the program.
|
337
316
|
|
338
317
|
Args:
|
339
|
-
arch: Backend to use. This is usually :const:`~
|
318
|
+
arch: Backend to use. This is usually :const:`~gstaichi.lang.cpu` or :const:`~gstaichi.lang.gpu`.
|
340
319
|
default_fp (Optional[type]): Default floating-point type.
|
341
320
|
default_ip (Optional[type]): Default integral type.
|
342
321
|
require_version (Optional[string]): A version string.
|
343
|
-
**kwargs:
|
344
|
-
``kwargs``, which allows for fine grained control of
|
322
|
+
**kwargs: GsTaichi provides highly customizable compilation through
|
323
|
+
``kwargs``, which allows for fine grained control of GsTaichi compiler
|
345
324
|
behavior. Below we list some of the most frequently used ones. For a
|
346
325
|
complete list, please check out
|
347
|
-
https://github.com/taichi-dev/
|
326
|
+
https://github.com/taichi-dev/gstaichi/blob/master/gstaichi/program/compile_config.h.
|
348
327
|
|
349
328
|
* ``cpu_max_num_threads`` (int): Sets the number of threads used by the CPU thread pool.
|
350
|
-
* ``debug`` (bool): Enables the debug mode, under which
|
351
|
-
* ``print_ir`` (bool): Prints the CHI IR of the
|
352
|
-
*``offline_cache`` (bool): Enables offline cache of the compiled kernels. Default to True. When this is enabled
|
329
|
+
* ``debug`` (bool): Enables the debug mode, under which GsTaichi does a few more things like boundary checks.
|
330
|
+
* ``print_ir`` (bool): Prints the CHI IR of the GsTaichi kernels.
|
331
|
+
*``offline_cache`` (bool): Enables offline cache of the compiled kernels. Default to True. When this is enabled GsTaichi will cache compiled kernel on your local disk to accelerate future calls.
|
353
332
|
*``random_seed`` (int): Sets the seed of the random generator. The default is 0.
|
354
333
|
"""
|
355
334
|
# Check version for users every 7 days if not disabled by users.
|
356
335
|
_version_check.start_version_check_thread()
|
357
336
|
|
358
|
-
# FIXME(https://github.com/taichi-dev/
|
337
|
+
# FIXME(https://github.com/taichi-dev/gstaichi/issues/4811): save the current working directory since it may be
|
359
338
|
# changed by the Vulkan backend initialization on OS X.
|
360
339
|
current_dir = os.getcwd()
|
361
340
|
|
@@ -448,7 +427,7 @@ def init(
|
|
448
427
|
_logging.info(f"Following TI_ARCH setting up for arch={env_arch}")
|
449
428
|
arch = _ti_core.arch_from_name(env_arch)
|
450
429
|
cfg.arch = adaptive_arch_select(arch, enable_fallback)
|
451
|
-
print(f"[
|
430
|
+
print(f"[GsTaichi] Starting on arch={_ti_core.arch_name(cfg.arch)}")
|
452
431
|
|
453
432
|
if _test_mode:
|
454
433
|
return spec_cfg
|
@@ -466,26 +445,26 @@ def init(
|
|
466
445
|
if cfg.debug:
|
467
446
|
impl.get_runtime()._register_signal_handlers()
|
468
447
|
|
469
|
-
# Recover the current working directory (https://github.com/taichi-dev/
|
448
|
+
# Recover the current working directory (https://github.com/taichi-dev/gstaichi/issues/4811)
|
470
449
|
os.chdir(current_dir)
|
471
450
|
return None
|
472
451
|
|
473
452
|
|
474
453
|
def no_activate(*args):
|
475
454
|
"""Deactivates a SNode pointer."""
|
476
|
-
assert isinstance(get_runtime().compiling_callable, _ti_core.
|
455
|
+
assert isinstance(get_runtime().compiling_callable, _ti_core.KernelCxx)
|
477
456
|
for v in args:
|
478
457
|
get_runtime().compiling_callable.no_activate(v._snode.ptr)
|
479
458
|
|
480
459
|
|
481
460
|
def block_local(*args):
|
482
|
-
"""Hints
|
461
|
+
"""Hints GsTaichi to cache the fields and to enable the BLS optimization.
|
483
462
|
|
484
463
|
Please visit https://docs.taichi-lang.org/docs/performance
|
485
464
|
for how BLS is used.
|
486
465
|
|
487
466
|
Args:
|
488
|
-
*args (List[Field]): A list of sparse
|
467
|
+
*args (List[Field]): A list of sparse GsTaichi fields.
|
489
468
|
"""
|
490
469
|
if impl.current_cfg().opt_level == 0:
|
491
470
|
_logging.warn("""opt_level = 1 is enforced to enable bls analysis.""")
|
@@ -502,7 +481,7 @@ def mesh_local(*args):
|
|
502
481
|
and to enable the mesh BLS optimization,
|
503
482
|
only available for backends supporting `ti.extension.mesh` and to use with mesh-for loop.
|
504
483
|
|
505
|
-
Related to https://github.com/taichi-dev/
|
484
|
+
Related to https://github.com/taichi-dev/gstaichi/issues/3608
|
506
485
|
|
507
486
|
Args:
|
508
487
|
*args (List[Attribute]): A list of mesh attributes or fields accessed as attributes.
|
@@ -703,7 +682,7 @@ def mesh_patch_idx():
|
|
703
682
|
"""Returns the internal mesh patch id of this running thread,
|
704
683
|
only available for backends supporting `ti.extension.mesh` and to use within mesh-for loop.
|
705
684
|
|
706
|
-
Related to https://github.com/taichi-dev/
|
685
|
+
Related to https://github.com/taichi-dev/gstaichi/issues/3608
|
707
686
|
"""
|
708
687
|
return (
|
709
688
|
impl.get_runtime()
|
@@ -716,7 +695,7 @@ def is_arch_supported(arch):
|
|
716
695
|
"""Checks whether an arch is supported on the machine.
|
717
696
|
|
718
697
|
Args:
|
719
|
-
arch (
|
698
|
+
arch (gstaichi_python.Arch): Specified arch.
|
720
699
|
|
721
700
|
Returns:
|
722
701
|
bool: Whether `arch` is supported on the machine.
|
@@ -726,11 +705,7 @@ def is_arch_supported(arch):
|
|
726
705
|
cuda: _ti_core.with_cuda,
|
727
706
|
amdgpu: _ti_core.with_amdgpu,
|
728
707
|
metal: _ti_core.with_metal,
|
729
|
-
opengl: functools.partial(_ti_core.with_opengl, False),
|
730
|
-
gles: functools.partial(_ti_core.with_opengl, True),
|
731
708
|
vulkan: _ti_core.with_vulkan,
|
732
|
-
dx11: _ti_core.with_dx11,
|
733
|
-
dx12: _ti_core.with_dx12,
|
734
709
|
cpu: lambda: True,
|
735
710
|
}
|
736
711
|
with_arch = arch_table.get(arch, lambda: False)
|
@@ -782,16 +757,12 @@ __all__ = [
|
|
782
757
|
"l",
|
783
758
|
"x86_64",
|
784
759
|
"x64",
|
785
|
-
"dx11",
|
786
|
-
"dx12",
|
787
760
|
"arm64",
|
788
761
|
"cpu",
|
789
762
|
"cuda",
|
790
763
|
"amdgpu",
|
791
|
-
"gles",
|
792
764
|
"gpu",
|
793
765
|
"metal",
|
794
|
-
"opengl",
|
795
766
|
"vulkan",
|
796
767
|
"extension",
|
797
768
|
"loop_config",
|