gstaichi 0.1.18.dev1__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-0.1.18.dev1.data/data/SPIRV-Tools/cmake/SPIRV-ToolsConfig.cmake +5 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools/cmake/SPIRV-ToolsTarget-release.cmake +29 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools/cmake/SPIRV-ToolsTarget.cmake +113 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffConfig.cmake +5 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffTargets-release.cmake +19 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffTargets.cmake +122 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkConfig.cmake +5 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkTargets-release.cmake +19 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkTargets.cmake +122 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintConfig.cmake +5 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintTargets-release.cmake +19 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintTargets.cmake +122 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optConfig.cmake +5 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optTargets-release.cmake +19 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optTargets.cmake +122 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceConfig.cmake +5 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceTarget-release.cmake +19 -0
- gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceTarget.cmake +122 -0
- gstaichi-0.1.18.dev1.data/data/bin/SPIRV-Tools-shared.dll +0 -0
- gstaichi-0.1.18.dev1.data/data/include/GLFW/glfw3.h +6389 -0
- gstaichi-0.1.18.dev1.data/data/include/GLFW/glfw3native.h +594 -0
- gstaichi-0.1.18.dev1.data/data/include/spirv-tools/instrument.hpp +268 -0
- gstaichi-0.1.18.dev1.data/data/include/spirv-tools/libspirv.h +907 -0
- gstaichi-0.1.18.dev1.data/data/include/spirv-tools/libspirv.hpp +375 -0
- gstaichi-0.1.18.dev1.data/data/include/spirv-tools/linker.hpp +97 -0
- gstaichi-0.1.18.dev1.data/data/include/spirv-tools/optimizer.hpp +970 -0
- gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-diff.lib +0 -0
- gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-link.lib +0 -0
- gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-lint.lib +0 -0
- gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-opt.lib +0 -0
- gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-reduce.lib +0 -0
- gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-shared.lib +0 -0
- gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools.lib +0 -0
- gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3Config.cmake +3 -0
- gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +65 -0
- gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3Targets-release.cmake +19 -0
- gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3Targets.cmake +107 -0
- gstaichi-0.1.18.dev1.data/data/lib/glfw3.lib +0 -0
- gstaichi-0.1.18.dev1.dist-info/METADATA +108 -0
- gstaichi-0.1.18.dev1.dist-info/RECORD +198 -0
- gstaichi-0.1.18.dev1.dist-info/WHEEL +5 -0
- gstaichi-0.1.18.dev1.dist-info/entry_points.txt +2 -0
- gstaichi-0.1.18.dev1.dist-info/licenses/LICENSE +201 -0
- gstaichi-0.1.18.dev1.dist-info/top_level.txt +1 -0
- taichi/CHANGELOG.md +15 -0
- taichi/__init__.py +44 -0
- taichi/__main__.py +5 -0
- taichi/_funcs.py +706 -0
- taichi/_kernels.py +420 -0
- taichi/_lib/__init__.py +3 -0
- taichi/_lib/c_api/bin/taichi_c_api.dll +0 -0
- taichi/_lib/c_api/include/taichi/cpp/taichi.hpp +1401 -0
- taichi/_lib/c_api/include/taichi/taichi.h +29 -0
- taichi/_lib/c_api/include/taichi/taichi_core.h +1111 -0
- taichi/_lib/c_api/include/taichi/taichi_cpu.h +29 -0
- taichi/_lib/c_api/include/taichi/taichi_cuda.h +36 -0
- taichi/_lib/c_api/include/taichi/taichi_platform.h +55 -0
- taichi/_lib/c_api/include/taichi/taichi_unity.h +64 -0
- taichi/_lib/c_api/include/taichi/taichi_vulkan.h +151 -0
- 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/runtime/slim_libdevice.10.bc +0 -0
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfig.cmake +29 -0
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfigVersion.cmake +65 -0
- taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake +121 -0
- taichi/_lib/core/__init__.py +0 -0
- taichi/_lib/core/py.typed +0 -0
- taichi/_lib/core/taichi_python.cp310-win_amd64.pyd +0 -0
- taichi/_lib/core/taichi_python.pyi +3077 -0
- taichi/_lib/runtime/runtime_cuda.bc +0 -0
- taichi/_lib/runtime/runtime_x64.bc +0 -0
- taichi/_lib/runtime/slim_libdevice.10.bc +0 -0
- taichi/_lib/utils.py +249 -0
- taichi/_logging.py +131 -0
- taichi/_main.py +552 -0
- taichi/_snode/__init__.py +5 -0
- taichi/_snode/fields_builder.py +189 -0
- taichi/_snode/snode_tree.py +34 -0
- taichi/_ti_module/__init__.py +3 -0
- taichi/_ti_module/cppgen.py +309 -0
- taichi/_ti_module/module.py +145 -0
- taichi/_version.py +1 -0
- taichi/_version_check.py +100 -0
- taichi/ad/__init__.py +3 -0
- taichi/ad/_ad.py +530 -0
- taichi/algorithms/__init__.py +3 -0
- taichi/algorithms/_algorithms.py +117 -0
- taichi/aot/__init__.py +12 -0
- taichi/aot/_export.py +28 -0
- taichi/aot/conventions/__init__.py +3 -0
- taichi/aot/conventions/gfxruntime140/__init__.py +38 -0
- taichi/aot/conventions/gfxruntime140/dr.py +244 -0
- taichi/aot/conventions/gfxruntime140/sr.py +613 -0
- taichi/aot/module.py +253 -0
- taichi/aot/utils.py +151 -0
- taichi/assets/.git +1 -0
- taichi/assets/Go-Regular.ttf +0 -0
- taichi/assets/static/imgs/ti_gallery.png +0 -0
- taichi/examples/minimal.py +28 -0
- taichi/experimental.py +16 -0
- taichi/graph/__init__.py +3 -0
- taichi/graph/_graph.py +292 -0
- taichi/lang/__init__.py +50 -0
- taichi/lang/_ndarray.py +348 -0
- taichi/lang/_ndrange.py +152 -0
- taichi/lang/_texture.py +172 -0
- taichi/lang/_wrap_inspect.py +189 -0
- taichi/lang/any_array.py +99 -0
- taichi/lang/argpack.py +411 -0
- taichi/lang/ast/__init__.py +5 -0
- taichi/lang/ast/ast_transformer.py +1806 -0
- taichi/lang/ast/ast_transformer_utils.py +328 -0
- taichi/lang/ast/checkers.py +106 -0
- taichi/lang/ast/symbol_resolver.py +57 -0
- taichi/lang/ast/transform.py +9 -0
- taichi/lang/common_ops.py +310 -0
- taichi/lang/exception.py +80 -0
- taichi/lang/expr.py +180 -0
- taichi/lang/field.py +464 -0
- taichi/lang/impl.py +1246 -0
- taichi/lang/kernel_arguments.py +157 -0
- taichi/lang/kernel_impl.py +1415 -0
- taichi/lang/matrix.py +1877 -0
- taichi/lang/matrix_ops.py +341 -0
- taichi/lang/matrix_ops_utils.py +190 -0
- taichi/lang/mesh.py +687 -0
- taichi/lang/misc.py +807 -0
- taichi/lang/ops.py +1489 -0
- taichi/lang/runtime_ops.py +13 -0
- taichi/lang/shell.py +35 -0
- taichi/lang/simt/__init__.py +5 -0
- taichi/lang/simt/block.py +94 -0
- taichi/lang/simt/grid.py +7 -0
- taichi/lang/simt/subgroup.py +191 -0
- taichi/lang/simt/warp.py +96 -0
- taichi/lang/snode.py +487 -0
- taichi/lang/source_builder.py +150 -0
- taichi/lang/struct.py +855 -0
- taichi/lang/util.py +381 -0
- taichi/linalg/__init__.py +8 -0
- taichi/linalg/matrixfree_cg.py +310 -0
- taichi/linalg/sparse_cg.py +59 -0
- taichi/linalg/sparse_matrix.py +303 -0
- taichi/linalg/sparse_solver.py +123 -0
- taichi/math/__init__.py +11 -0
- taichi/math/_complex.py +204 -0
- taichi/math/mathimpl.py +886 -0
- taichi/profiler/__init__.py +6 -0
- taichi/profiler/kernel_metrics.py +260 -0
- taichi/profiler/kernel_profiler.py +592 -0
- taichi/profiler/memory_profiler.py +15 -0
- taichi/profiler/scoped_profiler.py +36 -0
- taichi/shaders/Circles_vk.frag +29 -0
- taichi/shaders/Circles_vk.vert +45 -0
- taichi/shaders/Circles_vk_frag.spv +0 -0
- taichi/shaders/Circles_vk_vert.spv +0 -0
- taichi/shaders/Lines_vk.frag +9 -0
- taichi/shaders/Lines_vk.vert +11 -0
- taichi/shaders/Lines_vk_frag.spv +0 -0
- taichi/shaders/Lines_vk_vert.spv +0 -0
- taichi/shaders/Mesh_vk.frag +71 -0
- taichi/shaders/Mesh_vk.vert +68 -0
- taichi/shaders/Mesh_vk_frag.spv +0 -0
- taichi/shaders/Mesh_vk_vert.spv +0 -0
- taichi/shaders/Particles_vk.frag +95 -0
- taichi/shaders/Particles_vk.vert +73 -0
- 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 +9 -0
- taichi/shaders/SceneLines_vk.vert +12 -0
- taichi/shaders/SceneLines_vk_frag.spv +0 -0
- taichi/shaders/SceneLines_vk_vert.spv +0 -0
- taichi/shaders/SetImage_vk.frag +21 -0
- taichi/shaders/SetImage_vk.vert +15 -0
- taichi/shaders/SetImage_vk_frag.spv +0 -0
- taichi/shaders/SetImage_vk_vert.spv +0 -0
- taichi/shaders/Triangles_vk.frag +16 -0
- taichi/shaders/Triangles_vk.vert +29 -0
- 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/sparse/__init__.py +3 -0
- taichi/sparse/_sparse_grid.py +77 -0
- taichi/tools/__init__.py +12 -0
- taichi/tools/diagnose.py +124 -0
- taichi/tools/np2ply.py +364 -0
- taichi/tools/vtk.py +38 -0
- taichi/types/__init__.py +19 -0
- taichi/types/annotations.py +47 -0
- taichi/types/compound_types.py +90 -0
- taichi/types/enums.py +49 -0
- taichi/types/ndarray_type.py +147 -0
- taichi/types/primitive_types.py +203 -0
- taichi/types/quant.py +88 -0
- taichi/types/texture_type.py +85 -0
- taichi/types/utils.py +13 -0
@@ -0,0 +1,157 @@
|
|
1
|
+
# type: ignore
|
2
|
+
|
3
|
+
import inspect
|
4
|
+
|
5
|
+
import taichi.lang
|
6
|
+
from taichi._lib import core as _ti_core
|
7
|
+
from taichi.lang import impl, ops
|
8
|
+
from taichi.lang._texture import RWTextureAccessor, TextureSampler
|
9
|
+
from taichi.lang.any_array import AnyArray
|
10
|
+
from taichi.lang.expr import Expr
|
11
|
+
from taichi.lang.matrix import MatrixType
|
12
|
+
from taichi.lang.struct import StructType
|
13
|
+
from taichi.lang.util import cook_dtype
|
14
|
+
from taichi.types.compound_types import CompoundType
|
15
|
+
from taichi.types.primitive_types import RefType, u64
|
16
|
+
|
17
|
+
|
18
|
+
class KernelArgument:
|
19
|
+
def __init__(self, _annotation, _name, _default=inspect.Parameter.empty):
|
20
|
+
self.annotation = _annotation
|
21
|
+
self.name = _name
|
22
|
+
self.default = _default
|
23
|
+
|
24
|
+
|
25
|
+
class SparseMatrixEntry:
|
26
|
+
def __init__(self, ptr, i, j, dtype):
|
27
|
+
self.ptr = ptr
|
28
|
+
self.i = i
|
29
|
+
self.j = j
|
30
|
+
self.dtype = dtype
|
31
|
+
|
32
|
+
def _augassign(self, value, op):
|
33
|
+
call_func = f"insert_triplet_{self.dtype}"
|
34
|
+
if op == "Add":
|
35
|
+
taichi.lang.impl.call_internal(call_func, self.ptr, self.i, self.j, ops.cast(value, self.dtype))
|
36
|
+
elif op == "Sub":
|
37
|
+
taichi.lang.impl.call_internal(call_func, self.ptr, self.i, self.j, -ops.cast(value, self.dtype))
|
38
|
+
else:
|
39
|
+
assert False, "Only operations '+=' and '-=' are supported on sparse matrices."
|
40
|
+
|
41
|
+
|
42
|
+
class SparseMatrixProxy:
|
43
|
+
def __init__(self, ptr, dtype):
|
44
|
+
self.ptr = ptr
|
45
|
+
self.dtype = dtype
|
46
|
+
|
47
|
+
def subscript(self, i, j):
|
48
|
+
return SparseMatrixEntry(self.ptr, i, j, self.dtype)
|
49
|
+
|
50
|
+
|
51
|
+
def decl_scalar_arg(dtype, name, arg_depth):
|
52
|
+
is_ref = False
|
53
|
+
if isinstance(dtype, RefType):
|
54
|
+
is_ref = True
|
55
|
+
dtype = dtype.tp
|
56
|
+
dtype = cook_dtype(dtype)
|
57
|
+
if is_ref:
|
58
|
+
arg_id = impl.get_runtime().compiling_callable.insert_pointer_param(dtype, name)
|
59
|
+
else:
|
60
|
+
arg_id = impl.get_runtime().compiling_callable.insert_scalar_param(dtype, name)
|
61
|
+
|
62
|
+
argload_di = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
|
63
|
+
return Expr(
|
64
|
+
_ti_core.make_arg_load_expr(arg_id, dtype, is_ref, create_load=True, arg_depth=arg_depth, dbg_info=argload_di)
|
65
|
+
)
|
66
|
+
|
67
|
+
|
68
|
+
def get_type_for_kernel_args(dtype, name):
|
69
|
+
if isinstance(dtype, MatrixType):
|
70
|
+
# Compiling the matrix type to a struct type because the support for the matrix type is not ready yet on SPIR-V based backends.
|
71
|
+
if dtype.ndim == 1:
|
72
|
+
elements = [(dtype.dtype, f"{name}_{i}") for i in range(dtype.n)]
|
73
|
+
else:
|
74
|
+
elements = [(dtype.dtype, f"{name}_{i}_{j}") for i in range(dtype.n) for j in range(dtype.m)]
|
75
|
+
return _ti_core.get_type_factory_instance().get_struct_type(elements)
|
76
|
+
if isinstance(dtype, StructType):
|
77
|
+
elements = []
|
78
|
+
for k, element_type in dtype.members.items():
|
79
|
+
if isinstance(element_type, CompoundType):
|
80
|
+
new_dtype = get_type_for_kernel_args(element_type, k)
|
81
|
+
elements.append([new_dtype, k])
|
82
|
+
else:
|
83
|
+
elements.append([element_type, k])
|
84
|
+
return _ti_core.get_type_factory_instance().get_struct_type(elements)
|
85
|
+
# Assuming dtype is a primitive type
|
86
|
+
return dtype
|
87
|
+
|
88
|
+
|
89
|
+
def decl_matrix_arg(matrixtype, name, arg_depth):
|
90
|
+
arg_type = get_type_for_kernel_args(matrixtype, name)
|
91
|
+
arg_id = impl.get_runtime().compiling_callable.insert_scalar_param(arg_type, name)
|
92
|
+
argload_di = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
|
93
|
+
arg_load = Expr(
|
94
|
+
_ti_core.make_arg_load_expr(arg_id, arg_type, create_load=False, arg_depth=arg_depth, dbg_info=argload_di)
|
95
|
+
)
|
96
|
+
return matrixtype.from_taichi_object(arg_load)
|
97
|
+
|
98
|
+
|
99
|
+
def decl_struct_arg(structtype, name, arg_depth):
|
100
|
+
arg_type = get_type_for_kernel_args(structtype, name)
|
101
|
+
arg_id = impl.get_runtime().compiling_callable.insert_scalar_param(arg_type, name)
|
102
|
+
argload_di = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
|
103
|
+
arg_load = Expr(
|
104
|
+
_ti_core.make_arg_load_expr(arg_id, arg_type, create_load=False, arg_depth=arg_depth, dbg_info=argload_di)
|
105
|
+
)
|
106
|
+
return structtype.from_taichi_object(arg_load)
|
107
|
+
|
108
|
+
|
109
|
+
def push_argpack_arg(name):
|
110
|
+
impl.get_runtime().compiling_callable.insert_argpack_param_and_push(name)
|
111
|
+
|
112
|
+
|
113
|
+
def decl_argpack_arg(argpacktype, member_dict):
|
114
|
+
impl.get_runtime().compiling_callable.pop_argpack_stack()
|
115
|
+
return argpacktype.from_taichi_object(member_dict)
|
116
|
+
|
117
|
+
|
118
|
+
def decl_sparse_matrix(dtype, name):
|
119
|
+
value_type = cook_dtype(dtype)
|
120
|
+
ptr_type = cook_dtype(u64)
|
121
|
+
# Treat the sparse matrix argument as a scalar since we only need to pass in the base pointer
|
122
|
+
arg_id = impl.get_runtime().compiling_callable.insert_scalar_param(ptr_type, name)
|
123
|
+
argload_di = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
|
124
|
+
return SparseMatrixProxy(
|
125
|
+
_ti_core.make_arg_load_expr(arg_id, ptr_type, is_ptr=False, dbg_info=argload_di), value_type
|
126
|
+
)
|
127
|
+
|
128
|
+
|
129
|
+
def decl_ndarray_arg(element_type, ndim, name, needs_grad, boundary):
|
130
|
+
arg_id = impl.get_runtime().compiling_callable.insert_ndarray_param(element_type, ndim, name, needs_grad)
|
131
|
+
return AnyArray(_ti_core.make_external_tensor_expr(element_type, ndim, arg_id, needs_grad, 0, boundary))
|
132
|
+
|
133
|
+
|
134
|
+
def decl_texture_arg(num_dimensions, name):
|
135
|
+
# FIXME: texture_arg doesn't have element_shape so better separate them
|
136
|
+
arg_id = impl.get_runtime().compiling_callable.insert_texture_param(num_dimensions, name)
|
137
|
+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
|
138
|
+
return TextureSampler(_ti_core.make_texture_ptr_expr(arg_id, num_dimensions, 0, dbg_info), num_dimensions)
|
139
|
+
|
140
|
+
|
141
|
+
def decl_rw_texture_arg(num_dimensions, buffer_format, lod, name):
|
142
|
+
# FIXME: texture_arg doesn't have element_shape so better separate them
|
143
|
+
arg_id = impl.get_runtime().compiling_callable.insert_rw_texture_param(num_dimensions, buffer_format, name)
|
144
|
+
dbg_info = _ti_core.DebugInfo(impl.get_runtime().get_current_src_info())
|
145
|
+
return RWTextureAccessor(
|
146
|
+
_ti_core.make_rw_texture_ptr_expr(arg_id, num_dimensions, 0, buffer_format, lod, dbg_info), num_dimensions
|
147
|
+
)
|
148
|
+
|
149
|
+
|
150
|
+
def decl_ret(dtype):
|
151
|
+
if isinstance(dtype, StructType):
|
152
|
+
dtype = dtype.dtype
|
153
|
+
if isinstance(dtype, MatrixType):
|
154
|
+
dtype = _ti_core.get_type_factory_instance().get_tensor_type([dtype.n, dtype.m], dtype.dtype)
|
155
|
+
else:
|
156
|
+
dtype = cook_dtype(dtype)
|
157
|
+
impl.get_runtime().compiling_callable.insert_ret(dtype)
|