gstaichi 0.1.23.dev0__cp310-cp310-macosx_15_0_arm64.whl → 1.0.1__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.
- gstaichi/CHANGELOG.md +6 -0
- gstaichi/__init__.py +40 -0
- {taichi → gstaichi}/_funcs.py +8 -8
- {taichi → gstaichi}/_kernels.py +19 -19
- gstaichi/_lib/__init__.py +3 -0
- taichi/_lib/core/taichi_python.cpython-310-darwin.so → gstaichi/_lib/core/gstaichi_python.cpython-310-darwin.so +0 -0
- taichi/_lib/core/taichi_python.pyi → gstaichi/_lib/core/gstaichi_python.pyi +382 -520
- {taichi → gstaichi}/_lib/runtime/runtime_arm64.bc +0 -0
- {taichi → gstaichi}/_lib/utils.py +15 -15
- {taichi → gstaichi}/_logging.py +1 -1
- 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.23.dev0.dist-info → gstaichi-1.0.1.dist-info}/METADATA +13 -16
- gstaichi-1.0.1.dist-info/RECORD +166 -0
- gstaichi-1.0.1.dist-info/top_level.txt +1 -0
- gstaichi-0.1.23.dev0.dist-info/RECORD +0 -219
- gstaichi-0.1.23.dev0.dist-info/entry_points.txt +0 -2
- gstaichi-0.1.23.dev0.dist-info/top_level.txt +0 -1
- taichi/__init__.py +0 -44
- taichi/__main__.py +0 -5
- taichi/_lib/__init__.py +0 -3
- 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_metal.h +0 -72
- 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/libtaichi_c_api.dylib +0 -0
- taichi/_lib/c_api/runtime/runtime_arm64.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/libMoltenVK.dylib +0 -0
- taichi/_main.py +0 -552
- 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}/_lib/core/__init__.py +0 -0
- {taichi → gstaichi}/_lib/core/py.typed +0 -0
- {taichi/_lib/c_api → gstaichi/_lib}/runtime/libMoltenVK.dylib +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.23.dev0.data → gstaichi-1.0.1.data}/data/include/GLFW/glfw3.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/GLFW/glfw3native.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv-tools/instrument.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv-tools/libspirv.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv-tools/libspirv.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv-tools/linker.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv-tools/optimizer.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/GLSL.std.450.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cfg.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_common.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cpp.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cross.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cross_c.h +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cross_containers.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cross_error_handling.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cross_parsed_ir.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_cross_util.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_glsl.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_hlsl.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_msl.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_parser.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/include/spirv_cross/spirv_reflect.hpp +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/glfw3/glfw3Config.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/glfw3/glfw3Targets-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/cmake/glfw3/glfw3Targets.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/lib/libSPIRV-Tools-shared.dylib +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_c/cmake/spirv_cross_cConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig-release.cmake +0 -0
- {gstaichi-0.1.23.dev0.data → gstaichi-1.0.1.data}/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig.cmake +0 -0
- {gstaichi-0.1.23.dev0.dist-info → gstaichi-1.0.1.dist-info}/WHEEL +0 -0
- {gstaichi-0.1.23.dev0.dist-info → gstaichi-1.0.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,1111 +0,0 @@
|
|
1
|
-
// # Core Functionality
|
2
|
-
//
|
3
|
-
// Taichi Core exposes all necessary interfaces for offloading the AOT modules
|
4
|
-
// to Taichi. The following is a list of features that are available regardless
|
5
|
-
// of your backend. The corresponding APIs are still under development and
|
6
|
-
// subject to change.
|
7
|
-
//
|
8
|
-
// ## Availability
|
9
|
-
//
|
10
|
-
// Taichi C-API intends to support the following backends:
|
11
|
-
//
|
12
|
-
// |Backend |Offload Target |Maintenance Tier | Stabilized? |
|
13
|
-
// |------------|-----------------|-----------------|-------------|
|
14
|
-
// |Vulkan |GPU |Tier 1 | Yes |
|
15
|
-
// |Metal |GPU (macOS, iOS) |Tier 2 | No |
|
16
|
-
// |CUDA (LLVM) |GPU (NVIDIA) |Tier 2 | No |
|
17
|
-
// |CPU (LLVM) |CPU |Tier 2 | No |
|
18
|
-
// |OpenGL |GPU |Tier 2 | No |
|
19
|
-
// |OpenGL ES |GPU |Tier 2 | No |
|
20
|
-
// |DirectX 11 |GPU (Windows) |N/A | No |
|
21
|
-
//
|
22
|
-
// The backends with tier-1 support are being developed and tested more
|
23
|
-
// intensively. And most new features will be available on Vulkan first because
|
24
|
-
// it has the most outstanding cross-platform compatibility among all the tier-1
|
25
|
-
// backends. For the backends with tier-2 support, you should expect a delay in
|
26
|
-
// the fixes to minor issues.
|
27
|
-
//
|
28
|
-
// For convenience, in the following text and other C-API documents, the term
|
29
|
-
// *host* refers to the user of the C-API; the term *device* refers to the
|
30
|
-
// logical (conceptual) compute device, to which Taichi's runtime offloads its
|
31
|
-
// compute tasks. A *device* may not be a physical discrete processor other than
|
32
|
-
// the CPU and the *host* may *not* be able to access the memory allocated on
|
33
|
-
// the *device*.
|
34
|
-
//
|
35
|
-
// Unless otherwise specified, **device**, **backend**, **offload target**, and
|
36
|
-
// **GPU** are interchangeable; **host**, **user code**, **user procedure**, and
|
37
|
-
// **CPU** are interchangeable.
|
38
|
-
//
|
39
|
-
// ## HowTo
|
40
|
-
//
|
41
|
-
// The following section provides a brief introduction to the Taichi C-API.
|
42
|
-
//
|
43
|
-
// ### Create and destroy a Runtime Instance
|
44
|
-
//
|
45
|
-
// You *must* create a runtime instance before working with Taichi, and *only*
|
46
|
-
// one runtime per thread. Currently, we do not officially claim that multiple
|
47
|
-
// runtime instances can coexist in a process, but please feel free to [file an
|
48
|
-
// issue with us](https://github.com/taichi-dev/taichi/issues) if you run into
|
49
|
-
// any problem with runtime instance coexistence.
|
50
|
-
//
|
51
|
-
// ```cpp
|
52
|
-
// // Create a Taichi Runtime on Vulkan device at index 0.
|
53
|
-
// TiRuntime runtime = ti_create_runtime(TI_ARCH_VULKAN, 0);
|
54
|
-
// ```
|
55
|
-
//
|
56
|
-
// When your program runs to the end, ensure that:
|
57
|
-
// - You destroy the runtime instance,
|
58
|
-
// - All related resources are destroyed before the
|
59
|
-
// [`TiRuntime`](#handle-tiruntime) itself.
|
60
|
-
//
|
61
|
-
// ```cpp
|
62
|
-
// ti_destroy_runtime(runtime);
|
63
|
-
// ```
|
64
|
-
//
|
65
|
-
// ### Allocate and free memory
|
66
|
-
//
|
67
|
-
// Allocate a piece of memory that is visible only to the device. On the GPU
|
68
|
-
// backends, it usually means that the memory is located in the graphics memory
|
69
|
-
// (GRAM).
|
70
|
-
//
|
71
|
-
// ```cpp
|
72
|
-
// TiMemoryAllocateInfo mai {};
|
73
|
-
// mai.size = 1024; // Size in bytes.
|
74
|
-
// mai.usage = TI_MEMORY_USAGE_STORAGE_BIT;
|
75
|
-
// TiMemory memory = ti_allocate_memory(runtime, &mai);
|
76
|
-
// ```
|
77
|
-
//
|
78
|
-
// Allocated memory is automatically freed when the related
|
79
|
-
// [`TiRuntime`](#handle-tiruntime) is destroyed. You can also manually free the
|
80
|
-
// allocated memory.
|
81
|
-
//
|
82
|
-
// ```cpp
|
83
|
-
// ti_free_memory(runtime, memory);
|
84
|
-
// ```
|
85
|
-
//
|
86
|
-
// ### Allocate host-accessible memory
|
87
|
-
//
|
88
|
-
// By default, memory allocations are physically or conceptually local to the
|
89
|
-
// offload target for performance reasons. You can configure the
|
90
|
-
// [`TiMemoryAllocateInfo`](#structure-timemoryallocateinfo) to enable host
|
91
|
-
// access to memory allocations. But please note that host-accessible
|
92
|
-
// allocations *may* slow down computation on GPU because of the limited bus
|
93
|
-
// bandwidth between the host memory and the device.
|
94
|
-
//
|
95
|
-
// You *must* set `host_write` to [`TI_TRUE`](#definition-ti_true) to allow
|
96
|
-
// zero-copy data streaming to the memory.
|
97
|
-
//
|
98
|
-
// ```cpp
|
99
|
-
// TiMemoryAllocateInfo mai {};
|
100
|
-
// mai.size = 1024; // Size in bytes.
|
101
|
-
// mai.host_write = TI_TRUE;
|
102
|
-
// mai.usage = TI_MEMORY_USAGE_STORAGE_BIT;
|
103
|
-
// TiMemory steaming_memory = ti_allocate_memory(runtime, &mai);
|
104
|
-
//
|
105
|
-
// // ...
|
106
|
-
//
|
107
|
-
// std::vector<uint8_t> src = some_random_data_source();
|
108
|
-
//
|
109
|
-
// void* dst = ti_map_memory(runtime, steaming_memory);
|
110
|
-
// std::memcpy(dst, src.data(), src.size());
|
111
|
-
// ti_unmap_memory(runtime, streaming_memory);
|
112
|
-
// ```
|
113
|
-
//
|
114
|
-
// To read data back to the host, `host_read` *must* be set to
|
115
|
-
// [`TI_TRUE`](#definition-ti_true).
|
116
|
-
//
|
117
|
-
// ```cpp
|
118
|
-
// TiMemoryAllocateInfo mai {};
|
119
|
-
// mai.size = 1024; // Size in bytes.
|
120
|
-
// mai.host_read = TI_TRUE;
|
121
|
-
// mai.usage = TI_MEMORY_USAGE_STORAGE_BIT;
|
122
|
-
// TiMemory read_back_memory = ti_allocate_memory(runtime, &mai);
|
123
|
-
//
|
124
|
-
// // ...
|
125
|
-
//
|
126
|
-
// std::vector<uint8_t> dst(1024);
|
127
|
-
// void* src = ti_map_memory(runtime, read_back_memory);
|
128
|
-
// std::memcpy(dst.data(), src, dst.size());
|
129
|
-
// ti_unmap_memory(runtime, read_back_memory);
|
130
|
-
//
|
131
|
-
// ti_free_memory(runtime, read_back_memory);
|
132
|
-
// ```
|
133
|
-
//
|
134
|
-
// > You can set `host_read` and `host_write` at the same time.
|
135
|
-
//
|
136
|
-
// ### Load and destroy a Taichi AOT module
|
137
|
-
//
|
138
|
-
// You can load a Taichi AOT module from the filesystem.
|
139
|
-
//
|
140
|
-
// ```cpp
|
141
|
-
// TiAotModule aot_module = ti_load_aot_module(runtime, "/path/to/aot/module");
|
142
|
-
// ```
|
143
|
-
//
|
144
|
-
// `/path/to/aot/module` should point to the directory that contains a
|
145
|
-
// `metadata.json`.
|
146
|
-
//
|
147
|
-
// You can destroy an unused AOT module, but please ensure that there is no
|
148
|
-
// kernel or compute graph related to it pending to
|
149
|
-
// [`ti_flush`](#function-ti_flush).
|
150
|
-
//
|
151
|
-
// ```cpp
|
152
|
-
// ti_destroy_aot_module(aot_module);
|
153
|
-
// ```
|
154
|
-
//
|
155
|
-
// ### Launch kernels and compute graphs
|
156
|
-
//
|
157
|
-
// You can extract kernels and compute graphs from an AOT module. Kernel and
|
158
|
-
// compute graphs are a part of the module, so you don't have to destroy them.
|
159
|
-
//
|
160
|
-
// ```cpp
|
161
|
-
// TiKernel kernel = ti_get_aot_module_kernel(aot_module, "foo");
|
162
|
-
// TiComputeGraph compute_graph = ti_get_aot_module_compute_graph(aot_module,
|
163
|
-
// "bar");
|
164
|
-
// ```
|
165
|
-
//
|
166
|
-
// You can launch a kernel with positional arguments. Please ensure the types,
|
167
|
-
// the sizes and the order matches the source code in Python.
|
168
|
-
//
|
169
|
-
// ```cpp
|
170
|
-
// TiNdArray ndarray{};
|
171
|
-
// ndarray.memory = get_some_memory();
|
172
|
-
// ndarray.shape.dim_count = 1;
|
173
|
-
// ndarray.shape.dims[0] = 16;
|
174
|
-
// ndarray.elem_shape.dim_count = 2;
|
175
|
-
// ndarray.elem_shape.dims[0] = 4;
|
176
|
-
// ndarray.elem_shape.dims[1] = 4;
|
177
|
-
// ndarray.elem_type = TI_DATA_TYPE_F32;
|
178
|
-
//
|
179
|
-
// std::array<TiArgument, 3> args{};
|
180
|
-
//
|
181
|
-
// TiArgument& arg0 = args[0];
|
182
|
-
// arg0.type = TI_ARGUMENT_TYPE_I32;
|
183
|
-
// arg0.value.i32 = 123;
|
184
|
-
//
|
185
|
-
// TiArgument& arg1 = args[1];
|
186
|
-
// arg1.type = TI_ARGUMENT_TYPE_F32;
|
187
|
-
// arg1.value.f32 = 123.0f;
|
188
|
-
//
|
189
|
-
// TiArgument& arg2 = args[2];
|
190
|
-
// arg2.type = TI_ARGUMENT_TYPE_NDARRAY;
|
191
|
-
// arg2.value.ndarray = ndarray;
|
192
|
-
//
|
193
|
-
// ti_launch_kernel(runtime, kernel, args.size(), args.data());
|
194
|
-
// ```
|
195
|
-
//
|
196
|
-
// You can launch a compute graph in a similar way. But additionally please
|
197
|
-
// ensure the argument names matches those in the Python source.
|
198
|
-
//
|
199
|
-
// ```cpp
|
200
|
-
// std::array<TiNamedArgument, 3> named_args{};
|
201
|
-
// TiNamedArgument& named_arg0 = named_args[0];
|
202
|
-
// named_arg0.name = "foo";
|
203
|
-
// named_arg0.argument = args[0];
|
204
|
-
// TiNamedArgument& named_arg1 = named_args[1];
|
205
|
-
// named_arg1.name = "bar";
|
206
|
-
// named_arg1.argument = args[1];
|
207
|
-
// TiNamedArgument& named_arg2 = named_args[2];
|
208
|
-
// named_arg2.name = "baz";
|
209
|
-
// named_arg2.argument = args[2];
|
210
|
-
//
|
211
|
-
// ti_launch_compute_graph(runtime, compute_graph, named_args.size(),
|
212
|
-
// named_args.data());
|
213
|
-
// ```
|
214
|
-
//
|
215
|
-
// When you have launched all kernels and compute graphs for this batch, you
|
216
|
-
// should [`ti_flush`](#function-ti_flush) and [`ti_wait`](#function-ti_wait)
|
217
|
-
// for the execution to finish.
|
218
|
-
//
|
219
|
-
// ```cpp
|
220
|
-
// ti_flush(runtime);
|
221
|
-
// ti_wait(runtime);
|
222
|
-
// ```
|
223
|
-
//
|
224
|
-
// **WARNING** This part is subject to change. We will introduce multi-queue in
|
225
|
-
// the future.
|
226
|
-
//
|
227
|
-
#pragma once
|
228
|
-
|
229
|
-
#ifndef TI_C_API_VERSION
|
230
|
-
#define TI_C_API_VERSION 1007000
|
231
|
-
#endif // TI_C_API_VERSION
|
232
|
-
|
233
|
-
#ifndef TAICHI_H
|
234
|
-
#include "taichi.h"
|
235
|
-
#endif // TAICHI_H
|
236
|
-
|
237
|
-
#ifdef __cplusplus
|
238
|
-
extern "C" {
|
239
|
-
#endif // __cplusplus
|
240
|
-
|
241
|
-
// Alias `TiBool` (1.4.0)
|
242
|
-
//
|
243
|
-
// A boolean value. Can be either [`TI_TRUE`](#definition-ti_true) or
|
244
|
-
// [`TI_FALSE`](#definition-ti_false). Assignment with other values could lead
|
245
|
-
// to undefined behavior.
|
246
|
-
typedef uint32_t TiBool;
|
247
|
-
|
248
|
-
// Definition `TI_FALSE` (1.4.0)
|
249
|
-
//
|
250
|
-
// A condition or a predicate is not satisfied; a statement is invalid.
|
251
|
-
#define TI_FALSE 0
|
252
|
-
|
253
|
-
// Definition `TI_TRUE` (1.4.0)
|
254
|
-
//
|
255
|
-
// A condition or a predicate is satisfied; a statement is valid.
|
256
|
-
#define TI_TRUE 1
|
257
|
-
|
258
|
-
// Alias `TiFlags` (1.4.0)
|
259
|
-
//
|
260
|
-
// A bit field that can be used to represent 32 orthogonal flags. Bits
|
261
|
-
// unspecified in the corresponding flag enum are ignored.
|
262
|
-
//
|
263
|
-
// > Enumerations and bit-field flags in the C-API have a `TI_XXX_MAX_ENUM` case
|
264
|
-
// to ensure the enum has a 32-bit range and in-memory size. It has no
|
265
|
-
// semantical impact and can be safely ignored.
|
266
|
-
typedef uint32_t TiFlags;
|
267
|
-
|
268
|
-
// Definition `TI_NULL_HANDLE` (1.4.0)
|
269
|
-
//
|
270
|
-
// A sentinal invalid handle that will never be produced from a valid call to
|
271
|
-
// Taichi C-API.
|
272
|
-
#define TI_NULL_HANDLE 0
|
273
|
-
|
274
|
-
// Handle `TiRuntime` (1.4.0)
|
275
|
-
//
|
276
|
-
// Taichi runtime represents an instance of a logical backend and its internal
|
277
|
-
// dynamic state. The user is responsible to synchronize any use of
|
278
|
-
// [`TiRuntime`](#handle-tiruntime). The user *must not* manipulate multiple
|
279
|
-
// [`TiRuntime`](#handle-tiruntime)s in the same thread.
|
280
|
-
typedef struct TiRuntime_t *TiRuntime;
|
281
|
-
|
282
|
-
// Handle `TiAotModule` (1.4.0)
|
283
|
-
//
|
284
|
-
// An ahead-of-time (AOT) compiled Taichi module, which contains a collection of
|
285
|
-
// kernels and compute graphs.
|
286
|
-
typedef struct TiAotModule_t *TiAotModule;
|
287
|
-
|
288
|
-
// Handle `TiMemory` (1.4.0)
|
289
|
-
//
|
290
|
-
// A contiguous allocation of device memory.
|
291
|
-
typedef struct TiMemory_t *TiMemory;
|
292
|
-
|
293
|
-
// Handle `TiImage` (1.4.0)
|
294
|
-
//
|
295
|
-
// A contiguous allocation of device image.
|
296
|
-
typedef struct TiImage_t *TiImage;
|
297
|
-
|
298
|
-
// Handle `TiSampler`
|
299
|
-
//
|
300
|
-
// An image sampler. [`TI_NULL_HANDLE`](#definition-ti_null_handle) represents a
|
301
|
-
// default image sampler provided by the runtime implementation. The filter
|
302
|
-
// modes and address modes of default samplers depend on backend implementation.
|
303
|
-
typedef struct TiSampler_t *TiSampler;
|
304
|
-
|
305
|
-
// Handle `TiKernel` (1.4.0)
|
306
|
-
//
|
307
|
-
// A Taichi kernel that can be launched on the offload target for execution.
|
308
|
-
typedef struct TiKernel_t *TiKernel;
|
309
|
-
|
310
|
-
// Handle `TiComputeGraph` (1.4.0)
|
311
|
-
//
|
312
|
-
// A collection of Taichi kernels (a compute graph) to launch on the offload
|
313
|
-
// target in a predefined order.
|
314
|
-
typedef struct TiComputeGraph_t *TiComputeGraph;
|
315
|
-
|
316
|
-
// Enumeration `TiError` (1.4.0)
|
317
|
-
//
|
318
|
-
// Errors reported by the Taichi C-API.
|
319
|
-
typedef enum TiError {
|
320
|
-
// The Taichi C-API invocation finished gracefully.
|
321
|
-
TI_ERROR_SUCCESS = 0,
|
322
|
-
// The invoked API, or the combination of parameters is not supported by the
|
323
|
-
// Taichi C-API.
|
324
|
-
TI_ERROR_NOT_SUPPORTED = -1,
|
325
|
-
// Provided data is corrupted.
|
326
|
-
TI_ERROR_CORRUPTED_DATA = -2,
|
327
|
-
// Provided name does not refer to any existing item.
|
328
|
-
TI_ERROR_NAME_NOT_FOUND = -3,
|
329
|
-
// One or more function arguments violate constraints specified in C-API
|
330
|
-
// documents, or kernel arguments mismatch the kernel argument list defined in
|
331
|
-
// the AOT module.
|
332
|
-
TI_ERROR_INVALID_ARGUMENT = -4,
|
333
|
-
// One or more by-reference (pointer) function arguments point to null.
|
334
|
-
TI_ERROR_ARGUMENT_NULL = -5,
|
335
|
-
// One or more function arguments are out of its acceptable range; or
|
336
|
-
// enumeration arguments have undefined value.
|
337
|
-
TI_ERROR_ARGUMENT_OUT_OF_RANGE = -6,
|
338
|
-
// One or more kernel arguments are missing.
|
339
|
-
TI_ERROR_ARGUMENT_NOT_FOUND = -7,
|
340
|
-
// The intended interoperation is not possible on the current arch. For
|
341
|
-
// example, attempts to export a Vulkan object from a CUDA runtime are not
|
342
|
-
// allowed.
|
343
|
-
TI_ERROR_INVALID_INTEROP = -8,
|
344
|
-
// The Taichi C-API enters an unrecoverable invalid state. Related Taichi
|
345
|
-
// objects are potentially corrupted. The users *should* release the
|
346
|
-
// contaminated resources for stability. Please feel free to file an issue if
|
347
|
-
// you encountered this error in a normal routine.
|
348
|
-
TI_ERROR_INVALID_STATE = -9,
|
349
|
-
// The AOT module is not compatible with the current runtime.
|
350
|
-
TI_ERROR_INCOMPATIBLE_MODULE = -10,
|
351
|
-
TI_ERROR_OUT_OF_MEMORY = -11,
|
352
|
-
TI_ERROR_MAX_ENUM = 0xffffffff,
|
353
|
-
} TiError;
|
354
|
-
|
355
|
-
// Enumeration `TiArch` (1.4.0)
|
356
|
-
//
|
357
|
-
// Types of backend archs.
|
358
|
-
typedef enum TiArch {
|
359
|
-
TI_ARCH_RESERVED = 0,
|
360
|
-
// Vulkan GPU backend.
|
361
|
-
TI_ARCH_VULKAN = 1,
|
362
|
-
// Metal GPU backend.
|
363
|
-
TI_ARCH_METAL = 2,
|
364
|
-
// NVIDIA CUDA GPU backend.
|
365
|
-
TI_ARCH_CUDA = 3,
|
366
|
-
// x64 native CPU backend.
|
367
|
-
TI_ARCH_X64 = 4,
|
368
|
-
// Arm64 native CPU backend.
|
369
|
-
TI_ARCH_ARM64 = 5,
|
370
|
-
// OpenGL GPU backend.
|
371
|
-
TI_ARCH_OPENGL = 6,
|
372
|
-
// OpenGL ES GPU backend.
|
373
|
-
TI_ARCH_GLES = 7,
|
374
|
-
TI_ARCH_MAX_ENUM = 0xffffffff,
|
375
|
-
} TiArch;
|
376
|
-
|
377
|
-
// Enumeration `TiCapability` (1.4.0)
|
378
|
-
//
|
379
|
-
// Device capabilities.
|
380
|
-
typedef enum TiCapability {
|
381
|
-
TI_CAPABILITY_RESERVED = 0,
|
382
|
-
TI_CAPABILITY_SPIRV_VERSION = 1,
|
383
|
-
TI_CAPABILITY_SPIRV_HAS_INT8 = 2,
|
384
|
-
TI_CAPABILITY_SPIRV_HAS_INT16 = 3,
|
385
|
-
TI_CAPABILITY_SPIRV_HAS_INT64 = 4,
|
386
|
-
TI_CAPABILITY_SPIRV_HAS_FLOAT16 = 5,
|
387
|
-
TI_CAPABILITY_SPIRV_HAS_FLOAT64 = 6,
|
388
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_INT64 = 7,
|
389
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT16 = 8,
|
390
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT16_ADD = 9,
|
391
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT16_MINMAX = 10,
|
392
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT = 11,
|
393
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT_ADD = 12,
|
394
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT_MINMAX = 13,
|
395
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT64 = 14,
|
396
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT64_ADD = 15,
|
397
|
-
TI_CAPABILITY_SPIRV_HAS_ATOMIC_FLOAT64_MINMAX = 16,
|
398
|
-
TI_CAPABILITY_SPIRV_HAS_VARIABLE_PTR = 17,
|
399
|
-
TI_CAPABILITY_SPIRV_HAS_PHYSICAL_STORAGE_BUFFER = 18,
|
400
|
-
TI_CAPABILITY_SPIRV_HAS_SUBGROUP_BASIC = 19,
|
401
|
-
TI_CAPABILITY_SPIRV_HAS_SUBGROUP_VOTE = 20,
|
402
|
-
TI_CAPABILITY_SPIRV_HAS_SUBGROUP_ARITHMETIC = 21,
|
403
|
-
TI_CAPABILITY_SPIRV_HAS_SUBGROUP_BALLOT = 22,
|
404
|
-
TI_CAPABILITY_SPIRV_HAS_NON_SEMANTIC_INFO = 23,
|
405
|
-
TI_CAPABILITY_SPIRV_HAS_NO_INTEGER_WRAP_DECORATION = 24,
|
406
|
-
TI_CAPABILITY_MAX_ENUM = 0xffffffff,
|
407
|
-
} TiCapability;
|
408
|
-
|
409
|
-
// Structure `TiCapabilityLevelInfo` (1.4.0)
|
410
|
-
//
|
411
|
-
// An integral device capability level. It currently is not guaranteed that a
|
412
|
-
// higher level value is compatible with a lower level value.
|
413
|
-
typedef struct TiCapabilityLevelInfo {
|
414
|
-
TiCapability capability;
|
415
|
-
uint32_t level;
|
416
|
-
} TiCapabilityLevelInfo;
|
417
|
-
|
418
|
-
// Enumeration `TiDataType` (1.4.0)
|
419
|
-
//
|
420
|
-
// Elementary (primitive) data types. There might be vendor-specific constraints
|
421
|
-
// on the available data types so it's recommended to use 32-bit data types if
|
422
|
-
// multi-platform distribution is desired.
|
423
|
-
typedef enum TiDataType {
|
424
|
-
// 16-bit IEEE 754 half-precision floating-point number.
|
425
|
-
TI_DATA_TYPE_F16 = 0,
|
426
|
-
// 32-bit IEEE 754 single-precision floating-point number.
|
427
|
-
TI_DATA_TYPE_F32 = 1,
|
428
|
-
// 64-bit IEEE 754 double-precision floating-point number.
|
429
|
-
TI_DATA_TYPE_F64 = 2,
|
430
|
-
// 8-bit one's complement signed integer.
|
431
|
-
TI_DATA_TYPE_I8 = 3,
|
432
|
-
// 16-bit one's complement signed integer.
|
433
|
-
TI_DATA_TYPE_I16 = 4,
|
434
|
-
// 32-bit one's complement signed integer.
|
435
|
-
TI_DATA_TYPE_I32 = 5,
|
436
|
-
// 64-bit one's complement signed integer.
|
437
|
-
TI_DATA_TYPE_I64 = 6,
|
438
|
-
TI_DATA_TYPE_U1 = 7,
|
439
|
-
// 8-bit unsigned integer.
|
440
|
-
TI_DATA_TYPE_U8 = 8,
|
441
|
-
// 16-bit unsigned integer.
|
442
|
-
TI_DATA_TYPE_U16 = 9,
|
443
|
-
// 32-bit unsigned integer.
|
444
|
-
TI_DATA_TYPE_U32 = 10,
|
445
|
-
// 64-bit unsigned integer.
|
446
|
-
TI_DATA_TYPE_U64 = 11,
|
447
|
-
TI_DATA_TYPE_GEN = 12,
|
448
|
-
TI_DATA_TYPE_UNKNOWN = 13,
|
449
|
-
TI_DATA_TYPE_MAX_ENUM = 0xffffffff,
|
450
|
-
} TiDataType;
|
451
|
-
|
452
|
-
// Enumeration `TiArgumentType` (1.4.0)
|
453
|
-
//
|
454
|
-
// Types of kernel and compute graph argument.
|
455
|
-
typedef enum TiArgumentType {
|
456
|
-
// 32-bit one's complement signed integer.
|
457
|
-
TI_ARGUMENT_TYPE_I32 = 0,
|
458
|
-
// 32-bit IEEE 754 single-precision floating-point number.
|
459
|
-
TI_ARGUMENT_TYPE_F32 = 1,
|
460
|
-
// ND-array wrapped around a `handle.memory`.
|
461
|
-
TI_ARGUMENT_TYPE_NDARRAY = 2,
|
462
|
-
// Texture wrapped around a `handle.image`.
|
463
|
-
TI_ARGUMENT_TYPE_TEXTURE = 3,
|
464
|
-
// Typed scalar.
|
465
|
-
TI_ARGUMENT_TYPE_SCALAR = 4,
|
466
|
-
// Typed tensor.
|
467
|
-
TI_ARGUMENT_TYPE_TENSOR = 5,
|
468
|
-
TI_ARGUMENT_TYPE_MAX_ENUM = 0xffffffff,
|
469
|
-
} TiArgumentType;
|
470
|
-
|
471
|
-
// BitField `TiMemoryUsageFlags` (1.4.0)
|
472
|
-
//
|
473
|
-
// Usages of a memory allocation. Taichi requires kernel argument memories to be
|
474
|
-
// allocated with `TI_MEMORY_USAGE_STORAGE_BIT`.
|
475
|
-
typedef enum TiMemoryUsageFlagBits {
|
476
|
-
// The memory can be read/write accessed by any kernel.
|
477
|
-
TI_MEMORY_USAGE_STORAGE_BIT = 1 << 0,
|
478
|
-
// The memory can be used as a uniform buffer in graphics pipelines.
|
479
|
-
TI_MEMORY_USAGE_UNIFORM_BIT = 1 << 1,
|
480
|
-
// The memory can be used as a vertex buffer in graphics pipelines.
|
481
|
-
TI_MEMORY_USAGE_VERTEX_BIT = 1 << 2,
|
482
|
-
// The memory can be used as an index buffer in graphics pipelines.
|
483
|
-
TI_MEMORY_USAGE_INDEX_BIT = 1 << 3,
|
484
|
-
} TiMemoryUsageFlagBits;
|
485
|
-
typedef TiFlags TiMemoryUsageFlags;
|
486
|
-
|
487
|
-
// Structure `TiMemoryAllocateInfo` (1.4.0)
|
488
|
-
//
|
489
|
-
// Parameters of a newly allocated memory.
|
490
|
-
typedef struct TiMemoryAllocateInfo {
|
491
|
-
// Size of the allocation in bytes.
|
492
|
-
uint64_t size;
|
493
|
-
// True if the host needs to write to the allocated memory.
|
494
|
-
TiBool host_write;
|
495
|
-
// True if the host needs to read from the allocated memory.
|
496
|
-
TiBool host_read;
|
497
|
-
// True if the memory allocation needs to be exported to other backends (e.g.,
|
498
|
-
// from Vulkan to CUDA).
|
499
|
-
TiBool export_sharing;
|
500
|
-
// All possible usage of this memory allocation. In most cases,
|
501
|
-
// `bit_field.memory_usage.storage` is enough.
|
502
|
-
TiMemoryUsageFlags usage;
|
503
|
-
} TiMemoryAllocateInfo;
|
504
|
-
|
505
|
-
// Structure `TiMemorySlice` (1.4.0)
|
506
|
-
//
|
507
|
-
// A subsection of a memory allocation. The sum of `offset` and `size` cannot
|
508
|
-
// exceed the size of `memory`.
|
509
|
-
typedef struct TiMemorySlice {
|
510
|
-
// The subsectioned memory allocation.
|
511
|
-
TiMemory memory;
|
512
|
-
// Offset from the beginning of the allocation.
|
513
|
-
uint64_t offset;
|
514
|
-
// Size of the subsection.
|
515
|
-
uint64_t size;
|
516
|
-
} TiMemorySlice;
|
517
|
-
|
518
|
-
// Structure `TiNdShape` (1.4.0)
|
519
|
-
//
|
520
|
-
// Multi-dimensional size of an ND-array. Dimension sizes after `dim_count` are
|
521
|
-
// ignored.
|
522
|
-
typedef struct TiNdShape {
|
523
|
-
// Number of dimensions.
|
524
|
-
uint32_t dim_count;
|
525
|
-
// Dimension sizes.
|
526
|
-
uint32_t dims[16];
|
527
|
-
} TiNdShape;
|
528
|
-
|
529
|
-
// Structure `TiNdArray` (1.4.0)
|
530
|
-
//
|
531
|
-
// Multi-dimensional array of dense primitive data.
|
532
|
-
typedef struct TiNdArray {
|
533
|
-
// Memory bound to the ND-array.
|
534
|
-
TiMemory memory;
|
535
|
-
// Shape of the ND-array.
|
536
|
-
TiNdShape shape;
|
537
|
-
// Shape of the ND-array elements. It *must not* be empty for vector or matrix
|
538
|
-
// ND-arrays.
|
539
|
-
TiNdShape elem_shape;
|
540
|
-
// Primitive data type of the ND-array elements.
|
541
|
-
TiDataType elem_type;
|
542
|
-
} TiNdArray;
|
543
|
-
|
544
|
-
// BitField `TiImageUsageFlags` (1.4.0)
|
545
|
-
//
|
546
|
-
// Usages of an image allocation. Taichi requires kernel argument images to be
|
547
|
-
// allocated with `TI_IMAGE_USAGE_STORAGE_BIT` and `TI_IMAGE_USAGE_SAMPLED_BIT`.
|
548
|
-
typedef enum TiImageUsageFlagBits {
|
549
|
-
// The image can be read/write accessed by any kernel.
|
550
|
-
TI_IMAGE_USAGE_STORAGE_BIT = 1 << 0,
|
551
|
-
// The image can be read-only accessed by any kernel.
|
552
|
-
TI_IMAGE_USAGE_SAMPLED_BIT = 1 << 1,
|
553
|
-
// The image can be used as a color or depth-stencil attachment depending on
|
554
|
-
// its format.
|
555
|
-
TI_IMAGE_USAGE_ATTACHMENT_BIT = 1 << 2,
|
556
|
-
} TiImageUsageFlagBits;
|
557
|
-
typedef TiFlags TiImageUsageFlags;
|
558
|
-
|
559
|
-
// Enumeration `TiImageDimension` (1.4.0)
|
560
|
-
//
|
561
|
-
// Dimensions of an image allocation.
|
562
|
-
typedef enum TiImageDimension {
|
563
|
-
// The image is 1-dimensional.
|
564
|
-
TI_IMAGE_DIMENSION_1D = 0,
|
565
|
-
// The image is 2-dimensional.
|
566
|
-
TI_IMAGE_DIMENSION_2D = 1,
|
567
|
-
// The image is 3-dimensional.
|
568
|
-
TI_IMAGE_DIMENSION_3D = 2,
|
569
|
-
// The image is 1-dimensional and it has one or more layers.
|
570
|
-
TI_IMAGE_DIMENSION_1D_ARRAY = 3,
|
571
|
-
// The image is 2-dimensional and it has one or more layers.
|
572
|
-
TI_IMAGE_DIMENSION_2D_ARRAY = 4,
|
573
|
-
// The image is 2-dimensional and it has 6 layers for the faces towards +X,
|
574
|
-
// -X, +Y, -Y, +Z, -Z in sequence.
|
575
|
-
TI_IMAGE_DIMENSION_CUBE = 5,
|
576
|
-
TI_IMAGE_DIMENSION_MAX_ENUM = 0xffffffff,
|
577
|
-
} TiImageDimension;
|
578
|
-
|
579
|
-
// Enumeration `TiImageLayout` (1.4.0)
|
580
|
-
typedef enum TiImageLayout {
|
581
|
-
// Undefined layout. An image in this layout does not contain any semantical
|
582
|
-
// information.
|
583
|
-
TI_IMAGE_LAYOUT_UNDEFINED = 0,
|
584
|
-
// Optimal layout for read-only access, including sampling.
|
585
|
-
TI_IMAGE_LAYOUT_SHADER_READ = 1,
|
586
|
-
// Optimal layout for write-only access.
|
587
|
-
TI_IMAGE_LAYOUT_SHADER_WRITE = 2,
|
588
|
-
// Optimal layout for read/write access.
|
589
|
-
TI_IMAGE_LAYOUT_SHADER_READ_WRITE = 3,
|
590
|
-
// Optimal layout as a color attachment.
|
591
|
-
TI_IMAGE_LAYOUT_COLOR_ATTACHMENT = 4,
|
592
|
-
// Optimal layout as an input color attachment.
|
593
|
-
TI_IMAGE_LAYOUT_COLOR_ATTACHMENT_READ = 5,
|
594
|
-
// Optimal layout as a depth attachment.
|
595
|
-
TI_IMAGE_LAYOUT_DEPTH_ATTACHMENT = 6,
|
596
|
-
// Optimal layout as an input depth attachment.
|
597
|
-
TI_IMAGE_LAYOUT_DEPTH_ATTACHMENT_READ = 7,
|
598
|
-
// Optimal layout as a data copy destination.
|
599
|
-
TI_IMAGE_LAYOUT_TRANSFER_DST = 8,
|
600
|
-
// Optimal layout as a data copy source.
|
601
|
-
TI_IMAGE_LAYOUT_TRANSFER_SRC = 9,
|
602
|
-
// Optimal layout as a presentation source.
|
603
|
-
TI_IMAGE_LAYOUT_PRESENT_SRC = 10,
|
604
|
-
TI_IMAGE_LAYOUT_MAX_ENUM = 0xffffffff,
|
605
|
-
} TiImageLayout;
|
606
|
-
|
607
|
-
// Enumeration `TiFormat` (1.4.0)
|
608
|
-
//
|
609
|
-
// Texture formats. The availability of texture formats depends on runtime
|
610
|
-
// support.
|
611
|
-
typedef enum TiFormat {
|
612
|
-
TI_FORMAT_UNKNOWN = 0,
|
613
|
-
TI_FORMAT_R8 = 1,
|
614
|
-
TI_FORMAT_RG8 = 2,
|
615
|
-
TI_FORMAT_RGBA8 = 3,
|
616
|
-
TI_FORMAT_RGBA8SRGB = 4,
|
617
|
-
TI_FORMAT_BGRA8 = 5,
|
618
|
-
TI_FORMAT_BGRA8SRGB = 6,
|
619
|
-
TI_FORMAT_R8U = 7,
|
620
|
-
TI_FORMAT_RG8U = 8,
|
621
|
-
TI_FORMAT_RGBA8U = 9,
|
622
|
-
TI_FORMAT_R8I = 10,
|
623
|
-
TI_FORMAT_RG8I = 11,
|
624
|
-
TI_FORMAT_RGBA8I = 12,
|
625
|
-
TI_FORMAT_R16 = 13,
|
626
|
-
TI_FORMAT_RG16 = 14,
|
627
|
-
TI_FORMAT_RGB16 = 15,
|
628
|
-
TI_FORMAT_RGBA16 = 16,
|
629
|
-
TI_FORMAT_R16U = 17,
|
630
|
-
TI_FORMAT_RG16U = 18,
|
631
|
-
TI_FORMAT_RGB16U = 19,
|
632
|
-
TI_FORMAT_RGBA16U = 20,
|
633
|
-
TI_FORMAT_R16I = 21,
|
634
|
-
TI_FORMAT_RG16I = 22,
|
635
|
-
TI_FORMAT_RGB16I = 23,
|
636
|
-
TI_FORMAT_RGBA16I = 24,
|
637
|
-
TI_FORMAT_R16F = 25,
|
638
|
-
TI_FORMAT_RG16F = 26,
|
639
|
-
TI_FORMAT_RGB16F = 27,
|
640
|
-
TI_FORMAT_RGBA16F = 28,
|
641
|
-
TI_FORMAT_R32U = 29,
|
642
|
-
TI_FORMAT_RG32U = 30,
|
643
|
-
TI_FORMAT_RGB32U = 31,
|
644
|
-
TI_FORMAT_RGBA32U = 32,
|
645
|
-
TI_FORMAT_R32I = 33,
|
646
|
-
TI_FORMAT_RG32I = 34,
|
647
|
-
TI_FORMAT_RGB32I = 35,
|
648
|
-
TI_FORMAT_RGBA32I = 36,
|
649
|
-
TI_FORMAT_R32F = 37,
|
650
|
-
TI_FORMAT_RG32F = 38,
|
651
|
-
TI_FORMAT_RGB32F = 39,
|
652
|
-
TI_FORMAT_RGBA32F = 40,
|
653
|
-
TI_FORMAT_DEPTH16 = 41,
|
654
|
-
TI_FORMAT_DEPTH24STENCIL8 = 42,
|
655
|
-
TI_FORMAT_DEPTH32F = 43,
|
656
|
-
TI_FORMAT_MAX_ENUM = 0xffffffff,
|
657
|
-
} TiFormat;
|
658
|
-
|
659
|
-
// Structure `TiImageOffset` (1.4.0)
|
660
|
-
//
|
661
|
-
// Offsets of an image in X, Y, Z, and array layers.
|
662
|
-
typedef struct TiImageOffset {
|
663
|
-
// Image offset in the X direction.
|
664
|
-
uint32_t x;
|
665
|
-
// Image offset in the Y direction. *Must* be 0 if the image has a dimension
|
666
|
-
// of `enumeration.image_dimension.1d` or
|
667
|
-
// `enumeration.image_dimension.1d_array`.
|
668
|
-
uint32_t y;
|
669
|
-
// Image offset in the Z direction. *Must* be 0 if the image has a dimension
|
670
|
-
// of `enumeration.image_dimension.1d`, `enumeration.image_dimension.2d`,
|
671
|
-
// `enumeration.image_dimension.1d_array`,
|
672
|
-
// `enumeration.image_dimension.2d_array` or
|
673
|
-
// `enumeration.image_dimension.cube_array`.
|
674
|
-
uint32_t z;
|
675
|
-
// Image offset in array layers. *Must* be 0 if the image has a dimension of
|
676
|
-
// `enumeration.image_dimension.1d`, `enumeration.image_dimension.2d` or
|
677
|
-
// `enumeration.image_dimension.3d`.
|
678
|
-
uint32_t array_layer_offset;
|
679
|
-
} TiImageOffset;
|
680
|
-
|
681
|
-
// Structure `TiImageExtent` (1.4.0)
|
682
|
-
//
|
683
|
-
// Extents of an image in X, Y, Z, and array layers.
|
684
|
-
typedef struct TiImageExtent {
|
685
|
-
// Image extent in the X direction.
|
686
|
-
uint32_t width;
|
687
|
-
// Image extent in the Y direction. *Must* be 1 if the image has a dimension
|
688
|
-
// of `enumeration.image_dimension.1d` or
|
689
|
-
// `enumeration.image_dimension.1d_array`.
|
690
|
-
uint32_t height;
|
691
|
-
// Image extent in the Z direction. *Must* be 1 if the image has a dimension
|
692
|
-
// of `enumeration.image_dimension.1d`, `enumeration.image_dimension.2d`,
|
693
|
-
// `enumeration.image_dimension.1d_array`,
|
694
|
-
// `enumeration.image_dimension.2d_array` or
|
695
|
-
// `enumeration.image_dimension.cube_array`.
|
696
|
-
uint32_t depth;
|
697
|
-
// Image extent in array layers. *Must* be 1 if the image has a dimension of
|
698
|
-
// `enumeration.image_dimension.1d`, `enumeration.image_dimension.2d` or
|
699
|
-
// `enumeration.image_dimension.3d`. *Must* be 6 if the image has a dimension
|
700
|
-
// of `enumeration.image_dimension.cube_array`.
|
701
|
-
uint32_t array_layer_count;
|
702
|
-
} TiImageExtent;
|
703
|
-
|
704
|
-
// Structure `TiImageAllocateInfo` (1.4.0)
|
705
|
-
//
|
706
|
-
// Parameters of a newly allocated image.
|
707
|
-
typedef struct TiImageAllocateInfo {
|
708
|
-
// Image dimension.
|
709
|
-
TiImageDimension dimension;
|
710
|
-
// Image extent.
|
711
|
-
TiImageExtent extent;
|
712
|
-
// Number of mip-levels.
|
713
|
-
uint32_t mip_level_count;
|
714
|
-
// Image texel format.
|
715
|
-
TiFormat format;
|
716
|
-
// True if the memory allocation needs to be exported to other backends (e.g.,
|
717
|
-
// from Vulkan to CUDA).
|
718
|
-
TiBool export_sharing;
|
719
|
-
// All possible usages of this image allocation. In most cases,
|
720
|
-
// `bit_field.image_usage.storage` and `bit_field.image_usage.sampled` enough.
|
721
|
-
TiImageUsageFlags usage;
|
722
|
-
} TiImageAllocateInfo;
|
723
|
-
|
724
|
-
// Structure `TiImageSlice` (1.4.0)
|
725
|
-
//
|
726
|
-
// A subsection of a memory allocation. The sum of `offset` and `extent` in each
|
727
|
-
// dimension cannot exceed the size of `image`.
|
728
|
-
typedef struct TiImageSlice {
|
729
|
-
// The subsectioned image allocation.
|
730
|
-
TiImage image;
|
731
|
-
// Offset from the beginning of the allocation in each dimension.
|
732
|
-
TiImageOffset offset;
|
733
|
-
// Size of the subsection in each dimension.
|
734
|
-
TiImageExtent extent;
|
735
|
-
// The subsectioned mip-level.
|
736
|
-
uint32_t mip_level;
|
737
|
-
} TiImageSlice;
|
738
|
-
|
739
|
-
// Enumeration `TiFilter`
|
740
|
-
typedef enum TiFilter {
|
741
|
-
TI_FILTER_NEAREST = 0,
|
742
|
-
TI_FILTER_LINEAR = 1,
|
743
|
-
TI_FILTER_MAX_ENUM = 0xffffffff,
|
744
|
-
} TiFilter;
|
745
|
-
|
746
|
-
// Enumeration `TiAddressMode`
|
747
|
-
typedef enum TiAddressMode {
|
748
|
-
TI_ADDRESS_MODE_REPEAT = 0,
|
749
|
-
TI_ADDRESS_MODE_MIRRORED_REPEAT = 1,
|
750
|
-
TI_ADDRESS_MODE_CLAMP_TO_EDGE = 2,
|
751
|
-
TI_ADDRESS_MODE_MAX_ENUM = 0xffffffff,
|
752
|
-
} TiAddressMode;
|
753
|
-
|
754
|
-
// Structure `TiSamplerCreateInfo`
|
755
|
-
typedef struct TiSamplerCreateInfo {
|
756
|
-
TiFilter mag_filter;
|
757
|
-
TiFilter min_filter;
|
758
|
-
TiAddressMode address_mode;
|
759
|
-
float max_anisotropy;
|
760
|
-
} TiSamplerCreateInfo;
|
761
|
-
|
762
|
-
// Structure `TiTexture` (1.4.0)
|
763
|
-
//
|
764
|
-
// Image data bound to a sampler.
|
765
|
-
typedef struct TiTexture {
|
766
|
-
// Image bound to the texture.
|
767
|
-
TiImage image;
|
768
|
-
// The bound sampler that controls the sampling behavior of
|
769
|
-
// `structure.texture.image`.
|
770
|
-
TiSampler sampler;
|
771
|
-
// Image Dimension.
|
772
|
-
TiImageDimension dimension;
|
773
|
-
// Image extent.
|
774
|
-
TiImageExtent extent;
|
775
|
-
// Image texel format.
|
776
|
-
TiFormat format;
|
777
|
-
} TiTexture;
|
778
|
-
|
779
|
-
// Union `TiScalarValue` (1.5.0)
|
780
|
-
//
|
781
|
-
// Scalar value represented by a power-of-two number of bits.
|
782
|
-
//
|
783
|
-
// **NOTE** The unsigned integer types merely hold the number of bits in memory
|
784
|
-
// and doesn't reflect any type of the underlying data. For example, a 32-bit
|
785
|
-
// floating-point scalar value is assigned by `*(float*)&scalar_value.x32 =
|
786
|
-
// 0.0f`; a 16-bit signed integer is assigned by `*(int16_t)&scalar_vaue.x16 =
|
787
|
-
// 1`. The actual type of the scalar is hinted via `type`.
|
788
|
-
typedef union TiScalarValue {
|
789
|
-
// Scalar value that fits into 8 bits.
|
790
|
-
uint8_t x8;
|
791
|
-
// Scalar value that fits into 16 bits.
|
792
|
-
uint16_t x16;
|
793
|
-
// Scalar value that fits into 32 bits.
|
794
|
-
uint32_t x32;
|
795
|
-
// Scalar value that fits into 64 bits.
|
796
|
-
uint64_t x64;
|
797
|
-
} TiScalarValue;
|
798
|
-
|
799
|
-
// Structure `TiScalar` (1.5.0)
|
800
|
-
//
|
801
|
-
// A typed scalar value.
|
802
|
-
typedef struct TiScalar {
|
803
|
-
TiDataType type;
|
804
|
-
TiScalarValue value;
|
805
|
-
} TiScalar;
|
806
|
-
|
807
|
-
// Union `TiTensorValue`
|
808
|
-
//
|
809
|
-
// Tensor value represented by a power-of-two number of bits.
|
810
|
-
typedef union TiTensorValue {
|
811
|
-
// Tensor value that fits into 8 bits.
|
812
|
-
uint8_t x8[128];
|
813
|
-
// Tensor value that fits into 16 bits.
|
814
|
-
uint16_t x16[64];
|
815
|
-
// Tensor value that fits into 32 bits.
|
816
|
-
uint32_t x32[32];
|
817
|
-
// Tensor value that fits into 64 bits.
|
818
|
-
uint64_t x64[16];
|
819
|
-
} TiTensorValue;
|
820
|
-
|
821
|
-
// Structure `TiTensorValueWithLength`
|
822
|
-
//
|
823
|
-
// A tensor value with a length.
|
824
|
-
typedef struct TiTensorValueWithLength {
|
825
|
-
uint32_t length;
|
826
|
-
TiTensorValue data;
|
827
|
-
} TiTensorValueWithLength;
|
828
|
-
|
829
|
-
// Structure `TiTensor`
|
830
|
-
//
|
831
|
-
// A typed tensor value.
|
832
|
-
typedef struct TiTensor {
|
833
|
-
TiDataType type;
|
834
|
-
TiTensorValueWithLength contents;
|
835
|
-
} TiTensor;
|
836
|
-
|
837
|
-
// Union `TiArgumentValue` (1.4.0)
|
838
|
-
//
|
839
|
-
// A scalar or structured argument value.
|
840
|
-
typedef union TiArgumentValue {
|
841
|
-
// Value of a 32-bit one's complement signed integer. This is equivalent to
|
842
|
-
// `union.scalar_value.x32` with `enumeration.data_type.i32`.
|
843
|
-
int32_t i32;
|
844
|
-
// Value of a 32-bit IEEE 754 single-precision floating-poing number. This is
|
845
|
-
// equivalent to `union.scalar_value.x32` with `enumeration.data_type.f32`.
|
846
|
-
float f32;
|
847
|
-
// An ND-array to be bound.
|
848
|
-
TiNdArray ndarray;
|
849
|
-
// A texture to be bound.
|
850
|
-
TiTexture texture;
|
851
|
-
// An scalar to be bound.
|
852
|
-
TiScalar scalar;
|
853
|
-
// A tensor to be bound.
|
854
|
-
TiTensor tensor;
|
855
|
-
} TiArgumentValue;
|
856
|
-
|
857
|
-
// Structure `TiArgument` (1.4.0)
|
858
|
-
//
|
859
|
-
// An argument value to feed kernels.
|
860
|
-
typedef struct TiArgument {
|
861
|
-
// Type of the argument.
|
862
|
-
TiArgumentType type;
|
863
|
-
// Value of the argument.
|
864
|
-
TiArgumentValue value;
|
865
|
-
} TiArgument;
|
866
|
-
|
867
|
-
// Structure `TiNamedArgument` (1.4.0)
|
868
|
-
//
|
869
|
-
// A named argument value to feed compute graphs.
|
870
|
-
typedef struct TiNamedArgument {
|
871
|
-
// Name of the argument.
|
872
|
-
const char *name;
|
873
|
-
// Argument body.
|
874
|
-
TiArgument argument;
|
875
|
-
} TiNamedArgument;
|
876
|
-
|
877
|
-
// Function `ti_get_version` (1.4.0)
|
878
|
-
//
|
879
|
-
// Get the current taichi version. It has the same value as `TI_C_API_VERSION`
|
880
|
-
// as defined in `taichi_core.h`.
|
881
|
-
TI_DLL_EXPORT uint32_t TI_API_CALL ti_get_version();
|
882
|
-
|
883
|
-
// Function `ti_get_available_archs` (1.4.0)
|
884
|
-
//
|
885
|
-
// Gets a list of available archs on the current platform. An arch is only
|
886
|
-
// available if:
|
887
|
-
//
|
888
|
-
// 1. The Runtime library is compiled with its support;
|
889
|
-
// 2. The current platform is installed with a capable hardware or an emulation
|
890
|
-
// software.
|
891
|
-
//
|
892
|
-
// An available arch has at least one device available, i.e., device index 0 is
|
893
|
-
// always available. If an arch is not available on the current platform, a call
|
894
|
-
// to [`ti_create_runtime`](#function-ti_create_runtime) with that arch is
|
895
|
-
// guaranteed failing.
|
896
|
-
//
|
897
|
-
// **WARNING** Please also note that the order or returned archs is *undefined*.
|
898
|
-
TI_DLL_EXPORT void TI_API_CALL ti_get_available_archs(uint32_t *arch_count,
|
899
|
-
TiArch *archs);
|
900
|
-
|
901
|
-
// Function `ti_get_last_error` (1.4.0)
|
902
|
-
//
|
903
|
-
// Gets the last error raised by Taichi C-API invocations. Returns the
|
904
|
-
// semantical error code.
|
905
|
-
TI_DLL_EXPORT TiError TI_API_CALL ti_get_last_error(
|
906
|
-
// Size of textual error message in `function.get_last_error.message`
|
907
|
-
uint64_t *message_size,
|
908
|
-
// Text buffer for the textual error message. Ignored when `message_size` is
|
909
|
-
// 0.
|
910
|
-
char *message);
|
911
|
-
|
912
|
-
// Function `ti_set_last_error` (1.4.0)
|
913
|
-
//
|
914
|
-
// Sets the provided error as the last error raised by Taichi C-API invocations.
|
915
|
-
// It can be useful in extended validation procedures in Taichi C-API wrappers
|
916
|
-
// and helper libraries.
|
917
|
-
TI_DLL_EXPORT void TI_API_CALL ti_set_last_error(
|
918
|
-
// Semantical error code.
|
919
|
-
TiError error,
|
920
|
-
// A null-terminated string of the textual error message or `nullptr` for
|
921
|
-
// empty error message.
|
922
|
-
const char *message);
|
923
|
-
|
924
|
-
// Function `ti_create_runtime` (1.4.0)
|
925
|
-
//
|
926
|
-
// Creates a Taichi Runtime with the specified [`TiArch`](#enumeration-tiarch).
|
927
|
-
TI_DLL_EXPORT TiRuntime TI_API_CALL ti_create_runtime(
|
928
|
-
// Arch of Taichi Runtime.
|
929
|
-
TiArch arch,
|
930
|
-
// The index of device in `function.create_runtime.arch` to create Taichi
|
931
|
-
// Runtime on.
|
932
|
-
uint32_t device_index);
|
933
|
-
|
934
|
-
// Function `ti_destroy_runtime` (1.4.0)
|
935
|
-
//
|
936
|
-
// Destroys a Taichi Runtime.
|
937
|
-
TI_DLL_EXPORT void TI_API_CALL ti_destroy_runtime(TiRuntime runtime);
|
938
|
-
|
939
|
-
// Function `ti_set_runtime_capabilities_ext` (1.4.0)
|
940
|
-
//
|
941
|
-
// Force override the list of available capabilities in the runtime instance.
|
942
|
-
TI_DLL_EXPORT void TI_API_CALL
|
943
|
-
ti_set_runtime_capabilities_ext(TiRuntime runtime,
|
944
|
-
uint32_t capability_count,
|
945
|
-
const TiCapabilityLevelInfo *capabilities);
|
946
|
-
|
947
|
-
// Function `ti_get_runtime_capabilities` (1.4.0)
|
948
|
-
//
|
949
|
-
// Gets all capabilities available on the runtime instance.
|
950
|
-
TI_DLL_EXPORT void TI_API_CALL
|
951
|
-
ti_get_runtime_capabilities(TiRuntime runtime,
|
952
|
-
// The total number of capabilities available.
|
953
|
-
uint32_t *capability_count,
|
954
|
-
// Returned capabilities.
|
955
|
-
TiCapabilityLevelInfo *capabilities);
|
956
|
-
|
957
|
-
// Function `ti_allocate_memory` (1.4.0)
|
958
|
-
//
|
959
|
-
// Allocates a contiguous device memory with provided parameters.
|
960
|
-
TI_DLL_EXPORT TiMemory TI_API_CALL
|
961
|
-
ti_allocate_memory(TiRuntime runtime,
|
962
|
-
const TiMemoryAllocateInfo *allocate_info);
|
963
|
-
|
964
|
-
// Function `ti_free_memory` (1.4.0)
|
965
|
-
//
|
966
|
-
// Frees a memory allocation.
|
967
|
-
TI_DLL_EXPORT void TI_API_CALL ti_free_memory(TiRuntime runtime,
|
968
|
-
TiMemory memory);
|
969
|
-
|
970
|
-
// Function `ti_map_memory` (1.4.0)
|
971
|
-
//
|
972
|
-
// Maps a device memory to a host-addressable space. You *must* ensure that the
|
973
|
-
// device is not being used by any device command before the mapping.
|
974
|
-
TI_DLL_EXPORT void *TI_API_CALL ti_map_memory(TiRuntime runtime,
|
975
|
-
TiMemory memory);
|
976
|
-
|
977
|
-
// Function `ti_unmap_memory` (1.4.0)
|
978
|
-
//
|
979
|
-
// Unmaps a device memory and makes any host-side changes about the memory
|
980
|
-
// visible to the device. You *must* ensure that there is no further access to
|
981
|
-
// the previously mapped host-addressable space.
|
982
|
-
TI_DLL_EXPORT void TI_API_CALL ti_unmap_memory(TiRuntime runtime,
|
983
|
-
TiMemory memory);
|
984
|
-
|
985
|
-
// Function `ti_allocate_image` (1.4.0)
|
986
|
-
//
|
987
|
-
// Allocates a device image with provided parameters.
|
988
|
-
TI_DLL_EXPORT TiImage TI_API_CALL
|
989
|
-
ti_allocate_image(TiRuntime runtime, const TiImageAllocateInfo *allocate_info);
|
990
|
-
|
991
|
-
// Function `ti_free_image` (1.4.0)
|
992
|
-
//
|
993
|
-
// Frees an image allocation.
|
994
|
-
TI_DLL_EXPORT void TI_API_CALL ti_free_image(TiRuntime runtime, TiImage image);
|
995
|
-
|
996
|
-
// Function `ti_create_sampler`
|
997
|
-
TI_DLL_EXPORT TiSampler TI_API_CALL
|
998
|
-
ti_create_sampler(TiRuntime runtime, const TiSamplerCreateInfo *create_info);
|
999
|
-
|
1000
|
-
// Function `ti_destroy_sampler`
|
1001
|
-
TI_DLL_EXPORT void TI_API_CALL ti_destroy_sampler(TiRuntime runtime,
|
1002
|
-
TiSampler sampler);
|
1003
|
-
|
1004
|
-
// Function `ti_copy_memory_device_to_device` (Device Command) (1.4.0)
|
1005
|
-
//
|
1006
|
-
// Copies the data in a contiguous subsection of the device memory to another
|
1007
|
-
// subsection. The two subsections *must not* overlap.
|
1008
|
-
TI_DLL_EXPORT void TI_API_CALL
|
1009
|
-
ti_copy_memory_device_to_device(TiRuntime runtime,
|
1010
|
-
const TiMemorySlice *dst_memory,
|
1011
|
-
const TiMemorySlice *src_memory);
|
1012
|
-
|
1013
|
-
// Function `ti_copy_image_device_to_device` (Device Command)
|
1014
|
-
//
|
1015
|
-
// Copies the image data in a contiguous subsection of the device image to
|
1016
|
-
// another subsection. The two subsections *must not* overlap.
|
1017
|
-
TI_DLL_EXPORT void TI_API_CALL
|
1018
|
-
ti_copy_image_device_to_device(TiRuntime runtime,
|
1019
|
-
const TiImageSlice *dst_image,
|
1020
|
-
const TiImageSlice *src_image);
|
1021
|
-
|
1022
|
-
// Function `ti_track_image_ext` (1.4.0)
|
1023
|
-
//
|
1024
|
-
// Tracks the device image with the provided image layout. Because Taichi tracks
|
1025
|
-
// image layouts internally, it is *only* useful to inform Taichi that the image
|
1026
|
-
// is transitioned to a new layout by external procedures.
|
1027
|
-
TI_DLL_EXPORT void TI_API_CALL ti_track_image_ext(TiRuntime runtime,
|
1028
|
-
TiImage image,
|
1029
|
-
TiImageLayout layout);
|
1030
|
-
|
1031
|
-
// Function `ti_transition_image` (Device Command) (1.4.0)
|
1032
|
-
//
|
1033
|
-
// Transitions the image to the provided image layout. Because Taichi tracks
|
1034
|
-
// image layouts internally, it is *only* useful to enforce an image layout for
|
1035
|
-
// external procedures to use.
|
1036
|
-
TI_DLL_EXPORT void TI_API_CALL ti_transition_image(TiRuntime runtime,
|
1037
|
-
TiImage image,
|
1038
|
-
TiImageLayout layout);
|
1039
|
-
|
1040
|
-
// Function `ti_launch_kernel` (Device Command) (1.4.0)
|
1041
|
-
//
|
1042
|
-
// Launches a Taichi kernel with the provided arguments. The arguments *must*
|
1043
|
-
// have the same count and types in the same order as in the source code.
|
1044
|
-
TI_DLL_EXPORT void TI_API_CALL ti_launch_kernel(TiRuntime runtime,
|
1045
|
-
TiKernel kernel,
|
1046
|
-
uint32_t arg_count,
|
1047
|
-
const TiArgument *args);
|
1048
|
-
|
1049
|
-
// Function `ti_launch_compute_graph` (Device Command) (1.4.0)
|
1050
|
-
//
|
1051
|
-
// Launches a Taichi compute graph with provided named arguments. The named
|
1052
|
-
// arguments *must* have the same count, names, and types as in the source code.
|
1053
|
-
TI_DLL_EXPORT void TI_API_CALL
|
1054
|
-
ti_launch_compute_graph(TiRuntime runtime,
|
1055
|
-
TiComputeGraph compute_graph,
|
1056
|
-
uint32_t arg_count,
|
1057
|
-
const TiNamedArgument *args);
|
1058
|
-
|
1059
|
-
// Function `ti_flush` (1.4.0)
|
1060
|
-
//
|
1061
|
-
// Submits all previously invoked device commands to the offload device for
|
1062
|
-
// execution.
|
1063
|
-
TI_DLL_EXPORT void TI_API_CALL ti_flush(TiRuntime runtime);
|
1064
|
-
|
1065
|
-
// Function `ti_wait` (1.4.0)
|
1066
|
-
//
|
1067
|
-
// Waits until all previously invoked device commands are executed. Any invoked
|
1068
|
-
// command that has not been submitted is submitted first.
|
1069
|
-
TI_DLL_EXPORT void TI_API_CALL ti_wait(TiRuntime runtime);
|
1070
|
-
|
1071
|
-
// Function `ti_load_aot_module` (1.4.0)
|
1072
|
-
//
|
1073
|
-
// Loads a pre-compiled AOT module from the file system.
|
1074
|
-
// Returns [`TI_NULL_HANDLE`](#definition-ti_null_handle) if the runtime fails
|
1075
|
-
// to load the AOT module from the specified path.
|
1076
|
-
TI_DLL_EXPORT TiAotModule TI_API_CALL
|
1077
|
-
ti_load_aot_module(TiRuntime runtime, const char *module_path);
|
1078
|
-
|
1079
|
-
// Function `ti_create_aot_module` (1.4.0)
|
1080
|
-
//
|
1081
|
-
// Creates a pre-compiled AOT module from TCM data.
|
1082
|
-
// Returns [`TI_NULL_HANDLE`](#definition-ti_null_handle) if the runtime fails
|
1083
|
-
// to create the AOT module from TCM data.
|
1084
|
-
TI_DLL_EXPORT TiAotModule TI_API_CALL ti_create_aot_module(TiRuntime runtime,
|
1085
|
-
const void *tcm,
|
1086
|
-
uint64_t size);
|
1087
|
-
|
1088
|
-
// Function `ti_destroy_aot_module` (1.4.0)
|
1089
|
-
//
|
1090
|
-
// Destroys a loaded AOT module and releases all related resources.
|
1091
|
-
TI_DLL_EXPORT void TI_API_CALL ti_destroy_aot_module(TiAotModule aot_module);
|
1092
|
-
|
1093
|
-
// Function `ti_get_aot_module_kernel` (1.4.0)
|
1094
|
-
//
|
1095
|
-
// Retrieves a pre-compiled Taichi kernel from the AOT module.
|
1096
|
-
// Returns [`TI_NULL_HANDLE`](#definition-ti_null_handle) if the module does not
|
1097
|
-
// have a kernel of the specified name.
|
1098
|
-
TI_DLL_EXPORT TiKernel TI_API_CALL
|
1099
|
-
ti_get_aot_module_kernel(TiAotModule aot_module, const char *name);
|
1100
|
-
|
1101
|
-
// Function `ti_get_aot_module_compute_graph` (1.4.0)
|
1102
|
-
//
|
1103
|
-
// Retrieves a pre-compiled compute graph from the AOT module.
|
1104
|
-
// Returns [`TI_NULL_HANDLE`](#definition-ti_null_handle) if the module does not
|
1105
|
-
// have a compute graph of the specified name.
|
1106
|
-
TI_DLL_EXPORT TiComputeGraph TI_API_CALL
|
1107
|
-
ti_get_aot_module_compute_graph(TiAotModule aot_module, const char *name);
|
1108
|
-
|
1109
|
-
#ifdef __cplusplus
|
1110
|
-
} // extern "C"
|
1111
|
-
#endif // __cplusplus
|