warp-lang 0.10.1__py3-none-win_amd64.whl → 0.11.0__py3-none-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.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/__init__.py +10 -4
- warp/__init__.pyi +1 -0
- warp/bin/warp-clang.dll +0 -0
- warp/bin/warp.dll +0 -0
- warp/build.py +5 -3
- warp/build_dll.py +29 -9
- warp/builtins.py +868 -507
- warp/codegen.py +1074 -638
- warp/config.py +3 -3
- warp/constants.py +6 -0
- warp/context.py +715 -222
- warp/fabric.py +326 -0
- warp/fem/__init__.py +27 -0
- warp/fem/cache.py +389 -0
- warp/fem/dirichlet.py +181 -0
- warp/fem/domain.py +263 -0
- warp/fem/field/__init__.py +101 -0
- warp/fem/field/field.py +149 -0
- warp/fem/field/nodal_field.py +299 -0
- warp/fem/field/restriction.py +21 -0
- warp/fem/field/test.py +181 -0
- warp/fem/field/trial.py +183 -0
- warp/fem/geometry/__init__.py +19 -0
- warp/fem/geometry/closest_point.py +70 -0
- warp/fem/geometry/deformed_geometry.py +271 -0
- warp/fem/geometry/element.py +744 -0
- warp/fem/geometry/geometry.py +186 -0
- warp/fem/geometry/grid_2d.py +373 -0
- warp/fem/geometry/grid_3d.py +435 -0
- warp/fem/geometry/hexmesh.py +953 -0
- warp/fem/geometry/partition.py +376 -0
- warp/fem/geometry/quadmesh_2d.py +532 -0
- warp/fem/geometry/tetmesh.py +840 -0
- warp/fem/geometry/trimesh_2d.py +577 -0
- warp/fem/integrate.py +1616 -0
- warp/fem/operator.py +191 -0
- warp/fem/polynomial.py +213 -0
- warp/fem/quadrature/__init__.py +2 -0
- warp/fem/quadrature/pic_quadrature.py +245 -0
- warp/fem/quadrature/quadrature.py +294 -0
- warp/fem/space/__init__.py +292 -0
- warp/fem/space/basis_space.py +489 -0
- warp/fem/space/collocated_function_space.py +105 -0
- warp/fem/space/dof_mapper.py +236 -0
- warp/fem/space/function_space.py +145 -0
- warp/fem/space/grid_2d_function_space.py +267 -0
- warp/fem/space/grid_3d_function_space.py +306 -0
- warp/fem/space/hexmesh_function_space.py +352 -0
- warp/fem/space/partition.py +350 -0
- warp/fem/space/quadmesh_2d_function_space.py +369 -0
- warp/fem/space/restriction.py +160 -0
- warp/fem/space/shape/__init__.py +15 -0
- warp/fem/space/shape/cube_shape_function.py +738 -0
- warp/fem/space/shape/shape_function.py +103 -0
- warp/fem/space/shape/square_shape_function.py +611 -0
- warp/fem/space/shape/tet_shape_function.py +567 -0
- warp/fem/space/shape/triangle_shape_function.py +429 -0
- warp/fem/space/tetmesh_function_space.py +292 -0
- warp/fem/space/topology.py +295 -0
- warp/fem/space/trimesh_2d_function_space.py +221 -0
- warp/fem/types.py +77 -0
- warp/fem/utils.py +495 -0
- warp/native/array.h +147 -44
- warp/native/builtin.h +122 -149
- warp/native/bvh.cpp +73 -325
- warp/native/bvh.cu +406 -23
- warp/native/bvh.h +34 -43
- warp/native/clang/clang.cpp +13 -8
- warp/native/crt.h +2 -0
- warp/native/cuda_crt.h +5 -0
- warp/native/cuda_util.cpp +15 -3
- warp/native/cuda_util.h +3 -1
- warp/native/cutlass/tools/library/scripts/conv2d_operation.py +463 -0
- warp/native/cutlass/tools/library/scripts/conv3d_operation.py +321 -0
- warp/native/cutlass/tools/library/scripts/gemm_operation.py +988 -0
- warp/native/cutlass/tools/library/scripts/generator.py +4625 -0
- warp/native/cutlass/tools/library/scripts/library.py +799 -0
- warp/native/cutlass/tools/library/scripts/manifest.py +402 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/docs/source/conf.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/profile/conv/conv2d_f16_sm80.py +106 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/profile/gemm/gemm_f32_sm80.py +91 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/setup.py +80 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/__init__.py +48 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/arguments.py +118 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/c_types.py +241 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/compiler.py +432 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/conv2d_operation.py +631 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/epilogue.py +1026 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/frontend.py +104 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/gemm_operation.py +1276 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/library.py +744 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/memory_manager.py +74 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/operation.py +110 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/parser.py +619 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/reduction_operation.py +398 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/tensor_ref.py +70 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/__init__.py +4 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/conv2d_testbed.py +646 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_grouped_testbed.py +235 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_testbed.py +557 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/profiler.py +70 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/type_hint.py +39 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/__init__.py +1 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/device.py +76 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/reference_model.py +255 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/__init__.py +0 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +201 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +177 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +98 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +95 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_few_channels_f16nhwc_f16nhwc_f16nhwc_tensor_op_f32_sm80.py +163 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_fixed_channels_f16nhwc_f16nhwc_f16nhwc_tensor_op_f32_sm80.py +187 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +309 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +54 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +107 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_strided_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +253 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +97 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +242 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +107 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/run_all_tests.py +10 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/frontend/test_frontend.py +146 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/__init__.py +0 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_bf16_sm80.py +96 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f16_sm80.py +447 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f32_sm80.py +146 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f64_sm80.py +102 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_grouped_sm80.py +203 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_s8_sm80.py +229 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/run_all_tests.py +9 -0
- warp/native/cutlass/tools/library/scripts/pycutlass/test/unit/test_sm80.py +453 -0
- warp/native/cutlass/tools/library/scripts/rank_2k_operation.py +398 -0
- warp/native/cutlass/tools/library/scripts/rank_k_operation.py +387 -0
- warp/native/cutlass/tools/library/scripts/rt.py +796 -0
- warp/native/cutlass/tools/library/scripts/symm_operation.py +400 -0
- warp/native/cutlass/tools/library/scripts/trmm_operation.py +407 -0
- warp/native/cutlass_gemm.cu +5 -3
- warp/native/exports.h +1240 -952
- warp/native/fabric.h +228 -0
- warp/native/hashgrid.cpp +4 -4
- warp/native/hashgrid.h +22 -2
- warp/native/intersect.h +22 -7
- warp/native/intersect_adj.h +8 -8
- warp/native/intersect_tri.h +1 -1
- warp/native/marching.cu +157 -161
- warp/native/mat.h +80 -19
- warp/native/matnn.h +2 -2
- warp/native/mesh.cpp +33 -108
- warp/native/mesh.cu +114 -23
- warp/native/mesh.h +446 -46
- warp/native/noise.h +272 -329
- warp/native/quat.h +51 -8
- warp/native/rand.h +45 -35
- warp/native/range.h +6 -2
- warp/native/reduce.cpp +1 -1
- warp/native/reduce.cu +10 -12
- warp/native/runlength_encode.cu +6 -10
- warp/native/scan.cu +8 -11
- warp/native/sparse.cpp +4 -4
- warp/native/sparse.cu +164 -154
- warp/native/spatial.h +2 -2
- warp/native/temp_buffer.h +14 -30
- warp/native/vec.h +107 -23
- warp/native/volume.h +120 -0
- warp/native/warp.cpp +560 -30
- warp/native/warp.cu +431 -44
- warp/native/warp.h +13 -4
- warp/optim/__init__.py +1 -0
- warp/optim/linear.py +922 -0
- warp/optim/sgd.py +92 -0
- warp/render/render_opengl.py +335 -119
- warp/render/render_usd.py +11 -11
- warp/sim/__init__.py +2 -2
- warp/sim/articulation.py +385 -185
- warp/sim/collide.py +8 -0
- warp/sim/import_mjcf.py +297 -106
- warp/sim/import_urdf.py +389 -210
- warp/sim/import_usd.py +198 -97
- warp/sim/inertia.py +17 -18
- warp/sim/integrator_euler.py +14 -8
- warp/sim/integrator_xpbd.py +158 -16
- warp/sim/model.py +795 -291
- warp/sim/render.py +3 -3
- warp/sim/utils.py +3 -0
- warp/sparse.py +640 -150
- warp/stubs.py +606 -267
- warp/tape.py +61 -10
- warp/tests/__main__.py +3 -6
- warp/tests/assets/curlnoise_golden.npy +0 -0
- warp/tests/assets/pnoise_golden.npy +0 -0
- warp/tests/{test_class_kernel.py → aux_test_class_kernel.py} +9 -1
- warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -0
- warp/tests/{test_dependent.py → aux_test_dependent.py} +2 -2
- warp/tests/{test_reference.py → aux_test_reference.py} +1 -1
- warp/tests/aux_test_unresolved_func.py +14 -0
- warp/tests/aux_test_unresolved_symbol.py +14 -0
- warp/tests/disabled_kinematics.py +239 -0
- warp/tests/run_coverage_serial.py +31 -0
- warp/tests/test_adam.py +103 -106
- warp/tests/test_arithmetic.py +128 -74
- warp/tests/test_array.py +212 -97
- warp/tests/test_array_reduce.py +57 -23
- warp/tests/test_atomic.py +64 -28
- warp/tests/test_bool.py +99 -0
- warp/tests/test_builtins_resolution.py +1292 -0
- warp/tests/test_bvh.py +42 -18
- warp/tests/test_closest_point_edge_edge.py +54 -57
- warp/tests/test_codegen.py +208 -130
- warp/tests/test_compile_consts.py +28 -20
- warp/tests/test_conditional.py +108 -24
- warp/tests/test_copy.py +10 -12
- warp/tests/test_ctypes.py +112 -88
- warp/tests/test_dense.py +21 -14
- warp/tests/test_devices.py +98 -0
- warp/tests/test_dlpack.py +75 -75
- warp/tests/test_examples.py +277 -0
- warp/tests/test_fabricarray.py +955 -0
- warp/tests/test_fast_math.py +15 -11
- warp/tests/test_fem.py +1271 -0
- warp/tests/test_fp16.py +53 -19
- warp/tests/test_func.py +187 -86
- warp/tests/test_generics.py +194 -49
- warp/tests/test_grad.py +178 -109
- warp/tests/test_grad_customs.py +176 -0
- warp/tests/test_hash_grid.py +52 -37
- warp/tests/test_import.py +10 -23
- warp/tests/test_indexedarray.py +32 -31
- warp/tests/test_intersect.py +18 -9
- warp/tests/test_large.py +141 -0
- warp/tests/test_launch.py +14 -41
- warp/tests/test_lerp.py +64 -65
- warp/tests/test_linear_solvers.py +154 -0
- warp/tests/test_lvalue.py +493 -0
- warp/tests/test_marching_cubes.py +12 -13
- warp/tests/test_mat.py +517 -2898
- warp/tests/test_mat_lite.py +115 -0
- warp/tests/test_mat_scalar_ops.py +2889 -0
- warp/tests/test_math.py +103 -9
- warp/tests/test_matmul.py +305 -69
- warp/tests/test_matmul_lite.py +410 -0
- warp/tests/test_mesh.py +71 -14
- warp/tests/test_mesh_query_aabb.py +41 -25
- warp/tests/test_mesh_query_point.py +140 -22
- warp/tests/test_mesh_query_ray.py +39 -22
- warp/tests/test_mlp.py +30 -22
- warp/tests/test_model.py +92 -89
- warp/tests/test_modules_lite.py +39 -0
- warp/tests/test_multigpu.py +88 -114
- warp/tests/test_noise.py +12 -11
- warp/tests/test_operators.py +16 -20
- warp/tests/test_options.py +11 -11
- warp/tests/test_pinned.py +17 -18
- warp/tests/test_print.py +32 -11
- warp/tests/test_quat.py +275 -129
- warp/tests/test_rand.py +18 -16
- warp/tests/test_reload.py +38 -34
- warp/tests/test_rounding.py +50 -43
- warp/tests/test_runlength_encode.py +168 -20
- warp/tests/test_smoothstep.py +9 -11
- warp/tests/test_snippet.py +143 -0
- warp/tests/test_sparse.py +261 -63
- warp/tests/test_spatial.py +276 -243
- warp/tests/test_streams.py +110 -85
- warp/tests/test_struct.py +268 -63
- warp/tests/test_tape.py +39 -21
- warp/tests/test_torch.py +118 -89
- warp/tests/test_transient_module.py +12 -13
- warp/tests/test_types.py +614 -0
- warp/tests/test_utils.py +494 -0
- warp/tests/test_vec.py +354 -2050
- warp/tests/test_vec_lite.py +73 -0
- warp/tests/test_vec_scalar_ops.py +2099 -0
- warp/tests/test_volume.py +457 -293
- warp/tests/test_volume_write.py +124 -134
- warp/tests/unittest_serial.py +35 -0
- warp/tests/unittest_suites.py +341 -0
- warp/tests/unittest_utils.py +568 -0
- warp/tests/unused_test_misc.py +71 -0
- warp/tests/{test_debug.py → walkthough_debug.py} +3 -17
- warp/thirdparty/appdirs.py +36 -45
- warp/thirdparty/unittest_parallel.py +549 -0
- warp/torch.py +9 -6
- warp/types.py +1089 -366
- warp/utils.py +93 -387
- warp_lang-0.11.0.dist-info/METADATA +238 -0
- warp_lang-0.11.0.dist-info/RECORD +332 -0
- {warp_lang-0.10.1.dist-info → warp_lang-0.11.0.dist-info}/WHEEL +1 -1
- warp/tests/test_all.py +0 -219
- warp/tests/test_array_scan.py +0 -60
- warp/tests/test_base.py +0 -208
- warp/tests/test_unresolved_func.py +0 -7
- warp/tests/test_unresolved_symbol.py +0 -7
- warp_lang-0.10.1.dist-info/METADATA +0 -21
- warp_lang-0.10.1.dist-info/RECORD +0 -188
- /warp/tests/{test_compile_consts_dummy.py → aux_test_compile_consts_dummy.py} +0 -0
- /warp/tests/{test_reference_reference.py → aux_test_reference_reference.py} +0 -0
- /warp/tests/{test_square.py → aux_test_square.py} +0 -0
- {warp_lang-0.10.1.dist-info → warp_lang-0.11.0.dist-info}/LICENSE.md +0 -0
- {warp_lang-0.10.1.dist-info → warp_lang-0.11.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
#################################################################################################
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2017 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
4
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
#
|
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
|
8
|
+
#
|
|
9
|
+
# 1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
# list of conditions and the following disclaimer.
|
|
11
|
+
#
|
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# 3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
|
18
|
+
# this software without specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
#
|
|
31
|
+
#################################################################################################
|
|
32
|
+
|
|
33
|
+
import re
|
|
34
|
+
|
|
35
|
+
###################################################################################################
|
|
36
|
+
|
|
37
|
+
import enum
|
|
38
|
+
import cutlass
|
|
39
|
+
|
|
40
|
+
# The following block implements enum.auto() for Python 3.5 variants that don't include it such
|
|
41
|
+
# as the default 3.5.2 on Ubuntu 16.04.
|
|
42
|
+
#
|
|
43
|
+
# https://codereview.stackexchange.com/questions/177309/reimplementing-pythons-enum-auto-for-compatibility
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
from enum import auto as enum_auto
|
|
47
|
+
except ImportError:
|
|
48
|
+
__cutlass_library_auto_enum = 0
|
|
49
|
+
|
|
50
|
+
def enum_auto() -> int:
|
|
51
|
+
global __cutlass_library_auto_enum
|
|
52
|
+
i = __cutlass_library_auto_enum
|
|
53
|
+
__cutlass_library_auto_enum += 1
|
|
54
|
+
return i
|
|
55
|
+
|
|
56
|
+
###################################################################################################
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class GeneratorTarget(enum.Enum):
|
|
62
|
+
Library = enum_auto()
|
|
63
|
+
|
|
64
|
+
#
|
|
65
|
+
GeneratorTargetNames = {
|
|
66
|
+
GeneratorTarget.Library: 'library',
|
|
67
|
+
}
|
|
68
|
+
#
|
|
69
|
+
|
|
70
|
+
###################################################################################################
|
|
71
|
+
|
|
72
|
+
#
|
|
73
|
+
ShortDataTypeNames = {
|
|
74
|
+
cutlass.int32: 'i',
|
|
75
|
+
cutlass.float16: 'h',
|
|
76
|
+
cutlass.float32: 's',
|
|
77
|
+
cutlass.float64: 'd',
|
|
78
|
+
cutlass.dtype.cf32: 'c',
|
|
79
|
+
cutlass.dtype.cf64: 'z',
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#
|
|
83
|
+
DataTypeNames = {
|
|
84
|
+
cutlass.dtype.b1: "b1",
|
|
85
|
+
cutlass.dtype.u4: "u4",
|
|
86
|
+
cutlass.dtype.u8: "u8",
|
|
87
|
+
cutlass.dtype.u16: "u16",
|
|
88
|
+
cutlass.dtype.u32: "u32",
|
|
89
|
+
cutlass.dtype.u64: "u64",
|
|
90
|
+
cutlass.dtype.s4: "s4",
|
|
91
|
+
cutlass.int8: "s8",
|
|
92
|
+
cutlass.dtype.s16: "s16",
|
|
93
|
+
cutlass.int32: "s32",
|
|
94
|
+
cutlass.dtype.s64: "s64",
|
|
95
|
+
cutlass.float16: "f16",
|
|
96
|
+
cutlass.bfloat16: "bf16",
|
|
97
|
+
cutlass.float32: "f32",
|
|
98
|
+
cutlass.tfloat32: "tf32",
|
|
99
|
+
cutlass.float64: "f64",
|
|
100
|
+
cutlass.dtype.cf16: "cf16",
|
|
101
|
+
cutlass.dtype.cbf16: "cbf16",
|
|
102
|
+
cutlass.dtype.cf32: "cf32",
|
|
103
|
+
cutlass.dtype.ctf32: "ctf32",
|
|
104
|
+
cutlass.dtype.cf64: "cf64",
|
|
105
|
+
cutlass.dtype.cu4: "cu4",
|
|
106
|
+
cutlass.dtype.cu8: "cu8",
|
|
107
|
+
cutlass.dtype.cu16: "cu16",
|
|
108
|
+
cutlass.dtype.cu32: "cu32",
|
|
109
|
+
cutlass.dtype.cu64: "cu64",
|
|
110
|
+
cutlass.dtype.cs4: "cs4",
|
|
111
|
+
cutlass.dtype.cs8: "cs8",
|
|
112
|
+
cutlass.dtype.cs16: "cs16",
|
|
113
|
+
cutlass.dtype.cs32: "cs32",
|
|
114
|
+
cutlass.dtype.cs64: "cs64",
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
DataTypeTag = {
|
|
118
|
+
cutlass.dtype.b1: "cutlass::uint1b_t",
|
|
119
|
+
cutlass.dtype.u4: "cutlass::uint4b_t",
|
|
120
|
+
cutlass.dtype.u8: "uint8_t",
|
|
121
|
+
cutlass.dtype.u16: "uint16_t",
|
|
122
|
+
cutlass.dtype.u32: "uint32_t",
|
|
123
|
+
cutlass.dtype.u64: "uint64_t",
|
|
124
|
+
cutlass.dtype.s4: "cutlass::int4b_t",
|
|
125
|
+
cutlass.int8: "int8_t",
|
|
126
|
+
cutlass.dtype.s16: "int16_t",
|
|
127
|
+
cutlass.int32: "int32_t",
|
|
128
|
+
cutlass.dtype.s64: "int64_t",
|
|
129
|
+
cutlass.float16: "cutlass::half_t",
|
|
130
|
+
cutlass.bfloat16: "cutlass::bfloat16_t",
|
|
131
|
+
cutlass.float32: "float",
|
|
132
|
+
cutlass.tfloat32: "cutlass::tfloat32_t",
|
|
133
|
+
cutlass.float64: "double",
|
|
134
|
+
cutlass.dtype.cf16: "cutlass::complex<cutlass::half_t>",
|
|
135
|
+
cutlass.dtype.cbf16: "cutlass::complex<cutlass::bfloat16_t>",
|
|
136
|
+
cutlass.dtype.cf32: "cutlass::complex<float>",
|
|
137
|
+
cutlass.dtype.ctf32: "cutlass::complex<cutlass::tfloat32_t>",
|
|
138
|
+
cutlass.dtype.cf64: "cutlass::complex<double>",
|
|
139
|
+
cutlass.dtype.cu4: "cutlass::complex<cutlass::uint4b_t>",
|
|
140
|
+
cutlass.dtype.cu8: "cutlass::complex<cutlass::uint8_t>",
|
|
141
|
+
cutlass.dtype.cu16: "cutlass::complex<cutlass::uint16_t>",
|
|
142
|
+
cutlass.dtype.cu32: "cutlass::complex<cutlass::uint32_t>",
|
|
143
|
+
cutlass.dtype.cu64: "cutlass::complex<cutlass::uint64_t>",
|
|
144
|
+
cutlass.dtype.cs4: "cutlass::complex<cutlass::int4b_t>",
|
|
145
|
+
cutlass.dtype.cs8: "cutlass::complex<cutlass::int8_t>",
|
|
146
|
+
cutlass.dtype.cs16: "cutlass::complex<cutlass::int16_t>",
|
|
147
|
+
cutlass.dtype.cs32: "cutlass::complex<cutlass::int32_t>",
|
|
148
|
+
cutlass.dtype.cs64: "cutlass::complex<cutlass::int64_t>",
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
DataTypeSize = {
|
|
152
|
+
cutlass.dtype.b1: 1,
|
|
153
|
+
cutlass.dtype.u4: 4,
|
|
154
|
+
cutlass.dtype.u8: 8,
|
|
155
|
+
cutlass.dtype.u16: 16,
|
|
156
|
+
cutlass.dtype.u32: 32,
|
|
157
|
+
cutlass.dtype.u64: 64,
|
|
158
|
+
cutlass.dtype.s4: 4,
|
|
159
|
+
cutlass.int8: 8,
|
|
160
|
+
cutlass.dtype.s16: 16,
|
|
161
|
+
cutlass.int32: 32,
|
|
162
|
+
cutlass.dtype.s64: 64,
|
|
163
|
+
cutlass.float16: 16,
|
|
164
|
+
cutlass.bfloat16: 16,
|
|
165
|
+
cutlass.float32: 32,
|
|
166
|
+
cutlass.tfloat32: 32,
|
|
167
|
+
cutlass.float64: 64,
|
|
168
|
+
cutlass.dtype.cf16: 32,
|
|
169
|
+
cutlass.dtype.cbf16: 32,
|
|
170
|
+
cutlass.dtype.cf32: 64,
|
|
171
|
+
cutlass.dtype.ctf32: 32,
|
|
172
|
+
cutlass.dtype.cf64: 128,
|
|
173
|
+
cutlass.dtype.cu4: 8,
|
|
174
|
+
cutlass.dtype.cu8: 16,
|
|
175
|
+
cutlass.dtype.cu16: 32,
|
|
176
|
+
cutlass.dtype.cu32: 64,
|
|
177
|
+
cutlass.dtype.cu64: 128,
|
|
178
|
+
cutlass.dtype.cs4: 8,
|
|
179
|
+
cutlass.dtype.cs8: 16,
|
|
180
|
+
cutlass.dtype.cs16: 32,
|
|
181
|
+
cutlass.dtype.cs32: 64,
|
|
182
|
+
cutlass.dtype.cs64: 128,
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
###################################################################################################
|
|
186
|
+
#
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class BlasMode(enum.Enum):
|
|
190
|
+
symmetric = enum_auto()
|
|
191
|
+
hermitian = enum_auto()
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
#
|
|
195
|
+
BlasModeTag = {
|
|
196
|
+
BlasMode.symmetric: 'cutlass::BlasMode::kSymmetric',
|
|
197
|
+
BlasMode.hermitian: 'cutlass::BlasMode::kHermitian',
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#
|
|
201
|
+
ComplexTransformTag = {
|
|
202
|
+
cutlass.complex_transform.none: 'cutlass::ComplexTransform::kNone',
|
|
203
|
+
cutlass.complex_transform.conj: 'cutlass::ComplexTransform::kConjugate',
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
#
|
|
207
|
+
RealComplexBijection = [
|
|
208
|
+
(cutlass.float16, cutlass.dtype.cf16),
|
|
209
|
+
(cutlass.float32, cutlass.dtype.cf32),
|
|
210
|
+
(cutlass.float64, cutlass.dtype.cf64),
|
|
211
|
+
]
|
|
212
|
+
|
|
213
|
+
#
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def is_complex(data_type):
|
|
217
|
+
for r, c in RealComplexBijection:
|
|
218
|
+
if data_type == c:
|
|
219
|
+
return True
|
|
220
|
+
return False
|
|
221
|
+
|
|
222
|
+
#
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def get_complex_from_real(real_type):
|
|
226
|
+
for r, c in RealComplexBijection:
|
|
227
|
+
if real_type == r:
|
|
228
|
+
return c
|
|
229
|
+
return cutlass.dtype.invalid
|
|
230
|
+
|
|
231
|
+
#
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def get_real_from_complex(complex_type):
|
|
235
|
+
for r, c in RealComplexBijection:
|
|
236
|
+
if complex_type == c:
|
|
237
|
+
return r
|
|
238
|
+
return cutlass.dtype.invalid
|
|
239
|
+
|
|
240
|
+
#
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class ComplexMultiplyOp(enum.Enum):
|
|
244
|
+
multiply_add = enum_auto()
|
|
245
|
+
gaussian = enum_auto()
|
|
246
|
+
|
|
247
|
+
###################################################################################################
|
|
248
|
+
|
|
249
|
+
#
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class MathOperation(enum.Enum):
|
|
253
|
+
multiply_add = enum_auto()
|
|
254
|
+
multiply_add_saturate = enum_auto()
|
|
255
|
+
xor_popc = enum_auto()
|
|
256
|
+
multiply_add_fast_bf16 = enum_auto()
|
|
257
|
+
multiply_add_fast_f16 = enum_auto()
|
|
258
|
+
multiply_add_fast_f32 = enum_auto()
|
|
259
|
+
multiply_add_complex_fast_f32 = enum_auto()
|
|
260
|
+
multiply_add_complex = enum_auto()
|
|
261
|
+
multiply_add_complex_gaussian = enum_auto()
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
#
|
|
265
|
+
MathOperationNames = {
|
|
266
|
+
MathOperation.multiply_add: 'multiply_add',
|
|
267
|
+
MathOperation.multiply_add_saturate: 'multiply_add_saturate',
|
|
268
|
+
MathOperation.xor_popc: 'xor_popc',
|
|
269
|
+
MathOperation.multiply_add_fast_bf16: 'multiply_add_fast_bf16',
|
|
270
|
+
MathOperation.multiply_add_fast_f16: 'multiply_add_fast_f16',
|
|
271
|
+
MathOperation.multiply_add_fast_f32: 'multiply_add_fast_f32',
|
|
272
|
+
MathOperation.multiply_add_complex_fast_f32: 'multiply_add_complex_fast_f32',
|
|
273
|
+
MathOperation.multiply_add_complex: 'multiply_add_complex',
|
|
274
|
+
MathOperation.multiply_add_complex_gaussian: 'multiply_add_complex_gaussian',
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
#
|
|
278
|
+
MathOperationTag = {
|
|
279
|
+
MathOperation.multiply_add: 'cutlass::arch::OpMultiplyAdd',
|
|
280
|
+
MathOperation.multiply_add_saturate: 'cutlass::arch::OpMultiplyAddSaturate',
|
|
281
|
+
MathOperation.xor_popc: 'cutlass::arch::OpXorPopc',
|
|
282
|
+
MathOperation.multiply_add_fast_bf16: 'cutlass::arch::OpMultiplyAddFastBF16',
|
|
283
|
+
MathOperation.multiply_add_fast_f16: 'cutlass::arch::OpMultiplyAddFastF16',
|
|
284
|
+
MathOperation.multiply_add_fast_f32: 'cutlass::arch::OpMultiplyAddFastF32',
|
|
285
|
+
MathOperation.multiply_add_complex_fast_f32: 'cutlass::arch::OpMultiplyAddComplexFastF32',
|
|
286
|
+
MathOperation.multiply_add_complex: 'cutlass::arch::OpMultiplyAddComplex',
|
|
287
|
+
MathOperation.multiply_add_complex_gaussian: 'cutlass::arch::OpMultiplyAddGaussianComplex',
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
###################################################################################################
|
|
291
|
+
|
|
292
|
+
#
|
|
293
|
+
LayoutTag = {
|
|
294
|
+
cutlass.ColumnMajor: 'cutlass::layout::ColumnMajor',
|
|
295
|
+
cutlass.RowMajor: 'cutlass::layout::RowMajor',
|
|
296
|
+
cutlass.layout.ColumnMajorInterleaved2: 'cutlass::layout::ColumnMajorInterleaved<2>',
|
|
297
|
+
cutlass.layout.RowMajorInterleaved2: 'cutlass::layout::RowMajorInterleaved<2>',
|
|
298
|
+
cutlass.ColumnMajorInterleaved32: 'cutlass::layout::ColumnMajorInterleaved<32>',
|
|
299
|
+
cutlass.RowMajorInterleaved32: 'cutlass::layout::RowMajorInterleaved<32>',
|
|
300
|
+
cutlass.layout.ColumnMajorInterleaved64: 'cutlass::layout::ColumnMajorInterleaved<64>',
|
|
301
|
+
cutlass.layout.RowMajorInterleaved64: 'cutlass::layout::RowMajorInterleaved<64>',
|
|
302
|
+
cutlass.TensorNHWC: 'cutlass::layout::TensorNHWC',
|
|
303
|
+
cutlass.layout.TensorNDHWC: 'cutlass::layout::TensorNDHWC',
|
|
304
|
+
cutlass.layout.TensorNCHW: 'cutlass::layout::TensorNCHW',
|
|
305
|
+
cutlass.layout.TensorNGHWC: 'cutlass::layout::TensorNGHWC',
|
|
306
|
+
cutlass.TensorNC32HW32: 'cutlass::layout::TensorNCxHWx<32>',
|
|
307
|
+
cutlass.TensorC32RSK32: 'cutlass::layout::TensorCxRSKx<32>',
|
|
308
|
+
cutlass.layout.TensorNC64HW64: 'cutlass::layout::TensorNCxHWx<64>',
|
|
309
|
+
cutlass.layout.TensorC64RSK64: 'cutlass::layout::TensorCxRSKx<64>',
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
#
|
|
313
|
+
TransposedLayout = {
|
|
314
|
+
cutlass.ColumnMajor: cutlass.RowMajor,
|
|
315
|
+
cutlass.RowMajor: cutlass.ColumnMajor,
|
|
316
|
+
cutlass.layout.ColumnMajorInterleaved2: cutlass.layout.RowMajorInterleaved2,
|
|
317
|
+
cutlass.layout.RowMajorInterleaved2: cutlass.layout.ColumnMajorInterleaved2,
|
|
318
|
+
cutlass.ColumnMajorInterleaved32: cutlass.RowMajorInterleaved32,
|
|
319
|
+
cutlass.RowMajorInterleaved32: cutlass.ColumnMajorInterleaved32,
|
|
320
|
+
cutlass.layout.ColumnMajorInterleaved64: cutlass.layout.RowMajorInterleaved64,
|
|
321
|
+
cutlass.layout.RowMajorInterleaved64: cutlass.layout.ColumnMajorInterleaved64,
|
|
322
|
+
cutlass.TensorNHWC: cutlass.TensorNHWC
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
#
|
|
326
|
+
ShortLayoutTypeNames = {
|
|
327
|
+
cutlass.ColumnMajor: 'n',
|
|
328
|
+
cutlass.layout.ColumnMajorInterleaved2: 'n2',
|
|
329
|
+
cutlass.ColumnMajorInterleaved32: 'n32',
|
|
330
|
+
cutlass.layout.ColumnMajorInterleaved64: 'n64',
|
|
331
|
+
cutlass.RowMajor: 't',
|
|
332
|
+
cutlass.layout.RowMajorInterleaved2: 't2',
|
|
333
|
+
cutlass.RowMajorInterleaved32: 't32',
|
|
334
|
+
cutlass.layout.RowMajorInterleaved64: 't64',
|
|
335
|
+
cutlass.TensorNHWC: 'nhwc',
|
|
336
|
+
cutlass.layout.TensorNDHWC: 'ndhwc',
|
|
337
|
+
cutlass.layout.TensorNCHW: 'nchw',
|
|
338
|
+
cutlass.layout.TensorNGHWC: 'nghwc',
|
|
339
|
+
cutlass.TensorNC32HW32: 'nc32hw32',
|
|
340
|
+
cutlass.layout.TensorNC64HW64: 'nc64hw64',
|
|
341
|
+
cutlass.TensorC32RSK32: 'c32rsk32',
|
|
342
|
+
cutlass.layout.TensorC64RSK64: 'c64rsk64'
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
#
|
|
346
|
+
ShortComplexLayoutNames = {
|
|
347
|
+
(cutlass.ColumnMajor, cutlass.complex_transform.none): 'n',
|
|
348
|
+
(cutlass.ColumnMajor, cutlass.complex_transform.conj): 'c',
|
|
349
|
+
(cutlass.RowMajor, cutlass.complex_transform.none): 't',
|
|
350
|
+
(cutlass.RowMajor, cutlass.complex_transform.conj): 'h'
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
###################################################################################################
|
|
354
|
+
|
|
355
|
+
#
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
class SideMode(enum.Enum):
|
|
359
|
+
Left = enum_auto()
|
|
360
|
+
Right = enum_auto()
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
#
|
|
364
|
+
SideModeTag = {
|
|
365
|
+
SideMode.Left: 'cutlass::SideMode::kLeft',
|
|
366
|
+
SideMode.Right: 'cutlass::SideMode::kRight'
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
#
|
|
370
|
+
ShortSideModeNames = {
|
|
371
|
+
SideMode.Left: 'ls',
|
|
372
|
+
SideMode.Right: 'rs'
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
###################################################################################################
|
|
376
|
+
|
|
377
|
+
#
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
class FillMode(enum.Enum):
|
|
381
|
+
Lower = enum_auto()
|
|
382
|
+
Upper = enum_auto()
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
#
|
|
386
|
+
FillModeTag = {
|
|
387
|
+
FillMode.Lower: 'cutlass::FillMode::kLower',
|
|
388
|
+
FillMode.Upper: 'cutlass::FillMode::kUpper'
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
#
|
|
392
|
+
ShortFillModeNames = {
|
|
393
|
+
FillMode.Lower: 'l',
|
|
394
|
+
FillMode.Upper: 'u'
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
###################################################################################################
|
|
398
|
+
|
|
399
|
+
#
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class DiagType(enum.Enum):
|
|
403
|
+
NonUnit = enum_auto()
|
|
404
|
+
Unit = enum_auto()
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
#
|
|
408
|
+
DiagTypeTag = {
|
|
409
|
+
DiagType.NonUnit: 'cutlass::DiagType::kNonUnit',
|
|
410
|
+
DiagType.Unit: 'cutlass::DiagType::kUnit'
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
#
|
|
414
|
+
ShortDiagTypeNames = {
|
|
415
|
+
DiagType.NonUnit: 'nu',
|
|
416
|
+
DiagType.Unit: 'un'
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
###################################################################################################
|
|
420
|
+
|
|
421
|
+
OpcodeClassNames = {
|
|
422
|
+
cutlass.OpClass.Simt: 'simt',
|
|
423
|
+
cutlass.OpClass.TensorOp: 'tensorop',
|
|
424
|
+
cutlass.OpClass.WmmaTensorOp: 'wmma_tensorop',
|
|
425
|
+
cutlass.OpClass.SparseTensorOp: 'sptensorop'
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
OpcodeClassTag = {
|
|
429
|
+
cutlass.OpClass.Simt: 'cutlass::arch::OpClassSimt',
|
|
430
|
+
cutlass.OpClass.TensorOp: 'cutlass::arch::OpClassTensorOp',
|
|
431
|
+
cutlass.OpClass.WmmaTensorOp: 'cutlass::arch::OpClassWmmaTensorOp',
|
|
432
|
+
cutlass.OpClass.SparseTensorOp: 'cutlass::arch::OpClassSparseTensorOp'
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
###################################################################################################
|
|
436
|
+
|
|
437
|
+
#
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
class OperationKind(enum.Enum):
|
|
441
|
+
Gemm = enum_auto()
|
|
442
|
+
RankK = enum_auto()
|
|
443
|
+
Rank2K = enum_auto()
|
|
444
|
+
Trmm = enum_auto()
|
|
445
|
+
Symm = enum_auto()
|
|
446
|
+
Conv2d = enum_auto()
|
|
447
|
+
Conv3d = enum_auto()
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
#
|
|
451
|
+
OperationKindNames = {
|
|
452
|
+
OperationKind.Gemm: 'gemm', OperationKind.RankK: 'rank_k', OperationKind.Rank2K: 'rank_2k', OperationKind.Trmm: 'trmm', OperationKind.Symm: 'symm', OperationKind.Conv2d: 'conv2d', OperationKind.Conv3d: 'conv3d'
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
#
|
|
456
|
+
ArchitectureNames = {
|
|
457
|
+
50: 'maxwell',
|
|
458
|
+
60: 'pascal',
|
|
459
|
+
61: 'pascal',
|
|
460
|
+
70: 'volta',
|
|
461
|
+
75: 'turing',
|
|
462
|
+
80: 'ampere',
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
#
|
|
466
|
+
SharedMemPerCC = {
|
|
467
|
+
70: 96, # 96KB of SMEM
|
|
468
|
+
72: 96, # 96KB of SMEM
|
|
469
|
+
75: 64, # 64KB of SMEM
|
|
470
|
+
80: 160, # 164KB of SMEM - 4KB reserved for the driver
|
|
471
|
+
86: 100, # 100KB of SMEM
|
|
472
|
+
87: 160, # 164KB of SMEM - 4KB reserved for the driver
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
###################################################################################################
|
|
476
|
+
|
|
477
|
+
class GemmKind(enum.Enum):
|
|
478
|
+
Gemm = enum_auto()
|
|
479
|
+
Sparse = enum_auto()
|
|
480
|
+
Universal = enum_auto()
|
|
481
|
+
PlanarComplex = enum_auto()
|
|
482
|
+
PlanarComplexArray = enum_auto()
|
|
483
|
+
Grouped = enum_auto()
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
#
|
|
487
|
+
GemmKindNames = {
|
|
488
|
+
GemmKind.Gemm: "gemm",
|
|
489
|
+
GemmKind.Sparse: "spgemm",
|
|
490
|
+
GemmKind.Universal: "gemm",
|
|
491
|
+
GemmKind.PlanarComplex: "gemm_planar_complex",
|
|
492
|
+
GemmKind.PlanarComplexArray: "gemm_planar_complex_array",
|
|
493
|
+
GemmKind.Grouped: "gemm_grouped"
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
#
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
class RankKKind(enum.Enum):
|
|
500
|
+
Universal = enum_auto()
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
#
|
|
504
|
+
RankKKindNames = {
|
|
505
|
+
RankKKind.Universal: "rank_k"
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
#
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
class TrmmKind(enum.Enum):
|
|
512
|
+
Universal = enum_auto()
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
#
|
|
516
|
+
TrmmKindNames = {
|
|
517
|
+
TrmmKind.Universal: "trmm"
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
#
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
class SymmKind(enum.Enum):
|
|
524
|
+
Universal = enum_auto()
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
#
|
|
528
|
+
SymmKindNames = {
|
|
529
|
+
SymmKind.Universal: "symm"
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
#
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
class SwizzlingFunctor(enum.Enum):
|
|
536
|
+
Identity1 = enum_auto()
|
|
537
|
+
Identity2 = enum_auto()
|
|
538
|
+
Identity4 = enum_auto()
|
|
539
|
+
Identity8 = enum_auto()
|
|
540
|
+
Horizontal = enum_auto()
|
|
541
|
+
BatchedIdentity1 = enum_auto()
|
|
542
|
+
StridedDgradIdentity1 = enum_auto()
|
|
543
|
+
StridedDgradIdentity4 = enum_auto()
|
|
544
|
+
StridedDgradHorizontal = enum_auto()
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
#
|
|
548
|
+
SwizzlingFunctorTag = {
|
|
549
|
+
cutlass.IdentitySwizzle1: 'cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<1>',
|
|
550
|
+
SwizzlingFunctor.Identity2: 'cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<2>',
|
|
551
|
+
SwizzlingFunctor.Identity4: 'cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<4>',
|
|
552
|
+
SwizzlingFunctor.Identity8: 'cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<8>',
|
|
553
|
+
SwizzlingFunctor.Horizontal: 'cutlass::gemm::threadblock::GemmHorizontalThreadblockSwizzle',
|
|
554
|
+
SwizzlingFunctor.BatchedIdentity1: "cutlass::gemm::threadblock::GemmBatchedIdentityThreadblockSwizzle",
|
|
555
|
+
SwizzlingFunctor.StridedDgradIdentity1: 'cutlass::conv::threadblock::StridedDgradIdentityThreadblockSwizzle<1>',
|
|
556
|
+
SwizzlingFunctor.StridedDgradIdentity4: 'cutlass::conv::threadblock::StridedDgradIdentityThreadblockSwizzle<4>',
|
|
557
|
+
SwizzlingFunctor.StridedDgradHorizontal: 'cutlass::conv::threadblock::StridedDgradHorizontalThreadblockSwizzle',
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
#
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
class SchedulerMode(enum.Enum):
|
|
564
|
+
Device = enum_auto(),
|
|
565
|
+
Host = enum_auto()
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
#
|
|
569
|
+
SchedulerModeTag = {
|
|
570
|
+
SchedulerMode.Device: 'cutlass::gemm::kernel::GroupScheduleMode::kDeviceOnly',
|
|
571
|
+
SchedulerMode.Host: 'cutlass::gemm::kernel::GroupScheduleMode::kHostPrecompute'
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
#
|
|
575
|
+
ShortSchedulerModeNames = {
|
|
576
|
+
SchedulerMode.Device: 'Device',
|
|
577
|
+
SchedulerMode.Host: 'Host'
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
###################################################################################################
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
#
|
|
584
|
+
ConvKindTag = {
|
|
585
|
+
cutlass.conv.Operator.fprop: 'cutlass::conv::Operator::kFprop',
|
|
586
|
+
cutlass.conv.Operator.dgrad: 'cutlass::conv::Operator::kDgrad',
|
|
587
|
+
cutlass.conv.Operator.wgrad: 'cutlass::conv::Operator::kWgrad'
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
ConvKindNames = {
|
|
591
|
+
cutlass.conv.Operator.fprop: 'fprop',
|
|
592
|
+
cutlass.conv.Operator.dgrad: 'dgrad',
|
|
593
|
+
cutlass.conv.Operator.wgrad: 'wgrad',
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
#
|
|
598
|
+
IteratorAlgorithmTag = {
|
|
599
|
+
cutlass.conv.IteratorAlgorithm.analytic: 'cutlass::conv::IteratorAlgorithm::kAnalytic',
|
|
600
|
+
cutlass.conv.IteratorAlgorithm.optimized: 'cutlass::conv::IteratorAlgorithm::kOptimized',
|
|
601
|
+
cutlass.conv.IteratorAlgorithm.fixed_channels: 'cutlass::conv::IteratorAlgorithm::kFixedChannels',
|
|
602
|
+
cutlass.conv.IteratorAlgorithm.few_channels: 'cutlass::conv::IteratorAlgorithm::kFewChannels'
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
IteratorAlgorithmNames = {
|
|
606
|
+
cutlass.conv.IteratorAlgorithm.analytic: 'analytic',
|
|
607
|
+
cutlass.conv.IteratorAlgorithm.optimized: 'optimized',
|
|
608
|
+
cutlass.conv.IteratorAlgorithm.fixed_channels: 'fixed_channels',
|
|
609
|
+
cutlass.conv.IteratorAlgorithm.few_channels: 'few_channels'
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
#
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
class StrideSupport(enum.Enum):
|
|
616
|
+
Strided = enum_auto()
|
|
617
|
+
Unity = enum_auto()
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
#
|
|
621
|
+
StrideSupportTag = {
|
|
622
|
+
StrideSupport.Strided: 'cutlass::conv::StrideSupport::kStrided',
|
|
623
|
+
StrideSupport.Unity: 'cutlass::conv::StrideSupport::kUnity',
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
StrideSupportNames = {
|
|
627
|
+
StrideSupport.Strided: '',
|
|
628
|
+
StrideSupport.Unity: 'unity_stride',
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
class ConvMode(enum.Enum):
|
|
633
|
+
CrossCorrelation = enum_auto()
|
|
634
|
+
Convolution = enum_auto()
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
#
|
|
638
|
+
ConvModeTag = {
|
|
639
|
+
ConvMode.CrossCorrelation: 'cutlass::conv::Mode::kCrossCorrelation',
|
|
640
|
+
ConvMode.Convolution: 'cutlass::conv::Mode::kConvolution'
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
###################################################################################################
|
|
644
|
+
|
|
645
|
+
#
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
class MathInstruction:
|
|
649
|
+
def __init__(self, instruction_shape, element_a, element_b, element_accumulator, opcode_class=cutlass.OpClass.Simt, math_operation=MathOperation.multiply_add):
|
|
650
|
+
self.instruction_shape = instruction_shape
|
|
651
|
+
self.element_a = element_a
|
|
652
|
+
self.element_b = element_b
|
|
653
|
+
self.element_accumulator = element_accumulator
|
|
654
|
+
self.opcode_class = opcode_class
|
|
655
|
+
self.math_operation = math_operation
|
|
656
|
+
|
|
657
|
+
#
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
class TileDescription:
|
|
661
|
+
|
|
662
|
+
def __init__(self, threadblock_shape, stages, warp_count, math_instruction):
|
|
663
|
+
self.threadblock_shape = threadblock_shape
|
|
664
|
+
|
|
665
|
+
#: number of pipeline stages
|
|
666
|
+
self.stages: int = stages
|
|
667
|
+
|
|
668
|
+
#: number of warps along x, y, z directions
|
|
669
|
+
self.warp_count: list[int] = warp_count
|
|
670
|
+
self.math_instruction = math_instruction
|
|
671
|
+
|
|
672
|
+
#: number threads per threadblock
|
|
673
|
+
self.num_threads: int = 32
|
|
674
|
+
for cnt in self.warp_count:
|
|
675
|
+
self.num_threads *= cnt
|
|
676
|
+
|
|
677
|
+
def procedural_name(self):
|
|
678
|
+
return "%dx%d_%dx%d" % (self.threadblock_shape[0], self.threadblock_shape[1], self.threadblock_shape[2], self.stages)
|
|
679
|
+
|
|
680
|
+
#
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
class TensorDescription:
|
|
684
|
+
def __init__(self, element, layout, alignment=1, complex_transform=cutlass.complex_transform.none):
|
|
685
|
+
self.element = element
|
|
686
|
+
self.layout = layout
|
|
687
|
+
self.alignment = min(128 // DataTypeSize[self.element], alignment)
|
|
688
|
+
self.complex_transform = complex_transform
|
|
689
|
+
|
|
690
|
+
#
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
class SymmetricTensorDescription:
|
|
694
|
+
def __init__(self, element, layout, fill_mode, alignment=1, complex_transform=cutlass.complex_transform.none, side_mode=SideMode.Left):
|
|
695
|
+
self.element = element
|
|
696
|
+
self.layout = layout
|
|
697
|
+
self.fill_mode = fill_mode
|
|
698
|
+
self.alignment = alignment
|
|
699
|
+
self.complex_transform = complex_transform
|
|
700
|
+
self.side_mode = side_mode
|
|
701
|
+
|
|
702
|
+
#
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
class TriangularTensorDescription:
|
|
706
|
+
def __init__(self, element, layout, side_mode, fill_mode, diag_type, alignment=1, complex_transform=cutlass.complex_transform.none):
|
|
707
|
+
self.element = element
|
|
708
|
+
self.layout = layout
|
|
709
|
+
self.side_mode = side_mode
|
|
710
|
+
self.fill_mode = fill_mode
|
|
711
|
+
self.diag_type = diag_type
|
|
712
|
+
self.alignment = alignment
|
|
713
|
+
self.complex_transform = complex_transform
|
|
714
|
+
|
|
715
|
+
###################################################################################################
|
|
716
|
+
|
|
717
|
+
#
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
def CalculateSmemUsage(operation):
|
|
721
|
+
cta_shape = operation.tile_description.threadblock_shape
|
|
722
|
+
stages = operation.tile_description.stages
|
|
723
|
+
|
|
724
|
+
if operation.operation_kind == OperationKind.Gemm and operation.gemm_kind == GemmKind.Sparse:
|
|
725
|
+
# Elements represented by 8 bits of metadata (based on 4:8, 2:4 or 1:2 sparsity)
|
|
726
|
+
if DataTypeSize[operation.A.element] == 32:
|
|
727
|
+
elements_per_8b_md = 2
|
|
728
|
+
elif DataTypeSize[operation.A.element] == 4:
|
|
729
|
+
elements_per_8b_md = 8
|
|
730
|
+
else:
|
|
731
|
+
elements_per_8b_md = 4
|
|
732
|
+
|
|
733
|
+
smem_per_stage = DataTypeSize[operation.A.element] * cta_shape[0] * (cta_shape[2] // 2) // 8 + \
|
|
734
|
+
DataTypeSize[operation.B.element] * cta_shape[1] * cta_shape[2] // 8 + \
|
|
735
|
+
cta_shape[0] * (cta_shape[2] // 2) // elements_per_8b_md
|
|
736
|
+
else:
|
|
737
|
+
# Few BLAS3 operations only have A tensor
|
|
738
|
+
smem_per_stage = DataTypeSize[operation.A.element] * cta_shape[0] * cta_shape[2] // 8 + \
|
|
739
|
+
DataTypeSize[operation.A.element] * \
|
|
740
|
+
cta_shape[1] * cta_shape[2] // 8
|
|
741
|
+
|
|
742
|
+
smem_usage = smem_per_stage * stages
|
|
743
|
+
return (smem_usage >> 10)
|
|
744
|
+
###################################################################################################
|