gstaichi 0.1.23.dev0__cp310-cp310-macosx_15_0_arm64.whl → 0.1.25.dev0__cp310-cp310-macosx_15_0_arm64.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.
Files changed (239) hide show
  1. {taichi → gstaichi}/__init__.py +9 -13
  2. {taichi → gstaichi}/_funcs.py +8 -8
  3. {taichi → gstaichi}/_kernels.py +19 -19
  4. gstaichi/_lib/__init__.py +3 -0
  5. taichi/_lib/core/taichi_python.cpython-310-darwin.so → gstaichi/_lib/core/gstaichi_python.cpython-310-darwin.so +0 -0
  6. taichi/_lib/core/taichi_python.pyi → gstaichi/_lib/core/gstaichi_python.pyi +382 -520
  7. {taichi → gstaichi}/_lib/runtime/runtime_arm64.bc +0 -0
  8. {taichi → gstaichi}/_lib/utils.py +15 -15
  9. {taichi → gstaichi}/_logging.py +1 -1
  10. {taichi → gstaichi}/_main.py +24 -31
  11. gstaichi/_snode/__init__.py +5 -0
  12. {taichi → gstaichi}/_snode/fields_builder.py +27 -29
  13. {taichi → gstaichi}/_snode/snode_tree.py +5 -5
  14. gstaichi/_test_tools/__init__.py +0 -0
  15. gstaichi/_test_tools/load_kernel_string.py +30 -0
  16. gstaichi/_version.py +1 -0
  17. {taichi → gstaichi}/_version_check.py +8 -5
  18. gstaichi/ad/__init__.py +3 -0
  19. {taichi → gstaichi}/ad/_ad.py +26 -26
  20. {taichi → gstaichi}/algorithms/_algorithms.py +7 -7
  21. {taichi → gstaichi}/examples/minimal.py +1 -1
  22. {taichi → gstaichi}/experimental.py +1 -1
  23. gstaichi/lang/__init__.py +50 -0
  24. {taichi → gstaichi}/lang/_ndarray.py +30 -26
  25. {taichi → gstaichi}/lang/_ndrange.py +8 -8
  26. gstaichi/lang/_template_mapper.py +199 -0
  27. {taichi → gstaichi}/lang/_texture.py +19 -19
  28. {taichi → gstaichi}/lang/_wrap_inspect.py +7 -7
  29. {taichi → gstaichi}/lang/any_array.py +13 -13
  30. {taichi → gstaichi}/lang/argpack.py +29 -29
  31. gstaichi/lang/ast/__init__.py +5 -0
  32. {taichi → gstaichi}/lang/ast/ast_transformer.py +94 -582
  33. {taichi → gstaichi}/lang/ast/ast_transformer_utils.py +54 -41
  34. gstaichi/lang/ast/ast_transformers/__init__.py +0 -0
  35. gstaichi/lang/ast/ast_transformers/call_transformer.py +267 -0
  36. gstaichi/lang/ast/ast_transformers/function_def_transformer.py +320 -0
  37. {taichi → gstaichi}/lang/ast/checkers.py +5 -5
  38. gstaichi/lang/ast/transform.py +9 -0
  39. {taichi → gstaichi}/lang/common_ops.py +12 -12
  40. gstaichi/lang/exception.py +80 -0
  41. {taichi → gstaichi}/lang/expr.py +22 -22
  42. {taichi → gstaichi}/lang/field.py +29 -27
  43. {taichi → gstaichi}/lang/impl.py +116 -121
  44. {taichi → gstaichi}/lang/kernel_arguments.py +16 -16
  45. {taichi → gstaichi}/lang/kernel_impl.py +330 -363
  46. {taichi → gstaichi}/lang/matrix.py +119 -115
  47. {taichi → gstaichi}/lang/matrix_ops.py +6 -6
  48. {taichi → gstaichi}/lang/matrix_ops_utils.py +4 -4
  49. {taichi → gstaichi}/lang/mesh.py +22 -22
  50. {taichi → gstaichi}/lang/misc.py +39 -68
  51. {taichi → gstaichi}/lang/ops.py +146 -141
  52. {taichi → gstaichi}/lang/runtime_ops.py +2 -2
  53. {taichi → gstaichi}/lang/shell.py +3 -3
  54. {taichi → gstaichi}/lang/simt/__init__.py +1 -1
  55. {taichi → gstaichi}/lang/simt/block.py +7 -7
  56. {taichi → gstaichi}/lang/simt/grid.py +1 -1
  57. {taichi → gstaichi}/lang/simt/subgroup.py +1 -1
  58. {taichi → gstaichi}/lang/simt/warp.py +1 -1
  59. {taichi → gstaichi}/lang/snode.py +46 -44
  60. {taichi → gstaichi}/lang/source_builder.py +13 -13
  61. {taichi → gstaichi}/lang/struct.py +33 -33
  62. {taichi → gstaichi}/lang/util.py +24 -24
  63. gstaichi/linalg/__init__.py +8 -0
  64. {taichi → gstaichi}/linalg/matrixfree_cg.py +14 -14
  65. {taichi → gstaichi}/linalg/sparse_cg.py +10 -10
  66. {taichi → gstaichi}/linalg/sparse_matrix.py +23 -23
  67. {taichi → gstaichi}/linalg/sparse_solver.py +21 -21
  68. {taichi → gstaichi}/math/__init__.py +1 -1
  69. {taichi → gstaichi}/math/_complex.py +21 -20
  70. {taichi → gstaichi}/math/mathimpl.py +56 -56
  71. gstaichi/profiler/__init__.py +6 -0
  72. {taichi → gstaichi}/profiler/kernel_metrics.py +11 -11
  73. {taichi → gstaichi}/profiler/kernel_profiler.py +30 -36
  74. {taichi → gstaichi}/profiler/memory_profiler.py +1 -1
  75. {taichi → gstaichi}/profiler/scoped_profiler.py +2 -2
  76. {taichi → gstaichi}/sparse/_sparse_grid.py +7 -7
  77. {taichi → gstaichi}/tools/__init__.py +4 -4
  78. {taichi → gstaichi}/tools/diagnose.py +10 -17
  79. gstaichi/types/__init__.py +19 -0
  80. {taichi → gstaichi}/types/annotations.py +1 -1
  81. {taichi → gstaichi}/types/compound_types.py +8 -8
  82. {taichi → gstaichi}/types/enums.py +1 -1
  83. {taichi → gstaichi}/types/ndarray_type.py +7 -7
  84. {taichi → gstaichi}/types/primitive_types.py +17 -14
  85. {taichi → gstaichi}/types/quant.py +9 -9
  86. {taichi → gstaichi}/types/texture_type.py +5 -5
  87. {taichi → gstaichi}/types/utils.py +1 -1
  88. {gstaichi-0.1.23.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/METADATA +13 -16
  89. gstaichi-0.1.25.dev0.dist-info/RECORD +168 -0
  90. gstaichi-0.1.25.dev0.dist-info/entry_points.txt +2 -0
  91. gstaichi-0.1.25.dev0.dist-info/top_level.txt +1 -0
  92. gstaichi-0.1.23.dev0.dist-info/RECORD +0 -219
  93. gstaichi-0.1.23.dev0.dist-info/entry_points.txt +0 -2
  94. gstaichi-0.1.23.dev0.dist-info/top_level.txt +0 -1
  95. taichi/_lib/__init__.py +0 -3
  96. taichi/_lib/c_api/include/taichi/cpp/taichi.hpp +0 -1401
  97. taichi/_lib/c_api/include/taichi/taichi.h +0 -29
  98. taichi/_lib/c_api/include/taichi/taichi_core.h +0 -1111
  99. taichi/_lib/c_api/include/taichi/taichi_cpu.h +0 -29
  100. taichi/_lib/c_api/include/taichi/taichi_metal.h +0 -72
  101. taichi/_lib/c_api/include/taichi/taichi_platform.h +0 -55
  102. taichi/_lib/c_api/include/taichi/taichi_unity.h +0 -64
  103. taichi/_lib/c_api/include/taichi/taichi_vulkan.h +0 -151
  104. taichi/_lib/c_api/lib/libtaichi_c_api.dylib +0 -0
  105. taichi/_lib/c_api/runtime/runtime_arm64.bc +0 -0
  106. taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfig.cmake +0 -29
  107. taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfigVersion.cmake +0 -65
  108. taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake +0 -121
  109. taichi/_lib/runtime/libMoltenVK.dylib +0 -0
  110. taichi/_snode/__init__.py +0 -5
  111. taichi/_ti_module/__init__.py +0 -3
  112. taichi/_ti_module/cppgen.py +0 -309
  113. taichi/_ti_module/module.py +0 -145
  114. taichi/_version.py +0 -1
  115. taichi/ad/__init__.py +0 -3
  116. taichi/aot/__init__.py +0 -12
  117. taichi/aot/_export.py +0 -28
  118. taichi/aot/conventions/__init__.py +0 -3
  119. taichi/aot/conventions/gfxruntime140/__init__.py +0 -38
  120. taichi/aot/conventions/gfxruntime140/dr.py +0 -244
  121. taichi/aot/conventions/gfxruntime140/sr.py +0 -613
  122. taichi/aot/module.py +0 -253
  123. taichi/aot/utils.py +0 -151
  124. taichi/graph/__init__.py +0 -3
  125. taichi/graph/_graph.py +0 -292
  126. taichi/lang/__init__.py +0 -50
  127. taichi/lang/ast/__init__.py +0 -5
  128. taichi/lang/ast/transform.py +0 -9
  129. taichi/lang/exception.py +0 -80
  130. taichi/linalg/__init__.py +0 -8
  131. taichi/profiler/__init__.py +0 -6
  132. taichi/shaders/Circles_vk.frag +0 -29
  133. taichi/shaders/Circles_vk.vert +0 -45
  134. taichi/shaders/Circles_vk_frag.spv +0 -0
  135. taichi/shaders/Circles_vk_vert.spv +0 -0
  136. taichi/shaders/Lines_vk.frag +0 -9
  137. taichi/shaders/Lines_vk.vert +0 -11
  138. taichi/shaders/Lines_vk_frag.spv +0 -0
  139. taichi/shaders/Lines_vk_vert.spv +0 -0
  140. taichi/shaders/Mesh_vk.frag +0 -71
  141. taichi/shaders/Mesh_vk.vert +0 -68
  142. taichi/shaders/Mesh_vk_frag.spv +0 -0
  143. taichi/shaders/Mesh_vk_vert.spv +0 -0
  144. taichi/shaders/Particles_vk.frag +0 -95
  145. taichi/shaders/Particles_vk.vert +0 -73
  146. taichi/shaders/Particles_vk_frag.spv +0 -0
  147. taichi/shaders/Particles_vk_vert.spv +0 -0
  148. taichi/shaders/SceneLines2quad_vk_comp.spv +0 -0
  149. taichi/shaders/SceneLines_vk.frag +0 -9
  150. taichi/shaders/SceneLines_vk.vert +0 -12
  151. taichi/shaders/SceneLines_vk_frag.spv +0 -0
  152. taichi/shaders/SceneLines_vk_vert.spv +0 -0
  153. taichi/shaders/SetImage_vk.frag +0 -21
  154. taichi/shaders/SetImage_vk.vert +0 -15
  155. taichi/shaders/SetImage_vk_frag.spv +0 -0
  156. taichi/shaders/SetImage_vk_vert.spv +0 -0
  157. taichi/shaders/Triangles_vk.frag +0 -16
  158. taichi/shaders/Triangles_vk.vert +0 -29
  159. taichi/shaders/Triangles_vk_frag.spv +0 -0
  160. taichi/shaders/Triangles_vk_vert.spv +0 -0
  161. taichi/shaders/lines2quad_vk_comp.spv +0 -0
  162. taichi/types/__init__.py +0 -19
  163. {taichi → gstaichi}/__main__.py +0 -0
  164. {taichi → gstaichi}/_lib/core/__init__.py +0 -0
  165. {taichi → gstaichi}/_lib/core/py.typed +0 -0
  166. {taichi/_lib/c_api → gstaichi/_lib}/runtime/libMoltenVK.dylib +0 -0
  167. {taichi → gstaichi}/algorithms/__init__.py +0 -0
  168. {taichi → gstaichi}/assets/.git +0 -0
  169. {taichi → gstaichi}/assets/Go-Regular.ttf +0 -0
  170. {taichi → gstaichi}/assets/static/imgs/ti_gallery.png +0 -0
  171. {taichi → gstaichi}/lang/ast/symbol_resolver.py +0 -0
  172. {taichi → gstaichi}/sparse/__init__.py +0 -0
  173. {taichi → gstaichi}/tools/np2ply.py +0 -0
  174. {taichi → gstaichi}/tools/vtk.py +0 -0
  175. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/GLFW/glfw3.h +0 -0
  176. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/GLFW/glfw3native.h +0 -0
  177. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/instrument.hpp +0 -0
  178. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.h +0 -0
  179. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/libspirv.hpp +0 -0
  180. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/linker.hpp +0 -0
  181. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv-tools/optimizer.hpp +0 -0
  182. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/GLSL.std.450.h +0 -0
  183. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv.h +0 -0
  184. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv.hpp +0 -0
  185. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cfg.hpp +0 -0
  186. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_common.hpp +0 -0
  187. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cpp.hpp +0 -0
  188. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross.hpp +0 -0
  189. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_c.h +0 -0
  190. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_containers.hpp +0 -0
  191. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_error_handling.hpp +0 -0
  192. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_parsed_ir.hpp +0 -0
  193. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_cross_util.hpp +0 -0
  194. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_glsl.hpp +0 -0
  195. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_hlsl.hpp +0 -0
  196. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_msl.hpp +0 -0
  197. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_parser.hpp +0 -0
  198. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/include/spirv_cross/spirv_reflect.hpp +0 -0
  199. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsConfig.cmake +0 -0
  200. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget-release.cmake +0 -0
  201. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake +0 -0
  202. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffConfig.cmake +0 -0
  203. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets-release.cmake +0 -0
  204. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets.cmake +0 -0
  205. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkConfig.cmake +0 -0
  206. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets-release.cmake +0 -0
  207. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets.cmake +0 -0
  208. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintConfig.cmake +0 -0
  209. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets-release.cmake +0 -0
  210. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets.cmake +0 -0
  211. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optConfig.cmake +0 -0
  212. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets-release.cmake +0 -0
  213. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets.cmake +0 -0
  214. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceConfig.cmake +0 -0
  215. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget-release.cmake +0 -0
  216. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget.cmake +0 -0
  217. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Config.cmake +0 -0
  218. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +0 -0
  219. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Targets-release.cmake +0 -0
  220. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/cmake/glfw3/glfw3Targets.cmake +0 -0
  221. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/lib/libSPIRV-Tools-shared.dylib +0 -0
  222. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig-release.cmake +0 -0
  223. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig.cmake +0 -0
  224. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig-release.cmake +0 -0
  225. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig.cmake +0 -0
  226. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig-release.cmake +0 -0
  227. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig.cmake +0 -0
  228. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig-release.cmake +0 -0
  229. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig.cmake +0 -0
  230. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig-release.cmake +0 -0
  231. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig.cmake +0 -0
  232. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig-release.cmake +0 -0
  233. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig.cmake +0 -0
  234. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig-release.cmake +0 -0
  235. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig.cmake +0 -0
  236. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig-release.cmake +0 -0
  237. {gstaichi-0.1.23.dev0.data → gstaichi-0.1.25.dev0.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig.cmake +0 -0
  238. {gstaichi-0.1.23.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/WHEEL +0 -0
  239. {gstaichi-0.1.23.dev0.dist-info → gstaichi-0.1.25.dev0.dist-info}/licenses/LICENSE +0 -0
@@ -1,309 +0,0 @@
1
- # type: ignore
2
-
3
- from typing import Any, List, Optional, Set
4
-
5
- from taichi.aot.conventions.gfxruntime140 import GfxRuntime140, sr
6
-
7
- dtype2ctype = {
8
- sr.DataType.f16: "half_t",
9
- sr.DataType.f32: "float",
10
- sr.DataType.f64: "double",
11
- sr.DataType.i8: "int8_t",
12
- sr.DataType.i16: "int16_t",
13
- sr.DataType.i32: "int32_t",
14
- sr.DataType.i64: "int64_t",
15
- sr.DataType.u8: "uint8_t",
16
- sr.DataType.u16: "uint16_t",
17
- sr.DataType.u32: "uint32_t",
18
- sr.DataType.u64: "uint64_t",
19
- }
20
-
21
-
22
- def check_arg(actual: str, expect: Any) -> List[str]:
23
- out = []
24
-
25
- expect = str(expect)
26
- out += [
27
- f" if (value.{actual} != {expect}) {{",
28
- f' ti_set_last_error(TI_ERROR_INVALID_ARGUMENT, "value.{actual} != {expect}");',
29
- " return *this;",
30
- " }",
31
- ]
32
-
33
- return out
34
-
35
-
36
- def get_arg_dst(i: int, is_named: bool) -> str:
37
- if is_named:
38
- return f"args_[{i}].argument"
39
- return f"args_[{i}]"
40
-
41
-
42
- def generate_scalar_assign(cls_name: str, i: int, arg_name: str, arg: sr.ArgumentScalar, is_named: bool) -> List[str]:
43
- ctype = dtype2ctype[arg.dtype]
44
-
45
- out = []
46
-
47
- out += [
48
- f" {cls_name} &set_{arg_name}({ctype} value) {{",
49
- ]
50
-
51
- if is_named:
52
- out += [
53
- f' args_[{i}].name = "{arg_name}";',
54
- ]
55
- if ctype == "float":
56
- out += [
57
- f" {get_arg_dst(i, is_named)}.type = TI_ARGUMENT_TYPE_F32;",
58
- f" {get_arg_dst(i, is_named)}.value.f32 = value;",
59
- ]
60
- elif ctype == "int32_t":
61
- out += [
62
- f" {get_arg_dst(i, is_named)}.type = TI_ARGUMENT_TYPE_I32;",
63
- f" {get_arg_dst(i, is_named)}.value.i32 = value;",
64
- ]
65
- else:
66
- out += [
67
- f" {get_arg_dst(i, is_named)}.type = TI_ARGUMENT_TYPE_SCALAR;",
68
- f" {get_arg_dst(i, is_named)}.value.scalar.type = TI_DATA_TYPE_{arg.dtype.name.upper()};",
69
- f" *(({ctype}*)(&{get_arg_dst(i, is_named)}.value.scalar.value)) = value;",
70
- ]
71
- assert False, f"{ctype} is not a supported scalar type."
72
-
73
- out += [
74
- " return *this;",
75
- " }",
76
- ]
77
- return out
78
-
79
-
80
- def generate_ndarray_assign(cls_name: str, i: int, arg_name: str, arg: sr.ArgumentNdArray, is_named: bool) -> List[str]:
81
- out = []
82
-
83
- out += [
84
- f" {cls_name} &set_{arg_name}(const TiNdArray &value) {{",
85
- ]
86
-
87
- out += check_arg("elem_type", f"TI_DATA_TYPE_{arg.dtype.name.upper()}")
88
- out += check_arg("shape.dim_count", arg.ndim)
89
- assert len(arg.element_shape) <= 16
90
- out += check_arg("elem_shape.dim_count", len(arg.element_shape))
91
- for j, dim in enumerate(arg.element_shape):
92
- out += check_arg(f"elem_shape.dims[{j}]", dim)
93
-
94
- if is_named:
95
- out += [
96
- f' args_[{i}].name = "{arg_name}";',
97
- ]
98
- out += [
99
- f" {get_arg_dst(i, is_named)}.type = TI_ARGUMENT_TYPE_NDARRAY;",
100
- f" {get_arg_dst(i, is_named)}.value.ndarray = value;",
101
- " return *this;",
102
- " }",
103
- ]
104
- return out
105
-
106
-
107
- def generate_texture_assign(
108
- cls_name: str,
109
- i: int,
110
- arg_name: str,
111
- arg: sr.ArgumentTexture | sr.ArgumentRwTexture,
112
- is_named: bool,
113
- ) -> List[str]:
114
- out = []
115
-
116
- out += [
117
- f" {cls_name} &set_{arg_name}(const TiTexture &value) {{",
118
- ]
119
-
120
- assert arg.ndim in [1, 2, 3]
121
- out += check_arg("dimension", f"TI_IMAGE_DIMENSION_{arg.ndim}D")
122
- if isinstance(arg, sr.ArgumentRwTexture):
123
- out += check_arg("format", f"TI_FORMAT_{arg.fmt.name.upper()}")
124
-
125
- if is_named:
126
- out += [
127
- f' args_[{i}].name = "{arg_name}";',
128
- ]
129
- out += [
130
- f" {get_arg_dst(i, is_named)}.type = TI_ARGUMENT_TYPE_TEXTURE;",
131
- f" {get_arg_dst(i, is_named)}.value.texture = value;",
132
- " return *this;",
133
- " }",
134
- ]
135
- return out
136
-
137
-
138
- def generate_kernel_args_builder(kernel: sr.Kernel) -> List[str]:
139
- out = []
140
-
141
- out += [
142
- f"struct Kernel_{kernel.name} : public ti::Kernel {{",
143
- f" explicit Kernel_{kernel.name}(TiRuntime runtime, TiKernel kernel) :",
144
- " ti::Kernel(runtime, kernel) {",
145
- f" args_.resize({len(kernel.context.args)});",
146
- " }",
147
- "",
148
- ]
149
-
150
- cls_name = f"Kernel_{kernel.name}"
151
- for i, arg in enumerate(kernel.context.args):
152
- arg_name = arg.name if arg.name else f"arg{i}"
153
- if isinstance(arg, sr.ArgumentScalar):
154
- out += generate_scalar_assign(cls_name, i, arg_name, arg, False)
155
- elif isinstance(arg, sr.ArgumentNdArray):
156
- out += generate_ndarray_assign(cls_name, i, arg_name, arg, False)
157
- elif isinstance(arg, (sr.ArgumentTexture, sr.ArgumentRwTexture)):
158
- out += generate_texture_assign(cls_name, i, arg_name, arg, False)
159
- else:
160
- assert False
161
- out += [""]
162
-
163
- out += [
164
- "};",
165
- "",
166
- ]
167
- return out
168
-
169
-
170
- def generate_graph_args_builder(graph: sr.Graph) -> List[str]:
171
- out = []
172
-
173
- out += [
174
- f"struct ComputeGraph_{graph.name} : public ti::ComputeGraph {{",
175
- f" explicit ComputeGraph_{graph.name}(TiRuntime runtime, TiComputeGraph graph) :",
176
- " ti::ComputeGraph(runtime, graph) {",
177
- f" args_.resize({len(graph.args)});",
178
- " }",
179
- "",
180
- ]
181
-
182
- cls_name = f"ComputeGraph_{graph.name}"
183
- for i, arg in enumerate(graph.args):
184
- arg_name = arg.name
185
- if isinstance(arg.arg, sr.ArgumentScalar):
186
- out += generate_scalar_assign(cls_name, i, arg_name, arg.arg, True)
187
- elif isinstance(arg.arg, sr.ArgumentNdArray):
188
- out += generate_ndarray_assign(cls_name, i, arg_name, arg.arg, True)
189
- elif isinstance(arg.arg, (sr.ArgumentTexture, sr.ArgumentRwTexture)):
190
- out += generate_texture_assign(cls_name, i, arg_name, arg.arg, True)
191
- else:
192
- assert False
193
- out += [""]
194
-
195
- out += [
196
- "};",
197
- "",
198
- ]
199
- return out
200
-
201
-
202
- def generate_module_content_repr(m: GfxRuntime140, module_name: str, cgraph_kernel_names: Set[str]) -> List[str]:
203
- out = []
204
-
205
- if module_name:
206
- module_name = f"AotModule_{module_name}"
207
- else:
208
- module_name = "AotModule"
209
-
210
- out += [
211
- f"struct {module_name} : public ti::AotModule {{",
212
- f" explicit {module_name}(TiRuntime runtime, TiAotModule aot_module, bool should_destroy = true) :",
213
- " ti::AotModule(runtime, aot_module, should_destroy) {}",
214
- "",
215
- f" static {module_name} load(TiRuntime runtime, const char *path) {{",
216
- " TiAotModule aot_module = ti_load_aot_module(runtime, path);",
217
- f" return {module_name}(runtime, aot_module, true);",
218
- " }",
219
- f" static {module_name} load(TiRuntime runtime, const std::string &path) {{",
220
- f" return {module_name}::load(runtime, path.c_str());",
221
- " }",
222
- f" static {module_name} create(TiRuntime runtime, const void *tcm, size_t size) {{",
223
- " TiAotModule aot_module = ti_create_aot_module(runtime, tcm, size);",
224
- f" return {module_name}(runtime, aot_module, true);",
225
- " }",
226
- f" static {module_name} create(TiRuntime runtime, const std::vector<uint8_t> &tcm) {{",
227
- f" return {module_name}::create(runtime, tcm.data(), tcm.size());",
228
- " }",
229
- "",
230
- ]
231
- for kernel in m.metadata.kernels.values():
232
- if kernel.name in cgraph_kernel_names:
233
- continue
234
- out += [
235
- f" Kernel_{kernel.name} get_kernel_{kernel.name}() const {{",
236
- f' return Kernel_{kernel.name}(runtime_, ti_get_aot_module_kernel(aot_module(), "{kernel.name}"));',
237
- " }",
238
- ]
239
- for graph in m.graphs:
240
- out += [
241
- f" ComputeGraph_{graph.name} get_compute_graph_{graph.name}() const {{",
242
- f' return ComputeGraph_{graph.name}(runtime_, ti_get_aot_module_compute_graph(aot_module(), "{graph.name}"));',
243
- " }",
244
- ]
245
- out += [
246
- "};",
247
- "",
248
- ]
249
- return out
250
-
251
-
252
- def generate_module_content(m: GfxRuntime140, module_name: str) -> List[str]:
253
- # This has all kernels including all the ones launched by compute graphs.
254
- cgraph_kernel_names = set(dispatch.kernel.name for graph in m.graphs for dispatch in graph.dispatches)
255
-
256
- out = []
257
- for kernel in m.metadata.kernels.values():
258
- if kernel.name in cgraph_kernel_names:
259
- continue
260
- out += generate_kernel_args_builder(kernel)
261
-
262
- for graph in m.graphs:
263
- out += generate_graph_args_builder(graph)
264
-
265
- out += generate_module_content_repr(m, module_name, cgraph_kernel_names)
266
-
267
- return out
268
-
269
-
270
- def generate_header(m: GfxRuntime140, module_name: str, namespace: str, tcm: Optional[bytes]) -> List[str]:
271
- out = []
272
-
273
- out += [
274
- "// THIS IS A GENERATED HEADER; PLEASE DO NOT MODIFY.",
275
- "#pragma once",
276
- "#include <vector>",
277
- "#include <string>",
278
- "#include <taichi/cpp/taichi.hpp>",
279
- "",
280
- ]
281
-
282
- if namespace:
283
- out += [
284
- f"namespace {namespace} {{",
285
- "",
286
- ]
287
-
288
- if tcm is not None:
289
- tcm_bytes = [x for x in tcm]
290
-
291
- out += [
292
- f"static const uint8_t {module_name}_tcm[{len(tcm_bytes)}] = {{",
293
- ]
294
-
295
- out += [f" {', '.join(str(x) for x in tcm_bytes[i:i + 8])}," for i in range(0, len(tcm_bytes), 8)]
296
-
297
- out += [
298
- "};",
299
- "",
300
- f"static const size_t {module_name}_tcm_size = {len(tcm_bytes)};",
301
- "",
302
- ]
303
-
304
- out += generate_module_content(m, module_name)
305
-
306
- if namespace:
307
- out += [f"}} // namespace {namespace}", ""]
308
-
309
- return out
@@ -1,145 +0,0 @@
1
- # type: ignore
2
-
3
- import argparse
4
- import runpy
5
- from pathlib import Path
6
- from typing import List
7
-
8
- import taichi
9
- from taichi._ti_module.cppgen import generate_header
10
- from taichi.aot._export import _aot_kernels
11
- from taichi.aot.conventions.gfxruntime140 import GfxRuntime140
12
- from taichi.aot.module import Module
13
- from taichi.types.ndarray_type import NdarrayType
14
- from taichi.types.primitive_types import integer_type_ids, real_type_ids
15
- from taichi.types.texture_type import RWTextureType, TextureType
16
-
17
-
18
- def module_cppgen(parser: argparse.ArgumentParser):
19
- """Generate C++ headers for Taichi modules."""
20
- parser.add_argument("MODOLE", help="Path to the module directory.")
21
- parser.add_argument("-n", "--namespace", type=str, help="C++ namespace if wanted.")
22
- parser.add_argument(
23
- "-m",
24
- "--module-name",
25
- type=str,
26
- help="Module name to be a part of the module class. By default, it's the directory name.",
27
- default=None,
28
- )
29
- parser.add_argument("-o", "--output", type=str, help="Output C++ header path.", default="module.h")
30
- parser.add_argument(
31
- "--bin2c",
32
- help="Save the entire TCM archive to an in-memory buffer. This flag is ignored if the module is not a TCM archive",
33
- action="store_true",
34
- )
35
- parser.set_defaults(func=module_cppgen_impl)
36
-
37
-
38
- def module_cppgen_impl(a):
39
- module_path = a.MODOLE
40
-
41
- print(f"Generating C++ header for Taichi module: {Path(module_path).absolute()}")
42
-
43
- tcm = None
44
- if a.bin2c and module_path.endswith(".tcm"):
45
- with open(module_path, "rb") as f:
46
- tcm = f.read()
47
-
48
- if a.module_name:
49
- module_name = a.module_name
50
- else:
51
- module_name = Path(module_path).name
52
- if module_name.endswith(".tcm"):
53
- module_name = module_name[:-4]
54
-
55
- m = GfxRuntime140.from_module(module_path)
56
-
57
- out = generate_header(m, module_name, a.namespace, tcm)
58
-
59
- with open(a.output, "w") as f:
60
- f.write("\n".join(out))
61
-
62
- print(f"Module header is saved to: {Path(a.output).absolute()}")
63
-
64
-
65
- def module_build(parser: argparse.ArgumentParser):
66
- """Build Taichi modules from python scripts."""
67
- parser.add_argument("SOURCE", help="Path to the Taichi program source (Python script).")
68
- parser.add_argument("-o", "--output", type=str, help="Output module path.", default=None)
69
- parser.set_defaults(func=module_build_impl)
70
-
71
-
72
- def module_build_impl(a):
73
- source_path = a.SOURCE
74
- module_path = a.output
75
-
76
- source_path = Path(source_path)
77
- assert source_path.name.endswith(".py"), "Source must be a Python script."
78
- if module_path is None:
79
- module_path = f"{source_path.name[:-3]}.tcm"
80
- module_path = Path(module_path)
81
-
82
- print(f"Building Taichi module: {source_path}")
83
- print()
84
-
85
- d = runpy.run_path(str(source_path), run_name="__main__")
86
- print()
87
-
88
- required_caps = d["REQUIRED_CAPS"] if "REQUIRED_CAPS" in d else []
89
- assert isinstance(required_caps, list), "REQUIRED_CAPS must be a list."
90
-
91
- if required_caps:
92
- print("Module requires the following capabilities:")
93
- for cap in required_caps:
94
- print(f" - {cap}")
95
- print()
96
-
97
- m = Module(caps=required_caps)
98
- for record in _aot_kernels:
99
- print("Added kernel:", record.name)
100
- template_args = None
101
- if record.template_types:
102
- print(" Template types:")
103
- template_args = {}
104
- for k, v in record.template_types.items():
105
- print(f" - {k}: {v}")
106
- # TODO: (penguinliong) Remove this hack. It's not properly
107
- # working with unusual numeric types like f16 or i64.
108
- if isinstance(v, int) or id(v) in integer_type_ids:
109
- value = 0
110
- elif isinstance(v, float) or id(v) in real_type_ids:
111
- value = 0.0
112
- elif isinstance(v, NdarrayType):
113
- if v.ndim is None or v.ndim <= 0:
114
- raise ValueError("Ndarray template type must specify a non-zero dimension.")
115
- value = taichi.ndarray(v.dtype, (1,) * v.ndim)
116
- elif isinstance(v, TextureType):
117
- value = taichi.Texture(taichi.Format.rgba8, (4,) * v.num_dimensions)
118
- elif isinstance(v, RWTextureType):
119
- value = taichi.Texture(v.fmt, (4,) * v.num_dimensions)
120
- else:
121
- raise ValueError(f"Unsupported template type: {type(v)}")
122
- template_args[k] = value
123
- m.add_kernel(record.kernel, template_args)
124
- print()
125
-
126
- if module_path.name.endswith(".tcm"):
127
- m.archive(str(module_path))
128
- else:
129
- m.save(str(module_path))
130
-
131
- print(f"Module is archive to: {module_path}")
132
- print()
133
-
134
-
135
- def _main(arguments: List[str]):
136
- """Taichi module tools."""
137
- parser = argparse.ArgumentParser(prog="ti module", description=_main.__doc__)
138
- subparsers = parser.add_subparsers(title="Taichi module manager commands", required=True)
139
-
140
- cppgen_parser = subparsers.add_parser("cppgen", help=module_cppgen.__doc__)
141
- build_parser = subparsers.add_parser("build", help=module_build.__doc__)
142
- module_cppgen(cppgen_parser)
143
- module_build(build_parser)
144
- args = parser.parse_args(arguments)
145
- args.func(args)
taichi/_version.py DELETED
@@ -1 +0,0 @@
1
- __version__ = '0.1.23.dev0'
taichi/ad/__init__.py DELETED
@@ -1,3 +0,0 @@
1
- # type: ignore
2
-
3
- from taichi.ad._ad import *
taichi/aot/__init__.py DELETED
@@ -1,12 +0,0 @@
1
- # type: ignore
2
-
3
- """Taichi's AOT (ahead of time) module.
4
-
5
- Users can use Taichi as a GPU compute shader/kernel compiler by compiling their
6
- Taichi kernels into an AOT module.
7
- """
8
-
9
- import taichi.aot.conventions
10
- from taichi.aot._export import export, export_as
11
- from taichi.aot.conventions.gfxruntime140 import GfxRuntime140
12
- from taichi.aot.module import Module
taichi/aot/_export.py DELETED
@@ -1,28 +0,0 @@
1
- # type: ignore
2
-
3
- from typing import Any, Dict, List, Optional
4
-
5
-
6
- class AotExportKernel:
7
- def __init__(self, f, name: str, template_types: Dict[str, Any]) -> None:
8
- self.kernel = f
9
- self.name = name
10
- self.template_types = template_types
11
-
12
-
13
- _aot_kernels: List[AotExportKernel] = []
14
-
15
-
16
- def export_as(name: str, *, template_types: Optional[Dict[str, Any]] = None):
17
- def inner(f):
18
- assert hasattr(f, "_is_wrapped_kernel"), "Only Taichi kernels can be exported"
19
-
20
- record = AotExportKernel(f, name, template_types or {})
21
- _aot_kernels.append(record)
22
- return f
23
-
24
- return inner
25
-
26
-
27
- def export(f):
28
- return export_as(f.__name__)(f)
@@ -1,3 +0,0 @@
1
- # type: ignore
2
-
3
- from taichi.aot.conventions import gfxruntime140
@@ -1,38 +0,0 @@
1
- # type: ignore
2
-
3
- import json
4
- import zipfile
5
- from pathlib import Path
6
- from typing import Any, List
7
-
8
- from taichi.aot.conventions.gfxruntime140 import dr, sr
9
-
10
-
11
- class GfxRuntime140:
12
- def __init__(self, metadata_json: Any, graphs_json: Any) -> None:
13
- metadata = dr.from_json_metadata(metadata_json)
14
- graphs = [dr.from_json_graph(x) for x in graphs_json]
15
- self.metadata = sr.from_dr_metadata(metadata)
16
- self.graphs = [sr.from_dr_graph(self.metadata, x) for x in graphs]
17
-
18
- @staticmethod
19
- def from_module(module_path: str) -> "GfxRuntime140":
20
- if Path(module_path).is_file():
21
- with zipfile.ZipFile(module_path) as z:
22
- with z.open("metadata.json") as f:
23
- metadata_json = json.load(f)
24
- with z.open("graphs.json") as f:
25
- graphs_json = json.load(f)
26
- else:
27
- with open(f"{module_path}/metadata.json") as f:
28
- metadata_json = json.load(f)
29
- with open(f"{module_path}/graphs.json") as f:
30
- graphs_json = json.load(f)
31
-
32
- return GfxRuntime140(metadata_json, graphs_json)
33
-
34
- def to_metadata_json(self) -> Any:
35
- return dr.to_json_metadata(sr.to_dr_metadata(self.metadata))
36
-
37
- def to_graphs_json(self) -> List[Any]:
38
- return [dr.to_json_graph(sr.to_dr_graph(x)) for x in self.graphs]