gstaichi 2.1.1rc3__cp311-cp311-macosx_11_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 +4 -0
- gstaichi/__init__.py +40 -0
- gstaichi/_funcs.py +706 -0
- gstaichi/_kernels.py +420 -0
- gstaichi/_lib/__init__.py +3 -0
- gstaichi/_lib/core/__init__.py +0 -0
- gstaichi/_lib/core/gstaichi_python.cpython-311-darwin.so +0 -0
- gstaichi/_lib/core/gstaichi_python.pyi +2909 -0
- gstaichi/_lib/core/py.typed +0 -0
- gstaichi/_lib/runtime/libMoltenVK.dylib +0 -0
- gstaichi/_lib/runtime/runtime_arm64.bc +0 -0
- gstaichi/_lib/utils.py +243 -0
- gstaichi/_logging.py +131 -0
- gstaichi/_snode/__init__.py +5 -0
- gstaichi/_snode/fields_builder.py +187 -0
- gstaichi/_snode/snode_tree.py +34 -0
- gstaichi/_test_tools/__init__.py +18 -0
- gstaichi/_test_tools/dataclass_test_tools.py +36 -0
- gstaichi/_test_tools/load_kernel_string.py +30 -0
- gstaichi/_test_tools/textwrap2.py +6 -0
- gstaichi/_version.py +1 -0
- gstaichi/_version_check.py +100 -0
- gstaichi/ad/__init__.py +3 -0
- gstaichi/ad/_ad.py +530 -0
- gstaichi/algorithms/__init__.py +3 -0
- gstaichi/algorithms/_algorithms.py +117 -0
- gstaichi/assets/.git +1 -0
- gstaichi/assets/Go-Regular.ttf +0 -0
- gstaichi/assets/static/imgs/ti_gallery.png +0 -0
- gstaichi/examples/lcg_python.py +26 -0
- gstaichi/examples/lcg_taichi.py +34 -0
- gstaichi/examples/minimal.py +28 -0
- gstaichi/experimental.py +16 -0
- gstaichi/lang/__init__.py +50 -0
- gstaichi/lang/_dataclass_util.py +31 -0
- gstaichi/lang/_fast_caching/__init__.py +3 -0
- gstaichi/lang/_fast_caching/args_hasher.py +110 -0
- gstaichi/lang/_fast_caching/config_hasher.py +30 -0
- gstaichi/lang/_fast_caching/fast_caching_types.py +21 -0
- gstaichi/lang/_fast_caching/function_hasher.py +57 -0
- gstaichi/lang/_fast_caching/hash_utils.py +11 -0
- gstaichi/lang/_fast_caching/python_side_cache.py +52 -0
- gstaichi/lang/_fast_caching/src_hasher.py +75 -0
- gstaichi/lang/_kernel_impl_dataclass.py +212 -0
- gstaichi/lang/_ndarray.py +352 -0
- gstaichi/lang/_ndrange.py +152 -0
- gstaichi/lang/_template_mapper.py +195 -0
- gstaichi/lang/_texture.py +172 -0
- gstaichi/lang/_wrap_inspect.py +215 -0
- gstaichi/lang/any_array.py +99 -0
- gstaichi/lang/ast/__init__.py +5 -0
- gstaichi/lang/ast/ast_transformer.py +1323 -0
- gstaichi/lang/ast/ast_transformer_utils.py +346 -0
- gstaichi/lang/ast/ast_transformers/__init__.py +0 -0
- gstaichi/lang/ast/ast_transformers/call_transformer.py +324 -0
- gstaichi/lang/ast/ast_transformers/function_def_transformer.py +304 -0
- gstaichi/lang/ast/checkers.py +106 -0
- gstaichi/lang/ast/symbol_resolver.py +57 -0
- gstaichi/lang/ast/transform.py +9 -0
- gstaichi/lang/common_ops.py +310 -0
- gstaichi/lang/exception.py +80 -0
- gstaichi/lang/expr.py +180 -0
- gstaichi/lang/field.py +428 -0
- gstaichi/lang/impl.py +1243 -0
- gstaichi/lang/kernel_arguments.py +155 -0
- gstaichi/lang/kernel_impl.py +1341 -0
- gstaichi/lang/matrix.py +1835 -0
- gstaichi/lang/matrix_ops.py +341 -0
- gstaichi/lang/matrix_ops_utils.py +190 -0
- gstaichi/lang/mesh.py +687 -0
- gstaichi/lang/misc.py +782 -0
- gstaichi/lang/ops.py +1494 -0
- gstaichi/lang/runtime_ops.py +13 -0
- gstaichi/lang/shell.py +35 -0
- gstaichi/lang/simt/__init__.py +5 -0
- gstaichi/lang/simt/block.py +94 -0
- gstaichi/lang/simt/grid.py +7 -0
- gstaichi/lang/simt/subgroup.py +191 -0
- gstaichi/lang/simt/warp.py +96 -0
- gstaichi/lang/snode.py +489 -0
- gstaichi/lang/source_builder.py +150 -0
- gstaichi/lang/struct.py +810 -0
- gstaichi/lang/util.py +312 -0
- gstaichi/linalg/__init__.py +8 -0
- gstaichi/linalg/matrixfree_cg.py +310 -0
- gstaichi/linalg/sparse_cg.py +59 -0
- gstaichi/linalg/sparse_matrix.py +303 -0
- gstaichi/linalg/sparse_solver.py +123 -0
- gstaichi/math/__init__.py +11 -0
- gstaichi/math/_complex.py +205 -0
- gstaichi/math/mathimpl.py +886 -0
- gstaichi/profiler/__init__.py +6 -0
- gstaichi/profiler/kernel_metrics.py +260 -0
- gstaichi/profiler/kernel_profiler.py +586 -0
- gstaichi/profiler/memory_profiler.py +15 -0
- gstaichi/profiler/scoped_profiler.py +36 -0
- gstaichi/sparse/__init__.py +3 -0
- gstaichi/sparse/_sparse_grid.py +77 -0
- gstaichi/tools/__init__.py +12 -0
- gstaichi/tools/diagnose.py +117 -0
- gstaichi/tools/np2ply.py +364 -0
- gstaichi/tools/vtk.py +38 -0
- gstaichi/types/__init__.py +19 -0
- gstaichi/types/annotations.py +52 -0
- gstaichi/types/compound_types.py +71 -0
- gstaichi/types/enums.py +49 -0
- gstaichi/types/ndarray_type.py +169 -0
- gstaichi/types/primitive_types.py +206 -0
- gstaichi/types/quant.py +88 -0
- gstaichi/types/texture_type.py +85 -0
- gstaichi/types/utils.py +11 -0
- gstaichi-2.1.1rc3.data/data/include/GLFW/glfw3.h +6389 -0
- gstaichi-2.1.1rc3.data/data/include/GLFW/glfw3native.h +594 -0
- gstaichi-2.1.1rc3.data/data/include/spirv-tools/instrument.hpp +268 -0
- gstaichi-2.1.1rc3.data/data/include/spirv-tools/libspirv.h +907 -0
- gstaichi-2.1.1rc3.data/data/include/spirv-tools/libspirv.hpp +375 -0
- gstaichi-2.1.1rc3.data/data/include/spirv-tools/linker.hpp +97 -0
- gstaichi-2.1.1rc3.data/data/include/spirv-tools/optimizer.hpp +970 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/GLSL.std.450.h +114 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv.h +2568 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv.hpp +2579 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cfg.hpp +168 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_common.hpp +1920 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cpp.hpp +93 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross.hpp +1171 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_c.h +1074 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_containers.hpp +754 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_error_handling.hpp +94 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_parsed_ir.hpp +256 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_cross_util.hpp +37 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_glsl.hpp +1001 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_hlsl.hpp +406 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_msl.hpp +1273 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_parser.hpp +103 -0
- gstaichi-2.1.1rc3.data/data/include/spirv_cross/spirv_reflect.hpp +91 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsConfig.cmake +5 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget-release.cmake +29 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake +114 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffConfig.cmake +5 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-diff/SPIRV-Tools-diffTargets.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkConfig.cmake +5 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-link/SPIRV-Tools-linkTargets.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintConfig.cmake +5 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-lint/SPIRV-Tools-lintTargets.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optConfig.cmake +5 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optTargets.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceConfig.cmake +5 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/SPIRV-Tools-reduce/SPIRV-Tools-reduceTarget.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3Config.cmake +3 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3ConfigVersion.cmake +65 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3Targets-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/lib/cmake/glfw3/glfw3Targets.cmake +107 -0
- gstaichi-2.1.1rc3.data/data/lib/libSPIRV-Tools-shared.dylib +0 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_c/cmake/spirv_cross_cConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_c/cmake/spirv_cross_cConfig.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_core/cmake/spirv_cross_coreConfig.cmake +106 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_cpp/cmake/spirv_cross_cppConfig.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_glsl/cmake/spirv_cross_glslConfig.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_hlsl/cmake/spirv_cross_hlslConfig.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_msl/cmake/spirv_cross_mslConfig.cmake +123 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_reflect/cmake/spirv_cross_reflectConfig.cmake +106 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig-release.cmake +19 -0
- gstaichi-2.1.1rc3.data/data/share/spirv_cross_util/cmake/spirv_cross_utilConfig.cmake +123 -0
- gstaichi-2.1.1rc3.dist-info/METADATA +106 -0
- gstaichi-2.1.1rc3.dist-info/RECORD +179 -0
- gstaichi-2.1.1rc3.dist-info/WHEEL +5 -0
- gstaichi-2.1.1rc3.dist-info/licenses/LICENSE +201 -0
- gstaichi-2.1.1rc3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,260 @@
|
|
1
|
+
# type: ignore
|
2
|
+
|
3
|
+
from gstaichi._lib import core as _ti_core
|
4
|
+
|
5
|
+
|
6
|
+
class CuptiMetric:
|
7
|
+
"""A class to add CUPTI metric for :class:`~gstaichi.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:`~gstaichi.profiler.set_kernel_profiler_metrics` and :func:`~gstaichi.profiler.collect_kernel_profiler_metrics`.
|
12
|
+
|
13
|
+
Args:
|
14
|
+
name (str): name of metric that collected by CUPTI toolkit. used by :func:`~gstaichi.profiler.set_kernel_profiler_metrics` and :func:`~gstaichi.profiler.collect_kernel_profiler_metrics`.
|
15
|
+
header (str): column header of this metric, used by :func:`~gstaichi.profiler.print_kernel_profiler_info`.
|
16
|
+
val_format (str): format for print metric value (and unit of this value), used by :func:`~gstaichi.profiler.print_kernel_profiler_info`.
|
17
|
+
scale (float): scale of metric value, used by :func:`~gstaichi.profiler.print_kernel_profiler_info`.
|
18
|
+
|
19
|
+
Example::
|
20
|
+
|
21
|
+
>>> import gstaichi 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 GsTaichi, 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 GsTaichi 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:`~gstaichi.profiler.CuptiMetric`.
|
257
|
+
Default to `dram_bytes_sum`.
|
258
|
+
"""
|
259
|
+
|
260
|
+
__all__ = ["CuptiMetric", "get_predefined_cupti_metrics"]
|