gstaichi 0.1.18.dev1__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools/cmake/SPIRV-ToolsConfig.cmake +5 -0
  2. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools/cmake/SPIRV-ToolsTarget-release.cmake +29 -0
  3. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools/cmake/SPIRV-ToolsTarget.cmake +113 -0
  4. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffConfig.cmake +5 -0
  5. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffTargets-release.cmake +19 -0
  6. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-diff/cmake/SPIRV-Tools-diffTargets.cmake +122 -0
  7. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkConfig.cmake +5 -0
  8. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkTargets-release.cmake +19 -0
  9. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-link/cmake/SPIRV-Tools-linkTargets.cmake +122 -0
  10. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintConfig.cmake +5 -0
  11. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintTargets-release.cmake +19 -0
  12. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-lint/cmake/SPIRV-Tools-lintTargets.cmake +122 -0
  13. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optConfig.cmake +5 -0
  14. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optTargets-release.cmake +19 -0
  15. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-opt/cmake/SPIRV-Tools-optTargets.cmake +122 -0
  16. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceConfig.cmake +5 -0
  17. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceTarget-release.cmake +19 -0
  18. gstaichi-0.1.18.dev1.data/data/SPIRV-Tools-reduce/cmake/SPIRV-Tools-reduceTarget.cmake +122 -0
  19. gstaichi-0.1.18.dev1.data/data/bin/SPIRV-Tools-shared.dll +0 -0
  20. gstaichi-0.1.18.dev1.data/data/include/GLFW/glfw3.h +6389 -0
  21. gstaichi-0.1.18.dev1.data/data/include/GLFW/glfw3native.h +594 -0
  22. gstaichi-0.1.18.dev1.data/data/include/spirv-tools/instrument.hpp +268 -0
  23. gstaichi-0.1.18.dev1.data/data/include/spirv-tools/libspirv.h +907 -0
  24. gstaichi-0.1.18.dev1.data/data/include/spirv-tools/libspirv.hpp +375 -0
  25. gstaichi-0.1.18.dev1.data/data/include/spirv-tools/linker.hpp +97 -0
  26. gstaichi-0.1.18.dev1.data/data/include/spirv-tools/optimizer.hpp +970 -0
  27. gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-diff.lib +0 -0
  28. gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-link.lib +0 -0
  29. gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-lint.lib +0 -0
  30. gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-opt.lib +0 -0
  31. gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-reduce.lib +0 -0
  32. gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools-shared.lib +0 -0
  33. gstaichi-0.1.18.dev1.data/data/lib/SPIRV-Tools.lib +0 -0
  34. gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3Config.cmake +3 -0
  35. gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +65 -0
  36. gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3Targets-release.cmake +19 -0
  37. gstaichi-0.1.18.dev1.data/data/lib/cmake/glfw3/glfw3Targets.cmake +107 -0
  38. gstaichi-0.1.18.dev1.data/data/lib/glfw3.lib +0 -0
  39. gstaichi-0.1.18.dev1.dist-info/METADATA +108 -0
  40. gstaichi-0.1.18.dev1.dist-info/RECORD +198 -0
  41. gstaichi-0.1.18.dev1.dist-info/WHEEL +5 -0
  42. gstaichi-0.1.18.dev1.dist-info/entry_points.txt +2 -0
  43. gstaichi-0.1.18.dev1.dist-info/licenses/LICENSE +201 -0
  44. gstaichi-0.1.18.dev1.dist-info/top_level.txt +1 -0
  45. taichi/CHANGELOG.md +15 -0
  46. taichi/__init__.py +44 -0
  47. taichi/__main__.py +5 -0
  48. taichi/_funcs.py +706 -0
  49. taichi/_kernels.py +420 -0
  50. taichi/_lib/__init__.py +3 -0
  51. taichi/_lib/c_api/bin/taichi_c_api.dll +0 -0
  52. taichi/_lib/c_api/include/taichi/cpp/taichi.hpp +1401 -0
  53. taichi/_lib/c_api/include/taichi/taichi.h +29 -0
  54. taichi/_lib/c_api/include/taichi/taichi_core.h +1111 -0
  55. taichi/_lib/c_api/include/taichi/taichi_cpu.h +29 -0
  56. taichi/_lib/c_api/include/taichi/taichi_cuda.h +36 -0
  57. taichi/_lib/c_api/include/taichi/taichi_platform.h +55 -0
  58. taichi/_lib/c_api/include/taichi/taichi_unity.h +64 -0
  59. taichi/_lib/c_api/include/taichi/taichi_vulkan.h +151 -0
  60. taichi/_lib/c_api/lib/taichi_c_api.lib +0 -0
  61. taichi/_lib/c_api/runtime/runtime_cuda.bc +0 -0
  62. taichi/_lib/c_api/runtime/runtime_x64.bc +0 -0
  63. taichi/_lib/c_api/runtime/slim_libdevice.10.bc +0 -0
  64. taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfig.cmake +29 -0
  65. taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfigVersion.cmake +65 -0
  66. taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake +121 -0
  67. taichi/_lib/core/__init__.py +0 -0
  68. taichi/_lib/core/py.typed +0 -0
  69. taichi/_lib/core/taichi_python.cp310-win_amd64.pyd +0 -0
  70. taichi/_lib/core/taichi_python.pyi +3077 -0
  71. taichi/_lib/runtime/runtime_cuda.bc +0 -0
  72. taichi/_lib/runtime/runtime_x64.bc +0 -0
  73. taichi/_lib/runtime/slim_libdevice.10.bc +0 -0
  74. taichi/_lib/utils.py +249 -0
  75. taichi/_logging.py +131 -0
  76. taichi/_main.py +552 -0
  77. taichi/_snode/__init__.py +5 -0
  78. taichi/_snode/fields_builder.py +189 -0
  79. taichi/_snode/snode_tree.py +34 -0
  80. taichi/_ti_module/__init__.py +3 -0
  81. taichi/_ti_module/cppgen.py +309 -0
  82. taichi/_ti_module/module.py +145 -0
  83. taichi/_version.py +1 -0
  84. taichi/_version_check.py +100 -0
  85. taichi/ad/__init__.py +3 -0
  86. taichi/ad/_ad.py +530 -0
  87. taichi/algorithms/__init__.py +3 -0
  88. taichi/algorithms/_algorithms.py +117 -0
  89. taichi/aot/__init__.py +12 -0
  90. taichi/aot/_export.py +28 -0
  91. taichi/aot/conventions/__init__.py +3 -0
  92. taichi/aot/conventions/gfxruntime140/__init__.py +38 -0
  93. taichi/aot/conventions/gfxruntime140/dr.py +244 -0
  94. taichi/aot/conventions/gfxruntime140/sr.py +613 -0
  95. taichi/aot/module.py +253 -0
  96. taichi/aot/utils.py +151 -0
  97. taichi/assets/.git +1 -0
  98. taichi/assets/Go-Regular.ttf +0 -0
  99. taichi/assets/static/imgs/ti_gallery.png +0 -0
  100. taichi/examples/minimal.py +28 -0
  101. taichi/experimental.py +16 -0
  102. taichi/graph/__init__.py +3 -0
  103. taichi/graph/_graph.py +292 -0
  104. taichi/lang/__init__.py +50 -0
  105. taichi/lang/_ndarray.py +348 -0
  106. taichi/lang/_ndrange.py +152 -0
  107. taichi/lang/_texture.py +172 -0
  108. taichi/lang/_wrap_inspect.py +189 -0
  109. taichi/lang/any_array.py +99 -0
  110. taichi/lang/argpack.py +411 -0
  111. taichi/lang/ast/__init__.py +5 -0
  112. taichi/lang/ast/ast_transformer.py +1806 -0
  113. taichi/lang/ast/ast_transformer_utils.py +328 -0
  114. taichi/lang/ast/checkers.py +106 -0
  115. taichi/lang/ast/symbol_resolver.py +57 -0
  116. taichi/lang/ast/transform.py +9 -0
  117. taichi/lang/common_ops.py +310 -0
  118. taichi/lang/exception.py +80 -0
  119. taichi/lang/expr.py +180 -0
  120. taichi/lang/field.py +464 -0
  121. taichi/lang/impl.py +1246 -0
  122. taichi/lang/kernel_arguments.py +157 -0
  123. taichi/lang/kernel_impl.py +1415 -0
  124. taichi/lang/matrix.py +1877 -0
  125. taichi/lang/matrix_ops.py +341 -0
  126. taichi/lang/matrix_ops_utils.py +190 -0
  127. taichi/lang/mesh.py +687 -0
  128. taichi/lang/misc.py +807 -0
  129. taichi/lang/ops.py +1489 -0
  130. taichi/lang/runtime_ops.py +13 -0
  131. taichi/lang/shell.py +35 -0
  132. taichi/lang/simt/__init__.py +5 -0
  133. taichi/lang/simt/block.py +94 -0
  134. taichi/lang/simt/grid.py +7 -0
  135. taichi/lang/simt/subgroup.py +191 -0
  136. taichi/lang/simt/warp.py +96 -0
  137. taichi/lang/snode.py +487 -0
  138. taichi/lang/source_builder.py +150 -0
  139. taichi/lang/struct.py +855 -0
  140. taichi/lang/util.py +381 -0
  141. taichi/linalg/__init__.py +8 -0
  142. taichi/linalg/matrixfree_cg.py +310 -0
  143. taichi/linalg/sparse_cg.py +59 -0
  144. taichi/linalg/sparse_matrix.py +303 -0
  145. taichi/linalg/sparse_solver.py +123 -0
  146. taichi/math/__init__.py +11 -0
  147. taichi/math/_complex.py +204 -0
  148. taichi/math/mathimpl.py +886 -0
  149. taichi/profiler/__init__.py +6 -0
  150. taichi/profiler/kernel_metrics.py +260 -0
  151. taichi/profiler/kernel_profiler.py +592 -0
  152. taichi/profiler/memory_profiler.py +15 -0
  153. taichi/profiler/scoped_profiler.py +36 -0
  154. taichi/shaders/Circles_vk.frag +29 -0
  155. taichi/shaders/Circles_vk.vert +45 -0
  156. taichi/shaders/Circles_vk_frag.spv +0 -0
  157. taichi/shaders/Circles_vk_vert.spv +0 -0
  158. taichi/shaders/Lines_vk.frag +9 -0
  159. taichi/shaders/Lines_vk.vert +11 -0
  160. taichi/shaders/Lines_vk_frag.spv +0 -0
  161. taichi/shaders/Lines_vk_vert.spv +0 -0
  162. taichi/shaders/Mesh_vk.frag +71 -0
  163. taichi/shaders/Mesh_vk.vert +68 -0
  164. taichi/shaders/Mesh_vk_frag.spv +0 -0
  165. taichi/shaders/Mesh_vk_vert.spv +0 -0
  166. taichi/shaders/Particles_vk.frag +95 -0
  167. taichi/shaders/Particles_vk.vert +73 -0
  168. taichi/shaders/Particles_vk_frag.spv +0 -0
  169. taichi/shaders/Particles_vk_vert.spv +0 -0
  170. taichi/shaders/SceneLines2quad_vk_comp.spv +0 -0
  171. taichi/shaders/SceneLines_vk.frag +9 -0
  172. taichi/shaders/SceneLines_vk.vert +12 -0
  173. taichi/shaders/SceneLines_vk_frag.spv +0 -0
  174. taichi/shaders/SceneLines_vk_vert.spv +0 -0
  175. taichi/shaders/SetImage_vk.frag +21 -0
  176. taichi/shaders/SetImage_vk.vert +15 -0
  177. taichi/shaders/SetImage_vk_frag.spv +0 -0
  178. taichi/shaders/SetImage_vk_vert.spv +0 -0
  179. taichi/shaders/Triangles_vk.frag +16 -0
  180. taichi/shaders/Triangles_vk.vert +29 -0
  181. taichi/shaders/Triangles_vk_frag.spv +0 -0
  182. taichi/shaders/Triangles_vk_vert.spv +0 -0
  183. taichi/shaders/lines2quad_vk_comp.spv +0 -0
  184. taichi/sparse/__init__.py +3 -0
  185. taichi/sparse/_sparse_grid.py +77 -0
  186. taichi/tools/__init__.py +12 -0
  187. taichi/tools/diagnose.py +124 -0
  188. taichi/tools/np2ply.py +364 -0
  189. taichi/tools/vtk.py +38 -0
  190. taichi/types/__init__.py +19 -0
  191. taichi/types/annotations.py +47 -0
  192. taichi/types/compound_types.py +90 -0
  193. taichi/types/enums.py +49 -0
  194. taichi/types/ndarray_type.py +147 -0
  195. taichi/types/primitive_types.py +203 -0
  196. taichi/types/quant.py +88 -0
  197. taichi/types/texture_type.py +85 -0
  198. taichi/types/utils.py +13 -0
@@ -0,0 +1,6 @@
1
+ # type: ignore
2
+
3
+ from taichi.profiler.kernel_metrics import *
4
+ from taichi.profiler.kernel_profiler import *
5
+ from taichi.profiler.memory_profiler import *
6
+ from taichi.profiler.scoped_profiler import *
@@ -0,0 +1,260 @@
1
+ # type: ignore
2
+
3
+ from taichi._lib import core as _ti_core
4
+
5
+
6
+ class CuptiMetric:
7
+ """A class to add CUPTI metric for :class:`~taichi.profiler.kernel_profiler.KernelProfiler`.
8
+
9
+ This class is designed to add user selected CUPTI metrics.
10
+ Only available for the CUDA backend now, i.e. you need ``ti.init(kernel_profiler=True, arch=ti.cuda)``.
11
+ For usage of this class, see examples in func :func:`~taichi.profiler.set_kernel_profiler_metrics` and :func:`~taichi.profiler.collect_kernel_profiler_metrics`.
12
+
13
+ Args:
14
+ name (str): name of metric that collected by CUPTI toolkit. used by :func:`~taichi.profiler.set_kernel_profiler_metrics` and :func:`~taichi.profiler.collect_kernel_profiler_metrics`.
15
+ header (str): column header of this metric, used by :func:`~taichi.profiler.print_kernel_profiler_info`.
16
+ val_format (str): format for print metric value (and unit of this value), used by :func:`~taichi.profiler.print_kernel_profiler_info`.
17
+ scale (float): scale of metric value, used by :func:`~taichi.profiler.print_kernel_profiler_info`.
18
+
19
+ Example::
20
+
21
+ >>> import taichi as ti
22
+
23
+ >>> ti.init(kernel_profiler=True, arch=ti.cuda)
24
+ >>> num_elements = 128*1024*1024
25
+
26
+ >>> x = ti.field(ti.f32, shape=num_elements)
27
+ >>> y = ti.field(ti.f32, shape=())
28
+ >>> y[None] = 0
29
+
30
+ >>> @ti.kernel
31
+ >>> def reduction():
32
+ >>> for i in x:
33
+ >>> y[None] += x[i]
34
+
35
+ >>> global_op_atom = ti.profiler.CuptiMetric(
36
+ >>> name='l1tex__t_set_accesses_pipe_lsu_mem_global_op_atom.sum',
37
+ >>> header=' global.atom ',
38
+ >>> val_format=' {:8.0f} ')
39
+
40
+ >>> # add and set user defined metrics
41
+ >>> profiling_metrics = ti.profiler.get_predefined_cupti_metrics('global_access') + [global_op_atom]
42
+ >>> ti.profiler.set_kernel_profile_metrics(profiling_metrics)
43
+
44
+ >>> for i in range(16):
45
+ >>> reduction()
46
+ >>> ti.profiler.print_kernel_profiler_info('trace')
47
+
48
+ Note:
49
+ For details about using CUPTI in Taichi, please visit https://docs.taichi-lang.org/docs/profiler#advanced-mode.
50
+ """
51
+
52
+ def __init__(self, name="", header="unnamed_header", val_format=" {:8.0f} ", scale=1.0):
53
+ self.name = name
54
+ self.header = header
55
+ self.val_format = val_format
56
+ self.scale = scale
57
+
58
+
59
+ # Global Memory Metrics
60
+ dram_utilization = CuptiMetric(
61
+ name="dram__throughput.avg.pct_of_peak_sustained_elapsed",
62
+ header=" global.uti ",
63
+ val_format=" {:6.2f} % ",
64
+ )
65
+
66
+ dram_bytes_sum = CuptiMetric(
67
+ name="dram__bytes.sum",
68
+ header=" global.R&W ",
69
+ val_format="{:9.3f} MB ",
70
+ scale=1.0 / 1024 / 1024,
71
+ )
72
+
73
+ dram_bytes_throughput = CuptiMetric(
74
+ name="dram__bytes.sum.per_second",
75
+ header=" global.R&W/s ",
76
+ val_format="{:8.3f} GB/s ",
77
+ scale=1.0 / 1024 / 1024 / 1024,
78
+ )
79
+
80
+ dram_bytes_read = CuptiMetric(
81
+ name="dram__bytes_read.sum",
82
+ header=" global.R ",
83
+ val_format="{:8.3f} MB ",
84
+ scale=1.0 / 1024 / 1024,
85
+ )
86
+
87
+ dram_read_throughput = CuptiMetric(
88
+ name="dram__bytes_read.sum.per_second",
89
+ header=" global.R/s ",
90
+ val_format="{:8.3f} GB/s ",
91
+ scale=1.0 / 1024 / 1024 / 1024,
92
+ )
93
+
94
+ dram_bytes_write = CuptiMetric(
95
+ name="dram__bytes_write.sum",
96
+ header=" global.W ",
97
+ val_format="{:8.3f} MB ",
98
+ scale=1.0 / 1024 / 1024,
99
+ )
100
+
101
+ dram_write_throughput = CuptiMetric(
102
+ name="dram__bytes_write.sum.per_second",
103
+ header=" global.W/s ",
104
+ val_format="{:8.3f} GB/s ",
105
+ scale=1.0 / 1024 / 1024 / 1024,
106
+ )
107
+
108
+ # Shared Memory Metrics
109
+ shared_utilization = CuptiMetric(
110
+ name="l1tex__data_pipe_lsu_wavefronts_mem_shared.avg.pct_of_peak_sustained_elapsed",
111
+ header=" uti.shared ",
112
+ val_format=" {:6.2f} % ",
113
+ )
114
+
115
+ shared_transactions_load = CuptiMetric(
116
+ name="l1tex__data_pipe_lsu_wavefronts_mem_shared_op_ld.sum",
117
+ header=" shared.trans.W ",
118
+ val_format=" {:10.0f} ",
119
+ )
120
+
121
+ shared_transactions_store = CuptiMetric(
122
+ name="l1tex__data_pipe_lsu_wavefronts_mem_shared_op_st.sum",
123
+ header=" shared.trans.R ",
124
+ val_format=" {:10.0f} ",
125
+ )
126
+
127
+ shared_bank_conflicts_store = CuptiMetric(
128
+ name="l1tex__data_bank_conflicts_pipe_lsu_mem_shared_op_st.sum",
129
+ header=" bank.conflict.W ",
130
+ val_format=" {:10.0f} ",
131
+ )
132
+
133
+ shared_bank_conflicts_load = CuptiMetric(
134
+ name="l1tex__data_bank_conflicts_pipe_lsu_mem_shared_op_ld.sum",
135
+ header=" bank.conflict.R ",
136
+ val_format=" {:10.0f} ",
137
+ )
138
+
139
+ # Atomic Metrics
140
+ global_op_atom = CuptiMetric(
141
+ name="l1tex__t_set_accesses_pipe_lsu_mem_global_op_atom.sum",
142
+ header=" global.atom ",
143
+ val_format=" {:8.0f} ",
144
+ )
145
+
146
+ global_op_reduction = CuptiMetric(
147
+ name="l1tex__t_set_accesses_pipe_lsu_mem_global_op_red.sum",
148
+ header=" global.red ",
149
+ val_format=" {:8.0f} ",
150
+ )
151
+
152
+ # Hardware Utilization Metrics
153
+ sm_throughput = CuptiMetric(
154
+ name="smsp__cycles_active.avg.pct_of_peak_sustained_elapsed",
155
+ header=" core.uti ",
156
+ val_format=" {:6.2f} % ",
157
+ )
158
+
159
+ dram_throughput = CuptiMetric(
160
+ name="gpu__dram_throughput.avg.pct_of_peak_sustained_elapsed",
161
+ header=" mem.uti ",
162
+ val_format=" {:6.2f} % ",
163
+ )
164
+
165
+ l1tex_throughput = CuptiMetric(
166
+ name="l1tex__throughput.avg.pct_of_peak_sustained_elapsed",
167
+ header=" L1.uti ",
168
+ val_format=" {:6.2f} % ",
169
+ )
170
+
171
+ l2_throughput = CuptiMetric(
172
+ name="lts__throughput.avg.pct_of_peak_sustained_elapsed",
173
+ header=" L2.uti ",
174
+ val_format=" {:6.2f} % ",
175
+ )
176
+
177
+ # Misc Metrics
178
+ l1_hit_rate = CuptiMetric(name="l1tex__t_sector_hit_rate.pct", header=" L1.hit ", val_format=" {:6.2f} % ")
179
+
180
+ l2_hit_rate = CuptiMetric(name="lts__t_sector_hit_rate.pct", header=" L2.hit ", val_format=" {:6.2f} % ")
181
+
182
+ achieved_occupancy = CuptiMetric(
183
+ name="sm__warps_active.avg.pct_of_peak_sustained_active",
184
+ header=" occupancy",
185
+ val_format=" {:6.0f} ",
186
+ )
187
+
188
+ # metric suite: global load & store
189
+ global_access = [
190
+ dram_bytes_sum,
191
+ dram_bytes_throughput,
192
+ dram_bytes_read,
193
+ dram_read_throughput,
194
+ dram_bytes_write,
195
+ dram_write_throughput,
196
+ ]
197
+
198
+ # metric suite: shared load & store
199
+ shared_access = [
200
+ shared_transactions_load,
201
+ shared_transactions_store,
202
+ shared_bank_conflicts_store,
203
+ shared_bank_conflicts_load,
204
+ ]
205
+
206
+ # metric suite: atomic access
207
+ atomic_access = [
208
+ global_op_atom,
209
+ global_op_reduction,
210
+ ]
211
+
212
+ # metric suite: cache hit rate
213
+ cache_hit_rate = [
214
+ l1_hit_rate,
215
+ l2_hit_rate,
216
+ ]
217
+
218
+ # metric suite: device throughput
219
+ device_utilization = [
220
+ sm_throughput,
221
+ dram_throughput,
222
+ shared_utilization,
223
+ l1tex_throughput,
224
+ l2_throughput,
225
+ ]
226
+
227
+ # Predefined metrics suites
228
+ predefined_cupti_metrics = {
229
+ "global_access": global_access,
230
+ "shared_access": shared_access,
231
+ "atomic_access": atomic_access,
232
+ "cache_hit_rate": cache_hit_rate,
233
+ "device_utilization": device_utilization,
234
+ }
235
+
236
+
237
+ def get_predefined_cupti_metrics(name=""):
238
+ """Returns the specified cupti metric.
239
+
240
+ Accepted arguments are 'global_access', 'shared_access', 'atomic_access',
241
+ 'cache_hit_rate', 'device_utilization'.
242
+
243
+ Args:
244
+ name (str): cupti metri name.
245
+ """
246
+ if name not in predefined_cupti_metrics:
247
+ _ti_core.warn("Valid Taichi predefined metrics list (str):")
248
+ for key in predefined_cupti_metrics:
249
+ _ti_core.warn(f" '{key}'")
250
+ return None
251
+ return predefined_cupti_metrics[name]
252
+
253
+
254
+ # Default metrics list
255
+ default_cupti_metrics = [dram_bytes_sum]
256
+ """The metrics list, each is an instance of the :class:`~taichi.profiler.CuptiMetric`.
257
+ Default to `dram_bytes_sum`.
258
+ """
259
+
260
+ __all__ = ["CuptiMetric", "get_predefined_cupti_metrics"]