Matt300209 commited on
Commit
1efd17a
·
verified ·
1 Parent(s): d729238

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/CMakeLists.txt +755 -0
  2. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/__pycache__/simt_sm50.cpython-310.pyc +0 -0
  3. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/default_gemm_configuration.hpp +1366 -0
  4. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32n_tensor_op_s32_sm75.cu +232 -0
  5. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32n_tensor_op_s32_sm80.cu +704 -0
  6. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32n_wmma_tensor_op_s32_sm75.cu +243 -0
  7. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32t_tensor_op_s32_sm75.cu +230 -0
  8. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32t_tensor_op_s32_sm80.cu +378 -0
  9. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32t_wmma_tensor_op_s32_sm75.cu +242 -0
  10. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_bf16n_bf16n_f32t_tensor_op_f32_sm80.cu +359 -0
  11. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_bf16t_bf16t_bf16t_tensor_op_f32_sm80.cu +343 -0
  12. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32_sm80.cu +259 -0
  13. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32_sm80.cu +258 -0
  14. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64n_cf64t_cf64t_tensor_op_f64_sm90.cu +251 -0
  15. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian_sm80.cu +197 -0
  16. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian_sm90.cu +196 -0
  17. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64t_cf64n_cf64t_tensor_op_f64_sm90.cu +303 -0
  18. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16n_direct_store_tensor_op_f32_sm80.cu +114 -0
  19. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16n_wmma_tensor_op_f16_sm70.cu +157 -0
  20. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16n_wmma_tensor_op_f32_sm70.cu +154 -0
  21. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_tensor_op_f32_sm75.cu +307 -0
  22. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_tensor_op_f32_sm80.cu +344 -0
  23. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_tensor_op_f32_sparse_sm80.cu +291 -0
  24. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_volta_tensor_op_f32_sm70.cu +274 -0
  25. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_wmma_tensor_op_f16_sm70.cu +404 -0
  26. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_wmma_tensor_op_f32_sm70.cu +403 -0
  27. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32n_tensor_op_f32_sm75.cu +307 -0
  28. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32n_tensor_op_f32_sm80.cu +343 -0
  29. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32n_wmma_tensor_op_f32_sm70.cu +159 -0
  30. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_tensor_op_f32_sm75.cu +307 -0
  31. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_tensor_op_f32_sm80.cu +346 -0
  32. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_tensor_op_f32_sparse_sm80.cu +273 -0
  33. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_volta_tensor_op_f32_sm70.cu +274 -0
  34. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_wmma_tensor_op_f32_sm70.cu +344 -0
  35. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16n_wmma_tensor_op_f16_sm70.cu +157 -0
  36. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_slicedk_sm75.cu +88 -0
  37. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_slicedk_sm80.cu +88 -0
  38. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_sm75.cu +243 -0
  39. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_sm80.cu +344 -0
  40. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_sparse_sm80.cu +271 -0
  41. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_volta_tensor_op_f16_sm70.cu +267 -0
  42. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_wmma_tensor_op_f32_sm70.cu +87 -0
  43. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32n_wmma_tensor_op_f32_sm70.cu +159 -0
  44. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_tensor_op_f32_sm75.cu +243 -0
  45. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_tensor_op_f32_sm80.cu +384 -0
  46. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_tensor_op_f32_sparse_sm80.cu +272 -0
  47. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_volta_tensor_op_f32_sm70.cu +267 -0
  48. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_wmma_tensor_op_f32_sm70.cu +344 -0
  49. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16t_f16n_f16n_wmma_tensor_op_f16_sm70.cu +157 -0
  50. venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16t_f16n_f16n_wmma_tensor_op_f32_sm70.cu +155 -0
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/CMakeLists.txt ADDED
@@ -0,0 +1,755 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ # SPDX-License-Identifier: BSD-3-Clause
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # 1. Redistributions of source code must retain the above copyright notice, this
8
+ # list of conditions and the following disclaimer.
9
+ #
10
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # 3. Neither the name of the copyright holder nor the names of its
15
+ # contributors may be used to endorse or promote products derived from
16
+ # this software without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
29
+ add_custom_target(
30
+ cutlass_test_unit_gemm_device
31
+ DEPENDS
32
+ cutlass_test_unit_gemm_device_simt
33
+ cutlass_test_unit_gemm_device_tensorop_sm70
34
+ cutlass_test_unit_gemm_device_tensorop_sm75
35
+ cutlass_test_unit_gemm_device_tensorop_f16_sm80
36
+ cutlass_test_unit_gemm_device_tensorop_f32_sm80
37
+ cutlass_test_unit_gemm_device_tensorop_f32_tf32_sm80
38
+ cutlass_test_unit_gemm_device_tensorop_f64
39
+ cutlass_test_unit_gemm_device_tensorop_s32_sm80
40
+ cutlass_test_unit_gemm_device_wmma
41
+ cutlass_test_unit_gemm_device_tensorop_planar_complex
42
+ cutlass_test_unit_gemm_device_sparse_tensorop_sm80
43
+ cutlass_test_unit_gemv_device
44
+ cutlass_test_unit_gemm_device_tensorop_sm90
45
+ cutlass_test_unit_gemm_device_tensorop_cluster_multicast_sm90
46
+ )
47
+
48
+ add_custom_target(
49
+ test_unit_gemm_device
50
+ DEPENDS
51
+ test_unit_gemm_device_simt
52
+ test_unit_gemm_device_tensorop_sm70
53
+ test_unit_gemm_device_tensorop_sm75
54
+ test_unit_gemm_device_tensorop_f16_sm80
55
+ test_unit_gemm_device_tensorop_f32_sm80
56
+ test_unit_gemm_device_tensorop_f32_tf32_sm80
57
+ test_unit_gemm_device_tensorop_f64
58
+ test_unit_gemm_device_tensorop_s32_sm80
59
+ test_unit_gemm_device_wmma
60
+ test_unit_gemm_device_tensorop_planar_complex
61
+ test_unit_gemm_device_sparse_tensorop_sm80
62
+ test_unit_gemv_device
63
+ test_unit_gemm_device_tensorop_sm90
64
+ )
65
+
66
+ add_custom_target(
67
+ cutlass_test_unit_gemm_device_sm90
68
+ DEPENDS
69
+ cutlass_test_unit_gemm_device_tensorop_sm90
70
+ cutlass_test_unit_gemm_device_tensorop_cluster_multicast_sm90
71
+ )
72
+
73
+ cutlass_test_unit_add_executable(
74
+ cutlass_test_unit_gemm_device_simt
75
+
76
+ BATCH_SOURCES ON
77
+ BATCH_SIZE 4
78
+
79
+ simt_sgemm_nt_sm80.cu
80
+ simt_sgemm_tn_sm80.cu
81
+
82
+ simt_cgemm_nt_sm80.cu
83
+ simt_cgemm_tn_sm80.cu
84
+
85
+ simt_f8gemm_tn_sm50.cu
86
+
87
+ simt_cgemm_nn_sm50.cu
88
+ simt_cgemm_nt_sm50.cu
89
+ simt_cgemm_tn_sm50.cu
90
+ simt_cgemm_tt_sm50.cu
91
+
92
+ simt_qgemm_nn_sm50.cu
93
+ simt_qgemm_nt_sm50.cu
94
+ simt_qgemm_tn_sm50.cu
95
+ simt_qgemm_tt_sm50.cu
96
+
97
+ simt_dgemm_nn_sm50.cu
98
+ simt_dgemm_nt_sm50.cu
99
+ simt_dgemm_tn_sm50.cu
100
+ simt_dgemm_tt_sm50.cu
101
+
102
+ simt_hgemm_nn_sm50.cu
103
+ simt_hgemm_nt_sm50.cu
104
+ simt_hgemm_tn_sm50.cu
105
+ simt_hgemm_tt_sm50.cu
106
+
107
+ simt_igemm_nn_sm50.cu
108
+ simt_igemm_nt_sm50.cu
109
+ simt_igemm_tn_sm50.cu
110
+ simt_igemm_tt_sm50.cu
111
+
112
+ simt_int8_igemm_sm61_sliced_k.cu
113
+ simt_int8_igemm_sm61.cu
114
+
115
+ simt_sgemm_nn_sm50.cu
116
+ simt_sgemm_nt_sm50.cu
117
+ simt_sgemm_tn_sm50.cu
118
+ simt_sgemm_tt_sm50.cu
119
+
120
+ simt_zgemm_nn_sm50.cu
121
+ simt_zgemm_nt_sm50.cu
122
+ simt_zgemm_tn_sm50.cu
123
+ simt_zgemm_tt_sm50.cu
124
+
125
+ gemm_splitk_simt_sm50.cu
126
+ )
127
+
128
+ cutlass_test_unit_add_executable(
129
+ cutlass_test_unit_gemm_device_simt_3x
130
+
131
+ BATCH_SOURCES ON
132
+ BATCH_SIZE 4
133
+
134
+
135
+ sm50_gemm_f32_f32_f32_simt.cu
136
+ sm80_gemm_f32_f32_f32_simt.cu
137
+ sm50_gemm_f64_f64_f64_simt.cu
138
+ sm80_gemm_f64_f64_f64_simt.cu
139
+ sm61_gemm_s8_s8_s32_simt.cu
140
+ )
141
+
142
+
143
+ cutlass_test_unit_add_executable(
144
+ cutlass_test_unit_gemm_device_tensorop_sm70
145
+
146
+ BATCH_SOURCES ON
147
+ BATCH_SIZE 4
148
+
149
+
150
+ gemm_f16n_f16n_f32t_volta_tensor_op_f32_sm70.cu
151
+ gemm_f16n_f16t_f32t_volta_tensor_op_f32_sm70.cu
152
+ gemm_f16t_f16n_f32t_volta_tensor_op_f32_sm70.cu
153
+ gemm_f16t_f16t_f32t_volta_tensor_op_f32_sm70.cu
154
+
155
+ gemm_f16n_f16n_f16t_volta_tensor_op_f32_sm70.cu
156
+
157
+ gemm_f16n_f16t_f16t_volta_tensor_op_f16_sm70.cu
158
+ gemm_f16t_f16n_f16t_volta_tensor_op_f16_sm70.cu
159
+
160
+ gemm_splitk_tensor_op_sm70.cu
161
+ )
162
+
163
+ cutlass_test_unit_add_executable(
164
+ cutlass_test_unit_gemm_device_tensorop_sm75
165
+
166
+ BATCH_SOURCES ON
167
+ BATCH_SIZE 4
168
+
169
+ gemm_universal_f16n_f16t_f32n_tensor_op_f32_sm75.cu
170
+ gemm_universal_f16n_f16t_f32t_tensor_op_f32_sm75.cu
171
+
172
+ gemm_f16t_f16n_f16t_tensor_op_f16_sm75.cu
173
+ gemm_f16n_f16t_f16t_tensor_op_f16_sm75.cu
174
+ gemm_f16n_f16t_f16t_tensor_op_f16_slicedk_sm75.cu
175
+ gemm_f16t_f16n_f16t_tensor_op_f16_slicedk_sm75.cu
176
+
177
+ gemm_f16n_f16n_f16t_tensor_op_f32_sm75.cu
178
+
179
+ gemm_f16n_f16n_f32t_tensor_op_f32_sm75.cu
180
+ gemm_f16n_f16t_f32t_tensor_op_f32_sm75.cu
181
+ gemm_f16t_f16n_f32t_tensor_op_f32_sm75.cu
182
+ gemm_f16t_f16t_f32t_tensor_op_f32_sm75.cu
183
+
184
+ gemm_f16n_f16n_f32n_tensor_op_f32_sm75.cu
185
+ gemm_f16t_f16t_f32n_tensor_op_f32_sm75.cu
186
+
187
+ gemm_s8n_s8t_s8n_tensor_op_s32_sm75.cu
188
+ gemm_s8t_s8n_s32t_tensor_op_s32_sm75.cu
189
+ gemm_s8t_s8n_s32n_tensor_op_s32_sm75.cu
190
+ gemm_s8t_s8n_s8t_tensor_op_s32_sm75.cu
191
+ gemm_s8t_s8n_s8n_tensor_op_s32_sm75.cu
192
+
193
+ gemm_s4n_s4t_s4n_tensor_op_s32_sm75.cu
194
+ gemm_s4t_s4n_s32t_tensor_op_s32_sm75.cu
195
+ gemm_s4t_s4n_s32n_tensor_op_s32_sm75.cu
196
+ gemm_s4t_s4n_s4n_tensor_op_s32_sm75.cu
197
+ gemm_s4t_s4n_s4t_tensor_op_s32_sm75.cu
198
+
199
+ gemm_b1t_b1n_s32t_tensor_op_s32_sm75.cu
200
+ gemm_b1t_b1n_s32n_tensor_op_s32_sm75.cu
201
+
202
+ gemm_splitk_serial_tensor_op_sm75.cu
203
+ gemm_splitk_tensor_op_sm75.cu
204
+
205
+ )
206
+
207
+ cutlass_test_unit_add_executable(
208
+ cutlass_test_unit_gemm_device_tensorop_f16_sm80
209
+
210
+ BATCH_SOURCES ON
211
+ BATCH_SIZE 4
212
+
213
+ gemm_f16t_f16n_f16t_tensor_op_f16_slicedk_sm80.cu
214
+ gemm_f16n_f16t_f16t_tensor_op_f16_slicedk_sm80.cu
215
+ )
216
+
217
+ cutlass_test_unit_add_executable(
218
+ cutlass_test_unit_gemm_device_tensorop_f32_sm80
219
+
220
+ BATCH_SOURCES ON
221
+ BATCH_SIZE 4
222
+
223
+ gemm_f16n_f16n_f16t_tensor_op_f32_sm80.cu
224
+ gemm_f16n_f16n_f32n_tensor_op_f32_sm80.cu
225
+ gemm_f16n_f16n_f32t_tensor_op_f32_sm80.cu
226
+ gemm_f16n_f16t_f16t_tensor_op_f16_sm80.cu
227
+ gemm_f16n_f16t_f32t_tensor_op_f32_sm80.cu
228
+ gemm_f16t_f16n_f16t_tensor_op_f16_sm80.cu
229
+ gemm_f16t_f16n_f32t_tensor_op_f32_sm80.cu
230
+ gemm_f16t_f16t_f32n_tensor_op_f32_sm80.cu
231
+ gemm_f16t_f16t_f32t_tensor_op_f32_sm80.cu
232
+ gemm_bf16n_bf16n_f32t_tensor_op_f32_sm80.cu
233
+ gemm_bf16t_bf16t_bf16t_tensor_op_f32_sm80.cu
234
+ gemm_f16n_f16n_f16n_direct_store_tensor_op_f32_sm80.cu
235
+ )
236
+
237
+ cutlass_test_unit_add_executable(
238
+ cutlass_test_unit_gemm_device_tensorop_f32_sm80_3x
239
+
240
+ sm80_gemm_s8_s8_s32_tensor_op.cu
241
+ sm80_gemm_f16_f16_f32_tensor_op_f32.cu
242
+ sm80_gemm_tf32_tf32_f32_tensor_op_f32.cu
243
+ )
244
+
245
+ cutlass_test_unit_add_executable(
246
+ cutlass_test_unit_gemm_device_tensorop_sm90
247
+
248
+ BATCH_SOURCES ON
249
+ BATCH_SIZE 4
250
+
251
+ sm90_gemm_f16_f16_f16_tensor_op.cu
252
+ sm90_gemm_bf16_bf16_bf16_tensor_op_f32.cu
253
+ sm90_gemm_s8_s8_s8_tensor_op_s32.cu
254
+ sm90_gemm_tf32_tf32_f32_tensor_op_f32.cu
255
+ sm90_gemm_f32_f32_f32_tensor_op_f32.cu
256
+ sm90_gemm_f8_f8_f32_tensor_op_fp32.cu
257
+ sm90_gemm_f8_f8_bf16_tensor_op_fp32.cu
258
+ sm90_gemm_f8_f8_f8_tensor_op_fp32.cu
259
+ )
260
+
261
+ cutlass_test_unit_add_executable(
262
+ cutlass_test_unit_gemm_device_tensorop_sm90_stream_k
263
+
264
+ sm90_gemm_stream_k_scheduler.cu
265
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cooperative_stream_k.cu
266
+ sm90_gemm_f8_f8_f32_tensor_op_f32_cooperative_stream_k.cu
267
+ )
268
+
269
+ # Alignment tests
270
+ cutlass_test_unit_add_executable(
271
+ cutlass_test_unit_gemm_device_tensorop_alignx_sm90
272
+
273
+ BATCH_SOURCES ON
274
+ BATCH_SIZE 4
275
+ sm90_gemm_f16_f16_f16_alignx_tensor_op.cu
276
+ sm90_gemm_bf16_bf16_bf16_alignx_tensor_op_f32.cu
277
+ sm90_gemm_s8_s8_s8_alignx_tensor_op_s32.cu
278
+ sm90_gemm_tf32_tf32_f32_alignx_tensor_op_f32.cu
279
+ )
280
+
281
+ # Fused epilogue tests
282
+ cutlass_test_unit_add_executable(
283
+ cutlass_test_unit_gemm_device_tensorop_epilogue_fusion_sm90
284
+
285
+ BATCH_SOURCES ON
286
+ BATCH_SIZE 4
287
+ sm90_gemm_f16_f16_f16_tensor_op_f32_tensor_broadcast.cu
288
+ sm90_gemm_f32_f32_f32_tensor_op_f32_tensor_broadcast.cu
289
+ sm90_gemm_s8_s8_s8_tensor_op_s32_tensor_broadcast.cu
290
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_cooperative_bias_elementwise.cu
291
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_pingpong_bias_elementwise.cu
292
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_cooperative_aux_load.cu
293
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_pingpong_aux_load.cu
294
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_cooperative_row_broadcast.cu
295
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_pingpong_row_broadcast.cu
296
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_cooperative_reduce.cu
297
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_pingpong_reduce.cu
298
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_cooperative_dag.cu
299
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_pingpong_dag.cu
300
+ )
301
+
302
+ cutlass_test_unit_add_executable(
303
+ cutlass_test_unit_gemm_device_tensorop_cluster_multicast_sm90
304
+
305
+ BATCH_SOURCES ON
306
+ BATCH_SIZE 4
307
+
308
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_unspecialized.cu
309
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized.cu
310
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_pingpong.cu
311
+ sm90_gemm_f16_f16_f16_tensor_op_f32_cluster_warpspecialized_cooperative.cu
312
+ sm90_gemm_f8_f8_f32_tensor_op_f32_cluster_warpspecialized_cooperative.cu
313
+ )
314
+
315
+ cutlass_test_unit_add_executable(
316
+ cutlass_test_unit_gemm_device_tensorop_gmma_rs_warpspecialized_sm90
317
+
318
+ BATCH_SOURCES ON
319
+ BATCH_SIZE 4
320
+
321
+ sm90_gemm_tf32_tf32_f32_tensor_op_f32_gmma_rs_cluster_warpspecialized.cu
322
+ )
323
+
324
+ cutlass_test_unit_add_executable(
325
+ cutlass_test_unit_gemm_device_tensorop_f32_tf32_sm80
326
+
327
+ BATCH_SOURCES ON
328
+ BATCH_SIZE 4
329
+
330
+ gemm_tf32t_tf32n_f32t_tensor_op_f32_sm80.cu
331
+ gemm_tf32n_tf32t_f32t_tensor_op_f32_sm80.cu
332
+ gemm_tf32n_tf32n_f32t_tensor_op_f32_sm80.cu
333
+ gemm_tf32t_tf32t_f32t_tensor_op_f32_sm80.cu
334
+ gemm_universal_cf32n_cf32n_cf32n_tensor_op_f32_sm80.cu
335
+ gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32_sm80.cu
336
+ gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32_sm80.cu
337
+
338
+ gemm_f32n_f32n_f32t_tensor_op_f32_sm80.cu
339
+ gemm_f32n_f32n_f32t_tensor_op_bf16_f32_sm80.cu
340
+
341
+ sm80_gemm_f16_f16_f32_tensor_op_f32.cu
342
+ )
343
+
344
+ cutlass_test_unit_add_executable(
345
+ cutlass_test_unit_gemm_device_tensorop_f64
346
+
347
+ BATCH_SOURCES ON
348
+ BATCH_SIZE 4
349
+
350
+ gemm_f64n_f64t_f64t_tensor_op_f64_sm80.cu
351
+ gemm_f64t_f64n_f64t_tensor_op_f64_sm80.cu
352
+
353
+ gemm_universal_cf64n_cf64t_cf64t_tensor_op_f64_sm80.cu
354
+ gemm_universal_cf64n_cf64t_cf64t_tensor_op_f64_gaussian_sm80.cu
355
+ gemm_cf64n_cf64t_cf64t_tensor_op_f64_sm80.cu
356
+ gemm_cf64t_cf64n_cf64t_tensor_op_f64_sm80.cu
357
+ gemm_cf64n_cf64t_cf64t_tensor_op_f64_gaussian_sm80.cu
358
+ gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian_sm80.cu
359
+
360
+ # SM90 device level tests
361
+ gemm_f64n_f64t_f64t_tensor_op_f64_sm90.cu
362
+ gemm_f64t_f64n_f64t_tensor_op_f64_sm90.cu
363
+
364
+ sm80_gemm_f64_f64_f64_tensor_op_f64.cu
365
+
366
+ gemm_cf64n_cf64t_cf64t_tensor_op_f64_sm90.cu
367
+ gemm_cf64t_cf64n_cf64t_tensor_op_f64_sm90.cu
368
+ gemm_cf64n_cf64t_cf64t_tensor_op_f64_gaussian_sm90.cu
369
+ gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian_sm90.cu
370
+ )
371
+
372
+ cutlass_test_unit_add_executable(
373
+ cutlass_test_unit_gemm_device_tensorop_s32_sm80
374
+
375
+ BATCH_SOURCES ON
376
+ BATCH_SIZE 4
377
+
378
+ gemm_s8t_s8n_s32t_tensor_op_s32_sm80.cu
379
+ gemm_s8t_s8n_s32n_tensor_op_s32_sm80.cu
380
+ gemm_s8t_s8n_s8n_tensor_op_s32_sm80.cu
381
+ gemm_s8t_s8n_s8t_tensor_op_s32_sm80.cu
382
+ gemm_s8t_s8n_f16t_tensor_op_s32_sm80.cu
383
+ gemm_s4t_s4n_s32n_tensor_op_s32_sm80.cu
384
+ gemm_s4t_s4n_s32t_tensor_op_s32_sm80.cu
385
+ gemm_s4t_s4n_s4n_tensor_op_s32_sm80.cu
386
+ gemm_s4t_s4n_s4t_tensor_op_s32_sm80.cu
387
+ gemm_b1t_b1n_s32n_tensor_op_s32_sm80.cu
388
+ gemm_b1t_b1n_s32t_tensor_op_s32_sm80.cu
389
+
390
+ gemm_s8n_s8t_s8n_tensor_op_s32_sm80.cu
391
+ gemm_s4n_s4t_s4n_tensor_op_s32_sm80.cu
392
+ )
393
+
394
+ cutlass_test_unit_add_executable(
395
+ cutlass_test_unit_gemm_device_wmma
396
+
397
+ BATCH_SOURCES ON
398
+ BATCH_SIZE 4
399
+
400
+ # wmma floating point tests
401
+ gemm_f16t_f16n_f16t_wmma_tensor_op_f16_sm70.cu
402
+ gemm_f16n_f16t_f16t_wmma_tensor_op_f16_sm70.cu
403
+ gemm_f16t_f16t_f16t_wmma_tensor_op_f16_sm70.cu
404
+ gemm_f16n_f16n_f16t_wmma_tensor_op_f16_sm70.cu
405
+ gemm_f16t_f16n_f16n_wmma_tensor_op_f16_sm70.cu
406
+ gemm_f16n_f16t_f16n_wmma_tensor_op_f16_sm70.cu
407
+ gemm_f16t_f16t_f16n_wmma_tensor_op_f16_sm70.cu
408
+ gemm_f16n_f16n_f16n_wmma_tensor_op_f16_sm70.cu
409
+
410
+ gemm_f16t_f16n_f32t_wmma_tensor_op_f32_sm70.cu
411
+ gemm_f16n_f16t_f32t_wmma_tensor_op_f32_sm70.cu
412
+ gemm_f16t_f16t_f32t_wmma_tensor_op_f32_sm70.cu
413
+ gemm_f16n_f16n_f32t_wmma_tensor_op_f32_sm70.cu
414
+ gemm_f16t_f16n_f32n_wmma_tensor_op_f32_sm70.cu
415
+ gemm_f16n_f16t_f32n_wmma_tensor_op_f32_sm70.cu
416
+ gemm_f16t_f16t_f32n_wmma_tensor_op_f32_sm70.cu
417
+ gemm_f16n_f16n_f32n_wmma_tensor_op_f32_sm70.cu
418
+
419
+ gemm_f16t_f16n_f16t_wmma_tensor_op_f32_sm70.cu
420
+ gemm_f16n_f16t_f16t_wmma_tensor_op_f32_sm70.cu
421
+ gemm_f16t_f16t_f16t_wmma_tensor_op_f32_sm70.cu
422
+ gemm_f16n_f16n_f16t_wmma_tensor_op_f32_sm70.cu
423
+ gemm_f16t_f16n_f16n_wmma_tensor_op_f32_sm70.cu
424
+ gemm_f16n_f16t_f16n_wmma_tensor_op_f32_sm70.cu
425
+ gemm_f16t_f16t_f16n_wmma_tensor_op_f32_sm70.cu
426
+ gemm_f16n_f16n_f16n_wmma_tensor_op_f32_sm70.cu
427
+
428
+ # wmma int8 tests
429
+ gemm_s8t_s8n_s32t_wmma_tensor_op_s32_sm72.cu
430
+ gemm_s8t_s8n_s32n_wmma_tensor_op_s32_sm72.cu
431
+
432
+ gemm_s8t_s8n_s8t_wmma_tensor_op_s32_sm72.cu
433
+ gemm_s8t_s8n_s8n_wmma_tensor_op_s32_sm72.cu
434
+
435
+ # wmma uint8 tests
436
+ gemm_u8t_u8n_s32t_wmma_tensor_op_s32_sm72.cu
437
+
438
+ # wmma sub byptes (s4 and b1) tests
439
+ gemm_s4t_s4n_s32n_wmma_tensor_op_s32_sm75.cu
440
+ gemm_s4t_s4n_s32t_wmma_tensor_op_s32_sm75.cu
441
+
442
+ gemm_b1t_b1n_s32n_wmma_tensor_op_s32_sm75.cu
443
+ gemm_b1t_b1n_s32t_wmma_tensor_op_s32_sm75.cu
444
+
445
+ # wmma floating point tests (using singestage pipeline)
446
+ gemm_f16t_f16n_f16t_singlestage_wmma_tensor_op_f16_sm70.cu
447
+ gemm_f16t_f16n_f16n_singlestage_wmma_tensor_op_f16_sm70.cu
448
+
449
+ gemm_f16t_f16n_f32t_singlestage_wmma_tensor_op_f32_sm70.cu
450
+ )
451
+
452
+ cutlass_test_unit_add_executable(
453
+ cutlass_test_unit_gemm_device_tensorop_planar_complex
454
+
455
+ BATCH_SOURCES ON
456
+ BATCH_SIZE 4
457
+
458
+ gemm_planar_complex_f16_f16_f32_tensor_op_sm70.cu
459
+ gemm_planar_complex_f16_f16_f32_tensor_op_sm75.cu
460
+ gemm_planar_complex_f16_f16_f32_tensor_op_sm80.cu
461
+ )
462
+ cutlass_test_unit_add_executable(
463
+ cutlass_test_unit_gemm_device_grouped
464
+
465
+ BATCH_SOURCES ON
466
+ BATCH_SIZE 4
467
+
468
+ gemm_grouped_sm80.cu
469
+ )
470
+
471
+ cutlass_test_unit_add_executable(
472
+ cutlass_test_unit_gemm_device_grouped_scheduler
473
+
474
+ BATCH_SOURCES ON
475
+ BATCH_SIZE 4
476
+
477
+ gemm_grouped_scheduler_sm80.cu
478
+ )
479
+
480
+ cutlass_test_unit_add_executable(
481
+ cutlass_test_unit_gemm_device_grouped_rank_2k_scheduler
482
+
483
+ BATCH_SOURCES ON
484
+ BATCH_SIZE 4
485
+
486
+ rank_2k_grouped_scheduler_sm80.cu
487
+ )
488
+
489
+ cutlass_test_unit_add_executable(
490
+ cutlass_test_unit_gemm_device_sparse_tensorop_sm80
491
+
492
+ BATCH_SOURCES ON
493
+ BATCH_SIZE 4
494
+
495
+ gemm_f16n_f16n_f16t_tensor_op_f32_sparse_sm80.cu
496
+ gemm_f16n_f16n_f32t_tensor_op_f32_sparse_sm80.cu
497
+ gemm_f16n_f16t_f16t_tensor_op_f16_sparse_sm80.cu
498
+ gemm_f16n_f16t_f32t_tensor_op_f32_sparse_sm80.cu
499
+ gemm_f16t_f16n_f16t_tensor_op_f16_sparse_sm80.cu
500
+ gemm_f16t_f16n_f32t_tensor_op_f32_sparse_sm80.cu
501
+ gemm_f16t_f16t_f32t_tensor_op_f32_sparse_sm80.cu
502
+ gemm_f32t_f32n_f32t_tensor_op_f32_sparse_sm80.cu
503
+ gemm_f32n_f32t_f32t_tensor_op_f32_sparse_sm80.cu
504
+ gemm_f32t_f32t_f32t_tensor_op_f32_sparse_sm80.cu
505
+ gemm_f32n_f32n_f32t_tensor_op_f32_sparse_sm80.cu
506
+ gemm_s8t_s8n_s32t_tensor_op_s32_sparse_sm80.cu
507
+ gemm_s4t_s4n_s32t_tensor_op_s32_sparse_sm80.cu
508
+ )
509
+
510
+
511
+ cutlass_test_unit_add_executable(
512
+ cutlass_test_unit_gemv_device
513
+
514
+ BATCH_SOURCES ON
515
+ BATCH_SIZE 4
516
+
517
+ gemv.cu
518
+ )
519
+
520
+ if (NOT CUDA_COMPILER MATCHES "[Cc]lang")
521
+
522
+ add_dependencies(
523
+ cutlass_test_unit_gemm_device
524
+ cutlass_test_unit_gemm_device_gemm_with_fused_epilogue_tensorop
525
+ )
526
+
527
+ add_dependencies(
528
+ test_unit_gemm_device
529
+ test_unit_gemm_device_gemm_with_fused_epilogue_tensorop
530
+ )
531
+
532
+ cutlass_test_unit_add_executable(
533
+ cutlass_test_unit_gemm_device_gemm_with_fused_epilogue_tensorop
534
+
535
+ gemm_with_reduction_f16n_f16n_f16n_tensorop_f32_sm75.cu
536
+ gemm_with_broadcast_f16n_f16n_f16n_tensorop_f32_sm75.cu
537
+
538
+ gemm_with_reduction_f16t_f16n_f16n_tensorop_f32_sm80.cu
539
+ )
540
+
541
+ endif()
542
+
543
+ if (NOT CUDA_COMPILER MATCHES "[Cc]lang")
544
+
545
+ add_dependencies(
546
+ cutlass_test_unit_gemm_device
547
+ cutlass_test_unit_gemm_device_blas3
548
+ )
549
+
550
+ add_dependencies(
551
+ test_unit_gemm_device
552
+ test_unit_gemm_device_blas3
553
+ )
554
+
555
+ cutlass_test_unit_add_executable(
556
+ cutlass_test_unit_gemm_device_blas3
557
+
558
+ BATCH_SOURCES ON
559
+ BATCH_SIZE 4
560
+
561
+ ## SYRK
562
+ # Syrk SM80 f64 tests
563
+ syrk_f64n_f64t_tensor_op_f64_sm80.cu
564
+ syrk_f64t_f64n_tensor_op_f64_sm80.cu
565
+
566
+ # Syrk SM80 f32 tests
567
+ syrk_tf32n_f32t_tensor_op_f32_sm80.cu
568
+ syrk_tf32t_f32t_tensor_op_f32_sm80.cu
569
+ syrk_f32n_f32t_tensor_op_fast_f32_sm80.cu
570
+ syrk_f32t_f32t_tensor_op_fast_f32_sm80.cu
571
+
572
+ # Syrk SM80 complex f64 tests
573
+ syrk_cf64n_cf64t_tensor_op_f64_sm80.cu
574
+ syrk_cf64n_cf64n_tensor_op_f64_sm80.cu
575
+ syrk_cf64n_cf64t_tensor_op_f64_gaussian_sm80.cu
576
+
577
+ # Syrk SM80 complex f32 tests
578
+ syrk_cf32n_cf32t_tensor_op_f32_sm80.cu
579
+ syrk_cf32n_cf32n_tensor_op_f32_sm80.cu
580
+ syrk_cf32n_cf32t_tensor_op_fast_f32_sm80.cu
581
+ syrk_cf32n_cf32n_tensor_op_fast_f32_sm80.cu
582
+
583
+ # Syrk SM90 f64 tests
584
+ syrk_f64_f64_tensor_op_f64_sm90.cu
585
+
586
+ # Syrk SM90 complex f64 tests
587
+ syrk_cf64_cf64_tensor_op_f64_sm90.cu
588
+
589
+ ## HERK
590
+ # Herk SM80 complex f64 tests
591
+ herk_cf64h_cf64n_tensor_op_f64_sm80.cu
592
+
593
+ # Herk SM80 complex f32 tests
594
+ herk_cf32h_cf32n_tensor_op_f32_sm80.cu
595
+ herk_cf32h_cf32n_tensor_op_fast_f32_sm80.cu
596
+
597
+ # Herk SM90 complex f64 tests
598
+ herk_cf64_cf64_tensor_op_f64_sm90.cu
599
+
600
+ ## TRMM
601
+ # Trmm SM80 f64 tests
602
+ trmm_f64n_f64n_f64t_tensor_op_f64_ls_sm80.cu
603
+ trmm_f64n_f64n_f64t_tensor_op_f64_rs_sm80.cu
604
+ trmm_f64t_f64t_f64n_tensor_op_f64_ls_sm80.cu
605
+ trmm_f64t_f64t_f64n_tensor_op_f64_rs_sm80.cu
606
+ trmm_f64n_f64t_f64t_tensor_op_f64_rs_sm80.cu
607
+
608
+ # Trmm SM80 f32 tests
609
+ trmm_tf32t_tf32n_f32t_tensor_op_f32_ls_sm80.cu
610
+ trmm_tf32n_tf32t_f32t_tensor_op_f32_ls_sm80.cu
611
+ trmm_tf32n_tf32t_f32t_tensor_op_f32_rs_sm80.cu
612
+ trmm_tf32t_tf32n_f32n_tensor_op_f32_ls_sm80.cu
613
+ trmm_f32t_f32n_f32t_tensor_op_fast_f32_ls_sm80.cu
614
+ trmm_f32n_f32t_f32t_tensor_op_fast_f32_ls_sm80.cu
615
+ trmm_f32n_f32t_f32t_tensor_op_fast_f32_rs_sm80.cu
616
+ trmm_f32t_f32n_f32n_tensor_op_fast_f32_ls_sm80.cu
617
+
618
+ # Trmm SM80 complex f64 tests
619
+ trmm_cf64n_cf64n_cf64t_tensor_op_f64_sm80.cu
620
+ trmm_cf64n_cf64n_cf64t_tensor_op_f64_gaussian_sm80.cu
621
+
622
+ # Trmm SM80 complex f32 tests
623
+ trmm_cf32n_cf32n_cf32t_tensor_op_f32_sm80.cu
624
+ trmm_cf32n_cf32n_cf32t_tensor_op_fast_f32_sm80.cu
625
+
626
+ # Trmm SM90 f64 tests
627
+ trmm_f64_f64_f64_tensor_op_f64_sm90.cu
628
+
629
+ # Trmm SM90 complex f64 tests
630
+ trmm_cf64_cf64_cf64_tensor_op_f64_sm90.cu
631
+
632
+ ## SYR2K
633
+ # Syr2k SM80 f64 tests
634
+ syr2k_f64n_f64t_tensor_op_f64_sm80.cu
635
+ syr2k_f64n_f64n_tensor_op_f64_sm80.cu
636
+ syr2k_f64t_f64n_tensor_op_f64_sm80.cu
637
+
638
+ # Syr2k SM80 f32 tests
639
+ syr2k_tf32n_f32n_tensor_op_f32_sm80.cu
640
+ syr2k_tf32t_f32n_tensor_op_f32_sm80.cu
641
+ syr2k_f32n_f32n_tensor_op_fast_f32_sm80.cu
642
+ syr2k_f32t_f32n_tensor_op_fast_f32_sm80.cu
643
+
644
+ # Syr2k SM80 complex f64 tests
645
+ syr2k_cf64n_cf64t_tensor_op_f64_sm80.cu
646
+ syr2k_cf64n_cf64n_tensor_op_f64_sm80.cu
647
+
648
+ # Syr2k SM80 complex f32 tests
649
+ syr2k_cf32n_cf32n_tensor_op_f32_sm80.cu
650
+ syr2k_cf32n_cf32t_tensor_op_f32_sm80.cu
651
+ syr2k_cf32n_cf32n_tensor_op_fast_f32_sm80.cu
652
+ syr2k_cf32n_cf32t_tensor_op_fast_f32_sm80.cu
653
+
654
+ # Syr2k SM90 f64 tests
655
+ syr2k_f64_f64_tensor_op_f64_sm90.cu
656
+
657
+ # Syr2k SM90 complex f64 tests
658
+ syr2k_cf64_cf64_tensor_op_f64_sm90.cu
659
+
660
+ ## HER2K
661
+ # Her2k SM80 complex f64 tests
662
+ her2k_cf64n_cf64n_tensor_op_f64_sm80.cu
663
+
664
+ # Her2k SM80 complex f32 tests
665
+ her2k_cf32h_cf32n_tensor_op_f32_sm80.cu
666
+ her2k_cf32h_cf32n_tensor_op_fast_f32_sm80.cu
667
+
668
+ # Her2k SM90 complex f64 tests
669
+ her2k_cf64_cf64_tensor_op_f64_sm90.cu
670
+
671
+ ## SYMM
672
+ # Symm SM80 f64 tests
673
+ symm_f64n_f64n_tensor_op_f64_ls_sm80.cu
674
+ symm_f64n_f64n_tensor_op_f64_rs_sm80.cu
675
+ symm_f64n_f64t_tensor_op_f64_ls_sm80.cu
676
+ symm_f64n_f64t_tensor_op_f64_rs_sm80.cu
677
+ symm_f64t_f64n_tensor_op_f64_ls_sm80.cu
678
+ symm_f64t_f64n_tensor_op_f64_rs_sm80.cu
679
+ symm_f64t_f64t_tensor_op_f64_ls_sm80.cu
680
+ symm_f64t_f64t_tensor_op_f64_rs_sm80.cu
681
+
682
+ # Symm SM80 f32 tests
683
+ symm_tf32n_f32n_tensor_op_f32_ls_sm80.cu
684
+ symm_tf32n_f32n_tensor_op_f32_rs_sm80.cu
685
+ symm_tf32t_f32t_tensor_op_f32_ls_sm80.cu
686
+ symm_f32n_f32n_tensor_op_fast_f32_ls_sm80.cu
687
+ symm_f32n_f32n_tensor_op_fast_f32_rs_sm80.cu
688
+ symm_f32t_f32t_tensor_op_fast_f32_ls_sm80.cu
689
+
690
+ # Symm SM80 complex f64 tests
691
+ symm_cf64n_cf64n_cf64n_tensor_op_ls_f64_sm80.cu
692
+ symm_cf64n_cf64n_cf64n_tensor_op_rs_f64_sm80.cu
693
+ symm_cf64n_cf64n_cf64n_tensor_op_ls_f64_gaussian_sm80.cu
694
+
695
+ # Symm SM80 complex f32 tests
696
+ symm_cf32n_cf32n_tensor_op_f32_ls_sm80.cu
697
+ symm_cf32n_cf32n_tensor_op_f32_rs_sm80.cu
698
+ symm_cf32n_cf32n_tensor_op_fast_f32_ls_sm80.cu
699
+ symm_cf32n_cf32n_tensor_op_fast_f32_rs_sm80.cu
700
+
701
+ # Symm SM90 f64 tests
702
+ symm_f64_f64_tensor_op_f64_sm90.cu
703
+
704
+ # Symm SM90 complex f64 tests
705
+ symm_cf64_cf64_cf64_tensor_op_f64_sm90.cu
706
+
707
+ # Hemm SM80 complex f64 tests
708
+ hemm_cf64h_cf64n_cf64n_tensor_op_ls_f64_sm80.cu
709
+ hemm_cf64h_cf64n_cf64n_tensor_op_rs_f64_sm80.cu
710
+ hemm_cf64h_cf64n_cf64n_tensor_op_ls_f64_gaussian_sm80.cu
711
+
712
+ # Hemm SM80 complex f32 tests
713
+ hemm_cf32h_cf32n_tensor_op_f32_ls_sm80.cu
714
+ hemm_cf32h_cf32n_tensor_op_f32_rs_sm80.cu
715
+ hemm_cf32h_cf32n_tensor_op_fast_f32_ls_sm80.cu
716
+ hemm_cf32h_cf32n_tensor_op_fast_f32_rs_sm80.cu
717
+
718
+ # Hemm SM90 complex f64 tests
719
+ hemm_cf64_cf64_cf64_tensor_op_f64_sm90.cu
720
+ )
721
+
722
+ cutlass_test_unit_add_executable(
723
+ cutlass_test_unit_gemm_device_grouped_blas3
724
+
725
+ BATCH_SOURCES ON
726
+ BATCH_SIZE 4
727
+
728
+ # Grouped SYR2K SM80 f64 tests
729
+ syr2k_f64n_f64n_tensor_op_f64_grouped_sm80.cu
730
+ syr2k_f64n_f64t_tensor_op_f64_grouped_sm80.cu
731
+ syr2k_f64t_f64n_tensor_op_f64_grouped_sm80.cu
732
+ syr2k_f64t_f64t_tensor_op_f64_grouped_sm80.cu
733
+
734
+ # Grouped SYR2K SM80 cf64 tests
735
+ syr2k_cf64n_cf64n_tensor_op_f64_grouped_sm80.cu
736
+ syr2k_cf64n_cf64t_tensor_op_f64_grouped_sm80.cu
737
+ syr2k_cf64t_cf64n_tensor_op_f64_grouped_sm80.cu
738
+ syr2k_cf64t_cf64t_tensor_op_f64_grouped_sm80.cu
739
+
740
+ # Grouped HER2K SM80 f64 tests
741
+ her2k_cf64n_cf64n_tensor_op_f64_grouped_sm80.cu
742
+ her2k_cf64h_cf64n_tensor_op_f64_grouped_sm80.cu
743
+ )
744
+
745
+ endif()
746
+
747
+ if (NOT CUDA_COMPILER MATCHES "[Cc]lang")
748
+
749
+ cutlass_test_unit_add_executable(
750
+ cutlass_test_unit_gemm_device_broadcast
751
+
752
+ gemm_f16t_f16n_f16t_tensor_op_f16_broadcast_sm80.cu
753
+ )
754
+
755
+ endif()
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/__pycache__/simt_sm50.cpython-310.pyc ADDED
Binary file (8.39 kB). View file
 
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/default_gemm_configuration.hpp ADDED
@@ -0,0 +1,1366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2023 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ #pragma once
32
+
33
+ #include "cute/atom/mma_atom.hpp"
34
+ #include "cute/atom/copy_atom.hpp"
35
+
36
+ #include "cutlass/cutlass.h"
37
+ #include "cutlass/gemm/gemm.h"
38
+ #include "cutlass/arch/arch.h"
39
+ #include "cutlass/arch/mma.h"
40
+ #include "cutlass/layout/layout.h"
41
+ #include "cutlass/gemm/dispatch_policy.hpp"
42
+ #include "cutlass/gemm/collective/collective_mma.hpp"
43
+ #include "cutlass/epilogue/collective/collective_builder.hpp"
44
+
45
+ #include "cutlass/epilogue/collective/default_epilogue.hpp"
46
+ #include "cutlass/epilogue/thread/linear_combination.h"
47
+
48
+ namespace cutlass {
49
+ namespace gemm {
50
+ namespace device {
51
+ using namespace cute;
52
+
53
+ // This type is only intended to demonstrate porting 2.x kernels to 3.0
54
+ template<
55
+ class OperatorClass, class ArchTag,
56
+ class ElementA, class LayoutA,
57
+ class ElementB, class LayoutB,
58
+ class ElementC, class LayoutC,
59
+ class ElementAccumulator>
60
+ struct DefaultGemmConfigurationToCutlass3Types {
61
+ static_assert(sizeof(ElementA) == 0, "No valid DefaultGemmConfigurationToCutlass3Types configuration exists.");
62
+ };
63
+
64
+ ///////////////////////////////////////////////////////////////////////////////
65
+
66
+ namespace detail {
67
+
68
+ template <typename Element, typename Layout, int Alignment, int SizeK>
69
+ struct DefaultGemm_TensorOpSm80_OperandA;
70
+
71
+ template <typename Element, typename Layout, int Alignment, int SizeK>
72
+ struct DefaultGemm_TensorOpSm80_OperandB;
73
+
74
+ //
75
+ // F16: 128-by-128-by-64
76
+ //
77
+
78
+ /// Operand A - Row-major (K-Major)
79
+ template <>
80
+ struct DefaultGemm_TensorOpSm80_OperandA<half_t, layout::RowMajor, 8, 64>
81
+ {
82
+ // Smem
83
+ using SmemLayoutAtom = decltype(
84
+ composition(Swizzle<3,3,3>{},
85
+ Layout<Shape < _8,_64>,
86
+ Stride<_64, _1>>{}));
87
+ using SmemCopyAtom = Copy_Atom<SM75_U32x4_LDSM_N, half_t>;
88
+
89
+ // Gmem
90
+ using GmemTiledCopy = decltype(
91
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, half_t>{},
92
+ Layout<Shape <_16,_8>,
93
+ Stride< _8,_1>>{},
94
+ Layout<Shape < _1,_8>>{}));
95
+ };
96
+
97
+ /// Operand A - Column-major (M-major)
98
+ template <int SizeK>
99
+ struct DefaultGemm_TensorOpSm80_OperandA<half_t, layout::ColumnMajor, 8, SizeK>
100
+ {
101
+ // Smem
102
+ using SmemLayoutAtom = decltype(
103
+ composition(Swizzle<3,3,3>{},
104
+ Layout<Shape <_64, _8>,
105
+ Stride< _1,_64>>{}));
106
+ using SmemCopyAtom = Copy_Atom<SM75_U16x8_LDSM_T, half_t>;
107
+
108
+ // Gmem
109
+ using GmemTiledCopy = decltype(
110
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, half_t>{},
111
+ Layout<Shape <_16, _8>,
112
+ Stride< _1,_16>>{},
113
+ Layout<Shape < _8, _1>>{}));
114
+ };
115
+
116
+ // Because the F32F16 TiledMMA is A-B symmetric, we can reuse the DefaultOperands
117
+
118
+ // Operand B - Column-Major (K-major)
119
+ template <int Alignment, int SizeK>
120
+ struct DefaultGemm_TensorOpSm80_OperandB<half_t, layout::ColumnMajor, Alignment, SizeK>
121
+ : DefaultGemm_TensorOpSm80_OperandA<half_t, layout::RowMajor, Alignment, SizeK>
122
+ {};
123
+
124
+ // Operand B - Row-Major (N-major)
125
+ template <int Alignment, int SizeK>
126
+ struct DefaultGemm_TensorOpSm80_OperandB<half_t, layout::RowMajor, Alignment, SizeK>
127
+ : DefaultGemm_TensorOpSm80_OperandA<half_t, layout::ColumnMajor, Alignment, SizeK>
128
+ {};
129
+
130
+ //
131
+ // F16: 128-by-128-by-32 (small k-block)
132
+ //
133
+
134
+ /// Operand A - Row-major (K-Major)
135
+ template <>
136
+ struct DefaultGemm_TensorOpSm80_OperandA<half_t, layout::RowMajor, 8, 32>
137
+ {
138
+ // Smem
139
+ using SmemLayoutAtom = decltype(
140
+ composition(Swizzle<2,3,3>{},
141
+ Layout<Shape < _8,_32>,
142
+ Stride<_32, _1>>{}));
143
+ using SmemCopyAtom = Copy_Atom<SM75_U32x4_LDSM_N, half_t>;
144
+
145
+ // Gmem
146
+ using GmemTiledCopy = decltype(
147
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, half_t>{},
148
+ Layout<Shape <_32,_4>,
149
+ Stride< _4,_1>>{},
150
+ Layout<Shape < _1,_8>>{}));
151
+ };
152
+
153
+ }
154
+
155
+ ///////////////////////////////////////////////////////////////////////////////
156
+
157
+ // Ampere MMA F32F16
158
+ template <typename LayoutA, typename LayoutB, typename LayoutC>
159
+ struct DefaultGemmConfigurationToCutlass3Types<
160
+ arch::OpClassTensorOp, arch::Sm80,
161
+ half_t, LayoutA,
162
+ half_t, LayoutB,
163
+ float, LayoutC,
164
+ float>
165
+ {
166
+ using TileShape = Shape<_128, _128, _32>;
167
+ static constexpr int ThreadCount = 128;
168
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
169
+ using TiledMma = TiledMMA<
170
+ MMA_Atom<SM80_16x8x16_F32F16F16F32_TN>,
171
+ Layout<Shape<_2,_2,_1>>, // 2x2x1 thread group
172
+ Layout<Shape<_1,_2,_1>>>; // 1x2x1 value group for 16x16x16 MMA and LDSM
173
+
174
+ // A
175
+ static constexpr int kAlignmentA = 8;
176
+ using DefaultOperandA = detail::DefaultGemm_TensorOpSm80_OperandA<
177
+ half_t, LayoutA, kAlignmentA, 32>;
178
+ using SmemLayoutAtomA = typename DefaultOperandA::SmemLayoutAtom; // M, K
179
+ using SmemCopyAtomA = typename DefaultOperandA::SmemCopyAtom;
180
+ using GmemTiledCopyA = typename DefaultOperandA::GmemTiledCopy;
181
+
182
+ // B
183
+ static constexpr int kAlignmentB = 8;
184
+ using DefaultOperandB = detail::DefaultGemm_TensorOpSm80_OperandB<
185
+ half_t, LayoutB, kAlignmentB, 32>;
186
+ using SmemLayoutAtomB = typename DefaultOperandB::SmemLayoutAtom; // N, K
187
+ using SmemCopyAtomB = typename DefaultOperandB::SmemCopyAtom;
188
+ using GmemTiledCopyB = typename DefaultOperandB::GmemTiledCopy;
189
+
190
+ // Mainloop
191
+ using CollectiveMainloop = collective::CollectiveMma<
192
+ DispatchPolicy, TileShape,
193
+ half_t, TagToStrideA_t<LayoutA>,
194
+ half_t, TagToStrideB_t<LayoutB>,
195
+ TiledMma,
196
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
197
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
198
+ >;
199
+
200
+ // Epilogue
201
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
202
+ TagToStrideC_t<LayoutC>,
203
+ TagToStrideC_t<LayoutC>,
204
+ epilogue::thread::LinearCombination<float, 1, float, float>,
205
+ cutlass::gemm::EpilogueDefault>;
206
+ };
207
+
208
+ ///////////////////////////////////////////////////////////////////////////////
209
+
210
+ namespace detail {
211
+
212
+ //
213
+ // TF32: 128-by-128-by-kblock (kBlock = 16, 32)
214
+ //
215
+
216
+ /// Operand A - Row-major (K-major) (kBlock = 32)
217
+ template <>
218
+ struct DefaultGemm_TensorOpSm80_OperandA<tfloat32_t, layout::RowMajor, 4, 32>
219
+ {
220
+ // Smem
221
+ using SmemLayoutAtom = decltype(
222
+ composition(Swizzle<3,2,3>{},
223
+ Layout<Shape < _8,_32>,
224
+ Stride<_32, _1>>{}));
225
+ using SmemCopyAtom = Copy_Atom<SM75_U32x4_LDSM_N, tfloat32_t>;
226
+
227
+ // Gmem
228
+ using GmemTiledCopy = decltype(
229
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, tfloat32_t>{},
230
+ Layout<Shape <_16,_8>,
231
+ Stride< _8,_1>>{},
232
+ Layout<Shape < _1,_4>>{}));
233
+ };
234
+
235
+ /// Operand A - Row-major (K-major) (kBlock = 16)
236
+ template <>
237
+ struct DefaultGemm_TensorOpSm80_OperandA<tfloat32_t, layout::RowMajor, 4, 16>
238
+ {
239
+ // Smem
240
+ using SmemLayoutAtom = decltype(
241
+ composition(Swizzle<2,2,3>{},
242
+ Layout<Shape < _8,_16>,
243
+ Stride<_16, _1>>{}));
244
+ using SmemCopyAtom = Copy_Atom<SM75_U32x4_LDSM_N, tfloat32_t>;
245
+ // Gmem
246
+ using GmemTiledCopy = decltype(
247
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, tfloat32_t>{},
248
+ Layout<Shape <_32,_4>,
249
+ Stride< _4,_1>>{},
250
+ Layout<Shape < _1,_4>>{}));
251
+ };
252
+
253
+ /// Operand A - Column-major (M-major)
254
+ template <int SizeK>
255
+ struct DefaultGemm_TensorOpSm80_OperandA<tfloat32_t, layout::ColumnMajor, 4, SizeK>
256
+ {
257
+ // Smem
258
+ using SmemLayoutAtom = decltype(
259
+ composition(Swizzle<3,2,3>{},
260
+ Layout<Shape <_32, _8>,
261
+ Stride< _1,_32>>{}));
262
+ using SmemCopyAtom = Copy_Atom<UniversalCopy<tfloat32_t>, tfloat32_t>;
263
+ // Gmem
264
+ using GmemTiledCopy = decltype(
265
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, tfloat32_t>{},
266
+ Layout<Shape <_16, _8>,
267
+ Stride< _1,_16>>{},
268
+ Layout<Shape < _4, _1>>{}));
269
+ };
270
+
271
+ // Because the TF32 TiledMMA is A-B symmetric, we can reuse the DefaultOperands
272
+
273
+ // Operand B - Column-Major (K-major)
274
+ template <int Alignment, int SizeK>
275
+ struct DefaultGemm_TensorOpSm80_OperandB<tfloat32_t, layout::ColumnMajor, Alignment, SizeK>
276
+ : DefaultGemm_TensorOpSm80_OperandA<tfloat32_t, layout::RowMajor, Alignment, SizeK>
277
+ {};
278
+
279
+ // Operand B - Row-Major (N-major)
280
+ template <int Alignment, int SizeK>
281
+ struct DefaultGemm_TensorOpSm80_OperandB<tfloat32_t, layout::RowMajor, Alignment, SizeK>
282
+ : DefaultGemm_TensorOpSm80_OperandA<tfloat32_t, layout::ColumnMajor, Alignment, SizeK>
283
+ {};
284
+
285
+ }
286
+
287
+ ///////////////////////////////////////////////////////////////////////////////
288
+
289
+ // Ampere MMA F32TF32
290
+ template <typename LayoutA, typename LayoutB, typename LayoutC>
291
+ struct DefaultGemmConfigurationToCutlass3Types<
292
+ arch::OpClassTensorOp, arch::Sm80,
293
+ tfloat32_t, LayoutA,
294
+ tfloat32_t, LayoutB,
295
+ float, LayoutC,
296
+ float>
297
+ {
298
+ using TileShape = Shape<_128, _128, _32>;
299
+ static constexpr int ThreadCount = 128;
300
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
301
+ using TiledMma = TiledMMA<
302
+ MMA_Atom<SM80_16x8x8_F32TF32TF32F32_TN>,
303
+ Layout<Shape<_2,_2,_1>, Stride<_2, _1, _1>>, // 2x2x1 thread group
304
+ Layout<Shape<_1,_2,_1>>>; // 1x2x1 value group for 16x16x8 and LDSM
305
+
306
+ // A
307
+ static constexpr int kAlignmentA = 4;
308
+ using DefaultOperandA = detail::DefaultGemm_TensorOpSm80_OperandA<
309
+ tfloat32_t, LayoutA, kAlignmentA, 32>;
310
+ using SmemLayoutAtomA = typename DefaultOperandA::SmemLayoutAtom; // M, K
311
+ using SmemCopyAtomA = typename DefaultOperandA::SmemCopyAtom;
312
+ using GmemTiledCopyA = typename DefaultOperandA::GmemTiledCopy;
313
+
314
+ // B
315
+ static constexpr int kAlignmentB = 4;
316
+ using DefaultOperandB = detail::DefaultGemm_TensorOpSm80_OperandB<
317
+ tfloat32_t, LayoutB, kAlignmentB, 32>;
318
+ using SmemLayoutAtomB = typename DefaultOperandB::SmemLayoutAtom; // N, K
319
+ using SmemCopyAtomB = typename DefaultOperandB::SmemCopyAtom;
320
+ using GmemTiledCopyB = typename DefaultOperandB::GmemTiledCopy;
321
+
322
+ // Mainloop
323
+ using CollectiveMainloop = collective::CollectiveMma<
324
+ DispatchPolicy, TileShape,
325
+ tfloat32_t, TagToStrideA_t<LayoutA>,
326
+ tfloat32_t, TagToStrideB_t<LayoutB>,
327
+ TiledMma,
328
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
329
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
330
+ >;
331
+
332
+ // Epilogue
333
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
334
+ TagToStrideC_t<LayoutC>,
335
+ TagToStrideC_t<LayoutC>,
336
+ epilogue::thread::LinearCombination<float, 1, float, float>,
337
+ cutlass::gemm::EpilogueDefault>;
338
+ };
339
+
340
+ ///////////////////////////////////////////////////////////////////////////////
341
+ template <typename LayoutC>
342
+ struct DefaultGemmConfigurationToCutlass3Types<
343
+ arch::OpClassTensorOp, arch::Sm80,
344
+ int8_t, cutlass::layout::RowMajor,
345
+ int8_t, cutlass::layout::ColumnMajor,
346
+ int32_t, LayoutC,
347
+ int32_t>
348
+ {
349
+ using TileShape = Shape<_128, _128, _64>;
350
+ static constexpr int ThreadCount = 128;
351
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
352
+ using TiledMma = TiledMMA<
353
+ MMA_Atom<SM80_16x8x32_S32S8S8S32_TN>,
354
+ Layout<Shape<_2,_2,_1>>, // 2x2x1 thread group
355
+ Layout<Shape<_1,_2,_1>>>; // 1x2x1 value group for 16x16x32 and LDSM
356
+
357
+ // A (M,K) K-major
358
+ using SmemLayoutAtomA = decltype(
359
+ composition(
360
+ Swizzle<2,4,3>{},
361
+ Layout<Shape <_16,_64>,
362
+ Stride<_64, _1>>{}));
363
+ static constexpr int kAlignmentA = 16;
364
+ using GmemTiledCopyA = decltype(
365
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, int8_t>{},
366
+ Layout<Shape <_32,_4>,
367
+ Stride< _4,_1>>{},
368
+ Layout<Shape<_1,Int<kAlignmentA>>>{}));
369
+ // LDS.32- or LDSM-based copy atom
370
+ // using SmemCopyAtomA = Copy_Atom<DefaultCopy, uint8_t>;
371
+ using SmemCopyAtomA = Copy_Atom<SM75_U32x4_LDSM_N, uint8_t>; // LDSM works
372
+
373
+ // B (N,K) K-major
374
+ using SmemLayoutAtomB = decltype(
375
+ composition(
376
+ Swizzle<2,4,3>{},
377
+ Layout<Shape <_16,_64>,
378
+ Stride<_64, _1>>{}));
379
+ static constexpr int kAlignmentB = 16;
380
+ using GmemTiledCopyB = decltype(
381
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, int8_t>{},
382
+ Layout<Shape <_32,_4>,
383
+ Stride< _4,_1>>{},
384
+ Layout<Shape<_1,Int<kAlignmentB>>>{}));
385
+
386
+ // LDS.32- or LDSM-based copy atom
387
+ // using SmemCopyAtomB = Copy_Atom<DefaultCopy, uint32_t>;
388
+ using SmemCopyAtomB = Copy_Atom<SM75_U32x4_LDSM_N, uint8_t>; // LDSM works
389
+
390
+ // Mainloop
391
+ using CollectiveMainloop = collective::CollectiveMma<
392
+ DispatchPolicy, TileShape,
393
+ int8_t, TagToStrideA_t<cutlass::layout::RowMajor>,
394
+ int8_t, TagToStrideB_t<cutlass::layout::ColumnMajor>,
395
+ TiledMma,
396
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
397
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
398
+ >;
399
+
400
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
401
+ TagToStrideC_t<LayoutC>,
402
+ TagToStrideC_t<LayoutC>,
403
+ epilogue::thread::LinearCombination<int32_t, 1, int32_t, int32_t>,
404
+ cutlass::gemm::EpilogueDefault>;
405
+ };
406
+
407
+ ///////////////////////////////////////////////////////////////////////////////
408
+ //////////////////////////// SIMT TWO STAGE ///////////////////////////////////
409
+ ///////////////////////////////////////////////////////////////////////////////
410
+
411
+ namespace detail {
412
+
413
+ template <typename Element, typename Layout, int ThreadCount, int ShapeM, int ShapeK>
414
+ struct DefaultGemm_Simt_OperandA;
415
+
416
+ ///////////////////////////////////////////////////////////////////////////////
417
+
418
+ template <typename Element>
419
+ struct DefaultGemm_Simt_OperandA<Element, layout::ColumnMajor, 256, 128, 8>
420
+ {
421
+ using SmemLayoutAtom = Layout<Shape <_128, _8>,
422
+ Stride< _1,_128>>;
423
+
424
+ using SmemCopyAtom = Copy_Atom<DefaultCopy, Element>;
425
+
426
+ using GmemTiledCopy = decltype(
427
+ make_tiled_copy(Copy_Atom<UniversalCopy<Element>, Element>{},
428
+ Layout<Shape <_32, _8>,
429
+ Stride< _1,_32>>{},
430
+ Layout<Shape<_1,_1>>{}));
431
+ };
432
+
433
+ template <typename Element>
434
+ struct DefaultGemm_Simt_OperandA<Element, layout::RowMajor, 256, 128, 8>
435
+ {
436
+ using SmemLayoutAtom = Layout<Shape <_128, _8>,
437
+ Stride< _1,Int<128 + 4>>>; // Padded
438
+
439
+ using SmemCopyAtom = Copy_Atom<DefaultCopy, Element>;
440
+
441
+ using GmemTiledCopy = decltype(
442
+ make_tiled_copy(Copy_Atom<UniversalCopy<Element>, Element>{},
443
+ Layout<Shape <_32, _8>,
444
+ Stride< _8, _1>>{},
445
+ Layout<Shape<_1,_1>>{}));
446
+
447
+ };
448
+
449
+ template <typename Element, typename Layout, int ThreadCount, int ShapeN, int ShapeK>
450
+ struct DefaultGemm_Simt_OperandB;
451
+
452
+ template <typename Element, int ThreadCount, int ShapeN, int ShapeK>
453
+ struct DefaultGemm_Simt_OperandB<Element, layout::ColumnMajor, ThreadCount, ShapeN, ShapeK>
454
+ : DefaultGemm_Simt_OperandA<Element, layout::RowMajor, ThreadCount, ShapeN, ShapeK> {};
455
+
456
+ template <typename Element, int ThreadCount, int ShapeN, int ShapeK>
457
+ struct DefaultGemm_Simt_OperandB<Element, layout::RowMajor, ThreadCount, ShapeN, ShapeK>
458
+ : DefaultGemm_Simt_OperandA<Element, layout::ColumnMajor, ThreadCount, ShapeN, ShapeK> {};
459
+
460
+ } // end namespace detail
461
+
462
+ // SIMT Two Stage
463
+ template <
464
+ class ArchTag,
465
+ class ElementA, class LayoutA,
466
+ class ElementB, class LayoutB,
467
+ class ElementC, class LayoutC,
468
+ class ElementAccumulator>
469
+ struct DefaultGemmConfigurationToCutlass3Types<
470
+ arch::OpClassSimt, ArchTag,
471
+ ElementA, LayoutA,
472
+ ElementB, LayoutB,
473
+ ElementC, LayoutC,
474
+ ElementAccumulator>
475
+ {
476
+ using TileShape = Shape<_128, _128, _8>;
477
+ static constexpr int ThreadCount = 256;
478
+ using DispatchPolicy = MainloopSm70TwoStage;
479
+ using TiledMma = TiledMMA<
480
+ MMA_Atom<UniversalFMA<ElementAccumulator, ElementA, ElementB, ElementC>>,
481
+ Layout<Shape<_16, _16, _1>>>;
482
+
483
+ // A
484
+ static constexpr int kAlignmentA = 1;
485
+ using DefaultOperandA = detail::DefaultGemm_Simt_OperandA<ElementA, LayoutA, ThreadCount, 128, 8>;
486
+ using SmemLayoutAtomA = typename DefaultOperandA::SmemLayoutAtom;
487
+ using SmemCopyAtomA = typename DefaultOperandA::SmemCopyAtom;
488
+ using GmemTiledCopyA = typename DefaultOperandA::GmemTiledCopy;
489
+
490
+ // B
491
+ static constexpr int kAlignmentB = 1;
492
+ using DefaultOperandB = detail::DefaultGemm_Simt_OperandB<ElementB, LayoutB, ThreadCount, 128, 8>;
493
+ using SmemLayoutAtomB = typename DefaultOperandB::SmemLayoutAtom;
494
+ using SmemCopyAtomB = typename DefaultOperandB::SmemCopyAtom;
495
+ using GmemTiledCopyB = typename DefaultOperandB::GmemTiledCopy;
496
+
497
+ // Mainloop
498
+ using CollectiveMainloop = collective::CollectiveMma<
499
+ DispatchPolicy, TileShape,
500
+ ElementA, TagToStrideA_t<LayoutA>,
501
+ ElementB, TagToStrideB_t<LayoutB>,
502
+ TiledMma,
503
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
504
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
505
+ >;
506
+
507
+ // Epilogue
508
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
509
+ TagToStrideC_t<LayoutC>,
510
+ TagToStrideC_t<LayoutC>,
511
+ epilogue::thread::LinearCombination<ElementC, 1, ElementAccumulator, ElementAccumulator>,
512
+ cutlass::gemm::EpilogueDefault>;
513
+ };
514
+
515
+
516
+ //
517
+ // DP4A - int8 Proof-of-concept
518
+ //
519
+
520
+ // SIMT Two Stage TN - idp4a
521
+ template <
522
+ class ArchTag,
523
+ class ElementC, class LayoutC>
524
+ struct DefaultGemmConfigurationToCutlass3Types<
525
+ arch::OpClassSimt, ArchTag,
526
+ int8_t, cutlass::layout::RowMajor,
527
+ int8_t, cutlass::layout::ColumnMajor,
528
+ ElementC, LayoutC,
529
+ int32_t>
530
+ {
531
+ using TileShape = Shape<_128, _128, _32>;
532
+ static constexpr int ThreadCount = 256;
533
+ using DispatchPolicy = MainloopSm70TwoStage;
534
+ // NOTE: permuting MMA M mode lets us generate 128b smem loads (LDS.128) but has worst case bank conflicts
535
+ using TiledMma = TiledMMA<
536
+ MMA_Atom<SM61_DP4A>,
537
+ Layout<Shape<_16,_16,_1>>>; // Tile of atoms (threads)
538
+
539
+ // A (M,K) K-major
540
+ using ElementA = int8_t;
541
+ // 40% from regular M and N major layout
542
+ // using SmemLayoutAtomA = Layout<Shape <_128,_32>,
543
+ // Stride< _1,_128>>;
544
+ // 80% from interleaved layouts
545
+ using SmemLayoutAtomA = Layout<Shape <_128, Shape <_4, _8>>,
546
+ Stride< _4, Stride<_1,_512>>>;
547
+
548
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
549
+ static constexpr int kAlignmentA = 4;
550
+ using GmemTiledCopyA = decltype(
551
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint32_t>, ElementA>{},
552
+ Layout<Shape <_32,_8>,
553
+ Stride< _8,_1>>{},
554
+ Layout<Shape < _1,_4>>{}));
555
+
556
+ // B (N,K) K-major
557
+ using ElementB = int8_t;
558
+ // 40% from regular M and N major layout
559
+ // using SmemLayoutAtomB = Layout<Shape <_128,_32>,
560
+ // Stride< _1,_128>>;
561
+ // 80% from interleaved layouts
562
+ using SmemLayoutAtomB = Layout<Shape <_128, Shape <_4, _8>>,
563
+ Stride< _4, Stride<_1,_512>>>;
564
+
565
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
566
+ static constexpr int kAlignmentB = 4;
567
+ using GmemTiledCopyB = decltype(
568
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint32_t>, ElementB>{},
569
+ Layout<Shape <_32,_8>,
570
+ Stride< _8,_1>>{},
571
+ Layout<Shape < _1,_4>>{}));
572
+
573
+ // Mainloop
574
+ using CollectiveMainloop = collective::CollectiveMma<
575
+ DispatchPolicy, TileShape,
576
+ ElementA, TagToStrideA_t<cutlass::layout::RowMajor>,
577
+ ElementB, TagToStrideB_t<cutlass::layout::ColumnMajor>,
578
+ TiledMma,
579
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
580
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
581
+ >;
582
+
583
+ // Epilogue
584
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
585
+ TagToStrideC_t<LayoutC>,
586
+ TagToStrideC_t<LayoutC>,
587
+ epilogue::thread::LinearCombination<ElementC, 1, int32_t, int32_t>,
588
+ cutlass::gemm::EpilogueDefault>;
589
+ };
590
+
591
+ ///////////////////////////////////////////////////////////////////////////////
592
+
593
+ // SIMT Two Stage NN - idp4a
594
+ template <
595
+ class ArchTag,
596
+ class ElementC, class LayoutC>
597
+ struct DefaultGemmConfigurationToCutlass3Types<
598
+ arch::OpClassSimt, ArchTag,
599
+ int8_t, cutlass::layout::ColumnMajor,
600
+ int8_t, cutlass::layout::ColumnMajor,
601
+ ElementC, LayoutC,
602
+ int32_t>
603
+ {
604
+ using TileShape = Shape<_128, _128, _32>;
605
+ static constexpr int ThreadCount = 256;
606
+
607
+ using DispatchPolicy = MainloopSm70TwoStage;
608
+
609
+ using TiledMma = TiledMMA<
610
+ MMA_Atom<SM61_DP4A>,
611
+ Layout<Shape<_16, _16, _1>>>;
612
+
613
+ // A (M,K) M-major
614
+ using ElementA = int8_t;
615
+ using SmemLayoutAtomA = Layout<Shape <_128, Shape <_4, _8>>,
616
+ Stride< _4, Stride<_1,_512>>>;
617
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
618
+ static constexpr int kAlignmentA = 1;
619
+ using GmemTiledCopyA = decltype(
620
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint8_t>, ElementA>{},
621
+ Layout<Shape <_32, _8>,
622
+ Stride< _1,_32>>{},
623
+ Layout<Shape < _1, _1>>{}));
624
+
625
+ // B (N,K) K-major
626
+ using ElementB = int8_t;
627
+ using SmemLayoutAtomB = Layout<Shape <_128, Shape <_4, _8>>,
628
+ Stride< _4, Stride<_1,_512>>>;
629
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
630
+ static constexpr int kAlignmentB = 4;
631
+ using GmemTiledCopyB = decltype(
632
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint32_t>, ElementB>{},
633
+ Layout<Shape <_32,_8>,
634
+ Stride< _8,_1>>{},
635
+ Layout<Shape < _1,_4>>{}));
636
+
637
+ // Mainloop
638
+ using CollectiveMainloop = collective::CollectiveMma<
639
+ DispatchPolicy, TileShape,
640
+ ElementA, TagToStrideA_t<cutlass::layout::ColumnMajor>,
641
+ ElementB, TagToStrideB_t<cutlass::layout::ColumnMajor>,
642
+ TiledMma,
643
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
644
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
645
+ >;
646
+
647
+ // Epilogue
648
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
649
+ TagToStrideC_t<LayoutC>,
650
+ TagToStrideC_t<LayoutC>,
651
+ epilogue::thread::LinearCombination<ElementC, 1, int32_t, int32_t>,
652
+ cutlass::gemm::EpilogueDefault>;
653
+ };
654
+
655
+ ///////////////////////////////////////////////////////////////////////////////
656
+
657
+ // SIMT Two Stage NT - idp4a
658
+ template <
659
+ class ArchTag,
660
+ class ElementC, class LayoutC>
661
+ struct DefaultGemmConfigurationToCutlass3Types<
662
+ arch::OpClassSimt, ArchTag,
663
+ int8_t, cutlass::layout::ColumnMajor,
664
+ int8_t, cutlass::layout::RowMajor,
665
+ ElementC, LayoutC,
666
+ int32_t>
667
+ {
668
+ using TileShape = Shape<_128, _128, _32>;
669
+ static constexpr int ThreadCount = 256;
670
+ using DispatchPolicy = MainloopSm70TwoStage;
671
+ using TiledMma = TiledMMA<
672
+ MMA_Atom<SM61_DP4A>,
673
+ Layout<Shape<_16, _16, _1>>>;
674
+
675
+ // A (M,K) M-major
676
+ using ElementA = int8_t;
677
+ using SmemLayoutAtomA = Layout<Shape <_128, Shape <_4, _8>>,
678
+ Stride< _4, Stride<_1,_512>>>;
679
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
680
+ static constexpr int kAlignmentA = 1;
681
+ using GmemTiledCopyA = decltype(
682
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint8_t>, ElementA>{},
683
+ Layout<Shape <_32, _8>,
684
+ Stride< _1,_32>>{},
685
+ Layout<Shape < _1, _1>>{}));
686
+
687
+ // B (N,K) N-major
688
+ using ElementB = int8_t;
689
+ using SmemLayoutAtomB = Layout<Shape <_128, Shape <_4, _8>>,
690
+ Stride< _4, Stride<_1,_512>>>;
691
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
692
+ static constexpr int kAlignmentB = 1;
693
+ using GmemTiledCopyB = decltype(
694
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint8_t>, ElementB>{},
695
+ Layout<Shape <_32, _8>,
696
+ Stride< _1,_32>>{},
697
+ Layout<Shape < _1, _1>>{}));
698
+
699
+ // Mainloop
700
+ using CollectiveMainloop = collective::CollectiveMma<
701
+ DispatchPolicy, TileShape,
702
+ ElementA, TagToStrideA_t<cutlass::layout::ColumnMajor>,
703
+ ElementB, TagToStrideB_t<cutlass::layout::RowMajor>,
704
+ TiledMma,
705
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
706
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
707
+ >;
708
+
709
+ // Epilogue
710
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
711
+ TagToStrideC_t<LayoutC>,
712
+ TagToStrideC_t<LayoutC>,
713
+ epilogue::thread::LinearCombination<ElementC, 1, int32_t, int32_t>,
714
+ cutlass::gemm::EpilogueDefault>;
715
+ };
716
+
717
+ ///////////////////////////////////////////////////////////////////////////////
718
+
719
+ // SIMT Two Stage TT - idp4a
720
+ template <
721
+ class ArchTag,
722
+ class ElementC, class LayoutC>
723
+ struct DefaultGemmConfigurationToCutlass3Types<
724
+ arch::OpClassSimt, ArchTag,
725
+ int8_t, cutlass::layout::RowMajor,
726
+ int8_t, cutlass::layout::RowMajor,
727
+ ElementC, LayoutC,
728
+ int32_t>
729
+ {
730
+ using TileShape = Shape<_128, _128, _32>;
731
+ static constexpr int ThreadCount = 256;
732
+ using DispatchPolicy = MainloopSm70TwoStage;
733
+ using TiledMma = TiledMMA<
734
+ MMA_Atom<SM61_DP4A>,
735
+ Layout<Shape<_16, _16, _1>>>;
736
+
737
+ // A (M,K) K-major
738
+ using ElementA = int8_t;
739
+ using SmemLayoutAtomA = Layout<Shape <_128, Shape <_4, _8>>,
740
+ Stride< _4, Stride<_1,_512>>>;
741
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
742
+ static constexpr int kAlignmentA = 4;
743
+ using GmemTiledCopyA = decltype(
744
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint32_t>, ElementA>{},
745
+ Layout<Shape <_32,_8>,
746
+ Stride< _8,_1>>{},
747
+ Layout<Shape < _1,_4>>{}));
748
+
749
+ // B (N,K) N-major
750
+ using ElementB = int8_t;
751
+ using SmemLayoutAtomB = Layout<Shape <_128, Shape <_4, _8>>,
752
+ Stride< _4, Stride<_1,_512>>>;
753
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
754
+ static constexpr int kAlignmentB = 1;
755
+ using GmemTiledCopyB = decltype(
756
+ make_tiled_copy(Copy_Atom<UniversalCopy<cute::uint8_t>, ElementB>{},
757
+ Layout<Shape <_32, _8>,
758
+ Stride< _1,_32>>{},
759
+ Layout<Shape < _1, _1>>{}));
760
+
761
+ // Mainloop
762
+ using CollectiveMainloop = collective::CollectiveMma<
763
+ DispatchPolicy, TileShape,
764
+ ElementA, TagToStrideA_t<cutlass::layout::RowMajor>,
765
+ ElementB, TagToStrideB_t<cutlass::layout::RowMajor>,
766
+ TiledMma,
767
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
768
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
769
+ >;
770
+
771
+ // Epilogue
772
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
773
+ TagToStrideC_t<LayoutC>,
774
+ TagToStrideC_t<LayoutC>,
775
+ epilogue::thread::LinearCombination<ElementC, 1, int32_t, int32_t>,
776
+ cutlass::gemm::EpilogueDefault>;
777
+ };
778
+
779
+ ///////////////////////////////////////////////////////////////////////////////
780
+ /////////////////////////// SIMT MULTI STAGE //////////////////////////////////
781
+ ///////////////////////////////////////////////////////////////////////////////
782
+
783
+ // SIMT Multi Stage NT
784
+ template <
785
+ class ElementA,
786
+ class ElementB,
787
+ class ElementC, class LayoutC,
788
+ class ElementAccumulator>
789
+ struct DefaultGemmConfigurationToCutlass3Types<
790
+ arch::OpClassSimt, arch::Sm80,
791
+ ElementA, cutlass::layout::ColumnMajor,
792
+ ElementB, cutlass::layout::RowMajor,
793
+ ElementC, LayoutC,
794
+ ElementAccumulator>
795
+ {
796
+ using TileShape = Shape<_128, _128, _16>;
797
+ static constexpr int ThreadCount = 256;
798
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
799
+ using TiledMma = TiledMMA<
800
+ MMA_Atom<UniversalFMA<ElementAccumulator, ElementA, ElementB, ElementC>>,
801
+ Layout<Shape<_16, _16, _1>>,
802
+ Layout<Shape< _2, _2, _1>>,
803
+ Tile<Layout<_2,_16>,Layout<_2,_16>,Underscore>>;
804
+
805
+ // A (M,K) M-major
806
+ using SmemLayoutAtomA = Layout<Shape<_128,_16>>;
807
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
808
+ static constexpr int kAlignmentA = 2;
809
+ using AlignmentTypeA = cute::uint_byte_t<static_cast<int>(sizeof(ElementA)) * kAlignmentA>;
810
+ using GmemTiledCopyA = decltype(
811
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<AlignmentTypeA>, ElementA>{},
812
+ Layout<Shape<_32,_8>>{},
813
+ Layout<Shape< _2,_1>>{}));
814
+
815
+ // B (N,K) N-major
816
+ using SmemLayoutAtomB = Layout<Shape<_128,_16>>;
817
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
818
+ static constexpr int kAlignmentB = 2;
819
+ using AlignmentTypeB = cute::uint_byte_t<static_cast<int>(sizeof(ElementB)) * kAlignmentB>;
820
+ using GmemTiledCopyB = decltype(
821
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<AlignmentTypeB>, ElementB>{},
822
+ Layout<Shape<_32,_8>>{},
823
+ Layout<Shape< _2,_1>>{}));
824
+
825
+ // Mainloop
826
+ using CollectiveMainloop = collective::CollectiveMma<
827
+ DispatchPolicy, TileShape,
828
+ ElementA, TagToStrideA_t<cutlass::layout::ColumnMajor>,
829
+ ElementB, TagToStrideB_t<cutlass::layout::RowMajor>,
830
+ TiledMma,
831
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
832
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
833
+ >;
834
+
835
+ // Epilogue
836
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
837
+ TagToStrideC_t<LayoutC>,
838
+ TagToStrideC_t<LayoutC>,
839
+ epilogue::thread::LinearCombination<ElementC, 1, ElementAccumulator, ElementAccumulator>,
840
+ cutlass::gemm::EpilogueDefault>;
841
+ };
842
+
843
+ ///////////////////////////////////////////////////////////////////////////////
844
+
845
+ // SIMT Multi Stage TN
846
+ template <
847
+ class ElementA,
848
+ class ElementB,
849
+ class ElementC, class LayoutC,
850
+ class ElementAccumulator>
851
+ struct DefaultGemmConfigurationToCutlass3Types<
852
+ arch::OpClassSimt, arch::Sm80,
853
+ ElementA, cutlass::layout::RowMajor,
854
+ ElementB, cutlass::layout::ColumnMajor,
855
+ ElementC, LayoutC,
856
+ ElementAccumulator>
857
+ {
858
+ using TileShape = Shape<_128, _128, _16>;
859
+ static constexpr int ThreadCount = 256;
860
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
861
+ using TiledMma = TiledMMA<
862
+ MMA_Atom<UniversalFMA<ElementAccumulator, ElementA, ElementB, ElementC>>,
863
+ Layout<Shape<_16, _16, _1>>>;
864
+
865
+ // A (M,K) K-major
866
+ using SmemLayoutAtomA = Layout<Shape <_128, _16>,
867
+ Stride< _1, Int<128 + 1>>>; // Padded by kAlignmentA
868
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
869
+ static constexpr int kAlignmentA = 1;
870
+ using GmemTiledCopyA = decltype(
871
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<ElementA>, ElementA>{},
872
+ Layout<Shape <_16,_16>,
873
+ Stride<_16, _1>>{}));
874
+
875
+ // B (N,K) K-major
876
+ using SmemLayoutAtomB = Layout<Shape <_128, _16>,
877
+ Stride< _1, Int<128 + 1>>>; // Padded by kAlignmentB
878
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
879
+ static constexpr int kAlignmentB = 1;
880
+ using GmemTiledCopyB = decltype(
881
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<ElementB>, ElementB>{},
882
+ Layout<Shape <_16,_16>,
883
+ Stride<_16, _1>>{}));
884
+
885
+ // Mainloop
886
+ using CollectiveMainloop = collective::CollectiveMma<
887
+ DispatchPolicy, TileShape,
888
+ ElementA, TagToStrideA_t<cutlass::layout::RowMajor>,
889
+ ElementB, TagToStrideB_t<cutlass::layout::ColumnMajor>,
890
+ TiledMma,
891
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
892
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
893
+ >;
894
+
895
+ // Epilogue
896
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
897
+ TagToStrideC_t<LayoutC>,
898
+ TagToStrideC_t<LayoutC>,
899
+ epilogue::thread::LinearCombination<ElementC, 1, ElementAccumulator, ElementAccumulator>,
900
+ cutlass::gemm::EpilogueDefault>;
901
+ };
902
+
903
+ ///////////////////////////////////////////////////////////////////////////////
904
+
905
+ // SIMT Multi Stage NN
906
+ template <
907
+ class ElementA,
908
+ class ElementB,
909
+ class ElementC, class LayoutC,
910
+ class ElementAccumulator>
911
+ struct DefaultGemmConfigurationToCutlass3Types<
912
+ arch::OpClassSimt, arch::Sm80,
913
+ ElementA, cutlass::layout::ColumnMajor,
914
+ ElementB, cutlass::layout::ColumnMajor,
915
+ ElementC, LayoutC,
916
+ ElementAccumulator>
917
+ {
918
+ using TileShape = Shape<_128, _128, _16>;
919
+ static constexpr int ThreadCount = 256;
920
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
921
+ using TiledMma = TiledMMA<
922
+ MMA_Atom<UniversalFMA<ElementAccumulator, ElementA, ElementB, ElementC>>,
923
+ Layout<Shape<_16, _16, _1>>,
924
+ Layout<Shape< _2, _1, _1>>,
925
+ Tile<Layout<_2,_16>,Underscore,Underscore>>;
926
+
927
+ // A (M,K) M-major
928
+ using SmemLayoutAtomA = Layout<Shape<_128,_16>>;
929
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
930
+ static constexpr int kAlignmentA = 2;
931
+ using AlignmentTypeA = cute::uint_byte_t<static_cast<int>(sizeof(ElementA)) * kAlignmentA>;
932
+ using GmemTiledCopyA = decltype(
933
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<AlignmentTypeA>, ElementA>{},
934
+ Layout<Shape<_32,_8>>{},
935
+ Layout<Shape< _2,_1>>{}));
936
+
937
+ // B (N,K) K-major
938
+ using SmemLayoutAtomB = Layout<Shape <_128, _16>,
939
+ Stride< _1, Int<128 + 1>>>; // Padded by kAlignmentB
940
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
941
+ static constexpr int kAlignmentB = 1;
942
+ using GmemTiledCopyB = decltype(
943
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<ElementB>, ElementB>{},
944
+ Layout<Shape <_16,_16>,
945
+ Stride<_16, _1>>{}));
946
+
947
+ // Mainloop
948
+ using CollectiveMainloop = collective::CollectiveMma<
949
+ DispatchPolicy, TileShape,
950
+ ElementA, TagToStrideA_t<cutlass::layout::ColumnMajor>,
951
+ ElementB, TagToStrideB_t<cutlass::layout::ColumnMajor>,
952
+ TiledMma,
953
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
954
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
955
+ >;
956
+
957
+ // Epilogue
958
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
959
+ TagToStrideC_t<LayoutC>,
960
+ TagToStrideC_t<LayoutC>,
961
+ epilogue::thread::LinearCombination<ElementC, 1, ElementAccumulator, ElementAccumulator>,
962
+ cutlass::gemm::EpilogueDefault>;
963
+ };
964
+
965
+ ///////////////////////////////////////////////////////////////////////////////
966
+
967
+ // SIMT Multi Stage TT
968
+ template <
969
+ class ElementA,
970
+ class ElementB,
971
+ class ElementC, class LayoutC,
972
+ class ElementAccumulator>
973
+ struct DefaultGemmConfigurationToCutlass3Types<
974
+ arch::OpClassSimt, arch::Sm80,
975
+ ElementA, cutlass::layout::RowMajor,
976
+ ElementB, cutlass::layout::RowMajor,
977
+ ElementC, LayoutC,
978
+ ElementAccumulator>
979
+ {
980
+ using TileShape = Shape<_128, _128, _16>;
981
+ static constexpr int ThreadCount = 256;
982
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
983
+ using TiledMma = TiledMMA<
984
+ MMA_Atom<UniversalFMA<ElementAccumulator, ElementA, ElementB, ElementC>>,
985
+ Layout<Shape<_16, _16, _1>>,
986
+ Layout<Shape< _1, _2, _1>>,
987
+ Tile<Underscore,Layout<_2,_16>,Underscore>>;
988
+
989
+ // A (M,K) K-major
990
+ using SmemLayoutAtomA = Layout<Shape <_128, _16>,
991
+ Stride< _1, Int<128 + 1>>>; // Padded by kAlignmentA
992
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, ElementA>;
993
+ static constexpr int kAlignmentA = 1;
994
+ using GmemTiledCopyA = decltype(
995
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<ElementA>, ElementA>{},
996
+ Layout<Shape <_16,_16>,
997
+ Stride<_16, _1>>{}));
998
+
999
+ // B (N,K) N-major
1000
+ using SmemLayoutAtomB = Layout<Shape <_128,_16>>;
1001
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, ElementB>;
1002
+ static constexpr int kAlignmentB = 2;
1003
+ using AlignmentTypeB = cute::uint_byte_t<static_cast<int>(sizeof(ElementB)) * kAlignmentB>;
1004
+ using GmemTiledCopyB = decltype(
1005
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<AlignmentTypeB>, ElementB>{},
1006
+ Layout<Shape<_32,_8>>{},
1007
+ Layout<Shape< _2,_1>>{}));
1008
+
1009
+ // Mainloop
1010
+ using CollectiveMainloop = collective::CollectiveMma<
1011
+ DispatchPolicy, TileShape,
1012
+ ElementA, TagToStrideA_t<cutlass::layout::RowMajor>,
1013
+ ElementB, TagToStrideB_t<cutlass::layout::RowMajor>,
1014
+ TiledMma,
1015
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
1016
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
1017
+ >;
1018
+
1019
+ // Epilogue
1020
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
1021
+ TagToStrideC_t<LayoutC>,
1022
+ TagToStrideC_t<LayoutC>,
1023
+ epilogue::thread::LinearCombination<ElementC, 1, ElementAccumulator, ElementAccumulator>,
1024
+ cutlass::gemm::EpilogueDefault>;
1025
+ };
1026
+
1027
+ ///////////////////////////////////////////////////////////////////////////////
1028
+
1029
+ // Ampere fp64 MMA TN (K-Major A and K-Major B)
1030
+ template <>
1031
+ struct DefaultGemmConfigurationToCutlass3Types<
1032
+ arch::OpClassTensorOp, arch::Sm80,
1033
+ double, cutlass::layout::RowMajor,
1034
+ double, cutlass::layout::ColumnMajor,
1035
+ double, cutlass::layout::ColumnMajor,
1036
+ double>
1037
+ {
1038
+ using TileShape = Shape<_128, _64, _16>;
1039
+ static constexpr int ThreadCount = 128;
1040
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
1041
+ using TiledMma = TiledMMA<
1042
+ MMA_Atom<SM80_8x8x4_F64F64F64F64_TN>, // Atom
1043
+ Layout<Shape<_2,_2,_1>>, // Atom layout
1044
+ Layout<Shape<_2,_2,_1>>, // Val layout
1045
+ Tile<Layout<_2,_16>,Layout<_2,_16>,Underscore>>; // Mode permutations
1046
+
1047
+ // A (M,K) K-Major
1048
+ using SmemLayoutAtomA = decltype(
1049
+ composition(Swizzle<2,0,4>{},
1050
+ Layout<Shape <_4,_16>,
1051
+ Stride<_1, _4>>{})); // M, K
1052
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, double>;
1053
+ static constexpr int kAlignmentA = 1;
1054
+ using GmemTiledCopyA = decltype(
1055
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<double>, double>{}, // CopyAtom
1056
+ Layout<Shape < _8,_16>,
1057
+ Stride<_16, _1>>{}, // ThrLayout for CopyAtom
1058
+ Layout<Shape<_1,_1>>{})); // Value layout: 1x1 doubles
1059
+
1060
+ // B (N,K) K-Major
1061
+ using SmemLayoutAtomB = decltype(
1062
+ composition(Swizzle<2,0,4>{},
1063
+ Layout<Shape <_4,_16>,
1064
+ Stride<_1, _4>>{})); // N, K
1065
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, double>;
1066
+ static constexpr int kAlignmentB = 1;
1067
+ using GmemTiledCopyB = decltype(
1068
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<double>, double>{}, // CopyAtom
1069
+ Layout<Shape < _8,_16>,
1070
+ Stride<_16, _1>>{}, // ThrLayout for CopyAtom
1071
+ Layout<Shape<_1,_1>>{})); // Value layout: 1x1 doubles
1072
+
1073
+ // Mainloop
1074
+ using CollectiveMainloop = collective::CollectiveMma<
1075
+ DispatchPolicy, TileShape,
1076
+ double, TagToStrideA_t<cutlass::layout::RowMajor>,
1077
+ double, TagToStrideB_t<cutlass::layout::ColumnMajor>,
1078
+ TiledMma,
1079
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
1080
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
1081
+ >;
1082
+
1083
+ // Epilogue
1084
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
1085
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1086
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1087
+ epilogue::thread::LinearCombination<double, 1, double, double>,
1088
+ cutlass::gemm::EpilogueDefault>;
1089
+
1090
+ /*
1091
+ using EpilogueOutputOp = epilogue::collective::Epilogue<
1092
+ epilogue::thread::LinearCombination<double, 1, double, double>,
1093
+ Layout<Shape <_64,_32>,
1094
+ Stride< _1,_64>>, // SMEM layout
1095
+ Copy_Atom<UniversalCopy<double>,double>, // R2S with tiled_mma layout
1096
+ decltype(make_tiled_copy(Copy_Atom<UniversalCopy<double>,double>{},// S2R
1097
+ Layout<Shape <_16,_16>,
1098
+ Stride< _1,_16>>{}, // Thread layout
1099
+ Layout<Shape<_2,_1>>{})), // Value layout
1100
+ Copy_Atom<UniversalCopy<double>,double> // R2G with S2R_dst layout
1101
+ >;
1102
+ */
1103
+ };
1104
+
1105
+ ///////////////////////////////////////////////////////////////////////////////
1106
+
1107
+ // Ampere fp64 MMA NN (M-Major A and K-Major B)
1108
+ template <>
1109
+ struct DefaultGemmConfigurationToCutlass3Types<
1110
+ arch::OpClassTensorOp, arch::Sm80,
1111
+ double, cutlass::layout::ColumnMajor,
1112
+ double, cutlass::layout::ColumnMajor,
1113
+ double, cutlass::layout::ColumnMajor,
1114
+ double>
1115
+ {
1116
+ using TileShape = Shape<_128, _64, _16>;
1117
+ static constexpr int ThreadCount = 128;
1118
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
1119
+ using TiledMma = TiledMMA<
1120
+ MMA_Atom<SM80_8x8x4_F64F64F64F64_TN>, // Atom
1121
+ Layout<Shape<_2,_2,_1>>, // Atom layout
1122
+ Layout<Shape<_2,_2,_1>>, // Val layout
1123
+ Tile<Layout<_2,_16>,Layout<_2,_16>,Underscore>>; // Mode permutations
1124
+
1125
+ // A (M,K) M-Major
1126
+ using SmemLayoutAtomA = decltype(
1127
+ composition(Swizzle<2,2,2>{},
1128
+ Layout<Shape <_16, _4>,
1129
+ Stride< _1,_16>>{})); // M, K
1130
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, double>;
1131
+ static constexpr int kAlignmentA = 2;
1132
+ using GmemTiledCopyA = decltype(
1133
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, double>{}, // CopyAtom
1134
+ Layout<Shape <_16, _8>,
1135
+ Stride< _1,_16>>{}, // ThrLayout for CopyAtom
1136
+ Layout<Shape<_2,_1>>{})); // Value layout: 2x1 doubles
1137
+
1138
+ // B (N,K) K-Major
1139
+ using SmemLayoutAtomB = decltype(
1140
+ composition(Swizzle<2,0,4>{},
1141
+ Layout<Shape <_4,_16>,
1142
+ Stride<_1, _4>>{}));// N, K
1143
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, double>;
1144
+ static constexpr int kAlignmentB = 1;
1145
+ using GmemTiledCopyB = decltype(
1146
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<double>, double>{}, // CopyAtom
1147
+ Layout<Shape < _8,_16>,
1148
+ Stride<_16, _1>>{}, // ThrLayout for CopyAtom
1149
+ Layout<Shape<_1,_1>>{})); // Value layout: 1x1 doubles
1150
+
1151
+ // Mainloop
1152
+ using CollectiveMainloop = collective::CollectiveMma<
1153
+ DispatchPolicy, TileShape,
1154
+ double, TagToStrideA_t<cutlass::layout::ColumnMajor>,
1155
+ double, TagToStrideB_t<cutlass::layout::ColumnMajor>,
1156
+ TiledMma,
1157
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
1158
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
1159
+ >;
1160
+
1161
+ // Epilogue
1162
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
1163
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1164
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1165
+ epilogue::thread::LinearCombination<double, 1, double, double>,
1166
+ cutlass::gemm::EpilogueDefault>;
1167
+ };
1168
+
1169
+ ///////////////////////////////////////////////////////////////////////////////
1170
+
1171
+ // Ampere fp64 MMA NT (M-Major A and N-Major B)
1172
+ template <>
1173
+ struct DefaultGemmConfigurationToCutlass3Types<
1174
+ arch::OpClassTensorOp, arch::Sm80,
1175
+ double, cutlass::layout::ColumnMajor,
1176
+ double, cutlass::layout::RowMajor,
1177
+ double, cutlass::layout::ColumnMajor,
1178
+ double>
1179
+ {
1180
+ using TileShape = Shape<_128, _64, _16>;
1181
+ static constexpr int ThreadCount = 128;
1182
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
1183
+ using TiledMma = TiledMMA<
1184
+ MMA_Atom<SM80_8x8x4_F64F64F64F64_TN>, // Atom
1185
+ Layout<Shape<_2,_2,_1>>, // Atom layout
1186
+ Layout<Shape<_2,_2,_1>>, // Val layout
1187
+ Tile<Layout<_2,_16>,Layout<_2,_16>,Underscore>>; // Mode permutations
1188
+
1189
+ // A (M,K) M-Major
1190
+ using SmemLayoutAtomA = decltype(
1191
+ composition(Swizzle<2,2,2>{},
1192
+ Layout<Shape <_16, _4>,
1193
+ Stride< _1,_16>>{})); // M, K
1194
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, double>;
1195
+ static constexpr int kAlignmentA = 2;
1196
+ using GmemTiledCopyA = decltype(
1197
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, double>{}, // CopyAtom
1198
+ Layout<Shape <_16, _8>,
1199
+ Stride< _1,_16>>{}, // ThrLayout for CopyAtom
1200
+ Layout<Shape<_2,_1>>{})); // Value layout: 2x1 doubles
1201
+
1202
+ // B (N,K) N-Major
1203
+ using SmemLayoutAtomB = decltype(
1204
+ composition(Swizzle<2,2,2>{},
1205
+ Layout<Shape <_16, _4>,
1206
+ Stride< _1,_16>>{})); // N, K
1207
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, double>;
1208
+ static constexpr int kAlignmentB = 2;
1209
+ using GmemTiledCopyB = decltype(
1210
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, double>{}, // CopyAtom
1211
+ Layout<Shape <_16, _8>,
1212
+ Stride< _1,_16>>{}, // ThrLayout for CopyAtom
1213
+ Layout<Shape<_2,_1>>{})); // Value layout: 2x1 doubles
1214
+
1215
+ // Mainloop
1216
+ using CollectiveMainloop = collective::CollectiveMma<
1217
+ DispatchPolicy, TileShape,
1218
+ double, TagToStrideA_t<cutlass::layout::ColumnMajor>,
1219
+ double, TagToStrideB_t<cutlass::layout::RowMajor>,
1220
+ TiledMma,
1221
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
1222
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
1223
+ >;
1224
+
1225
+ // Epilogue
1226
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
1227
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1228
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1229
+ epilogue::thread::LinearCombination<double, 1, double, double>,
1230
+ cutlass::gemm::EpilogueDefault>;
1231
+ };
1232
+
1233
+ ///////////////////////////////////////////////////////////////////////////////
1234
+
1235
+ // Ampere fp64 MMA TT (K-Major A and N-Major B)
1236
+ template <>
1237
+ struct DefaultGemmConfigurationToCutlass3Types<
1238
+ arch::OpClassTensorOp, arch::Sm80,
1239
+ double, cutlass::layout::RowMajor,
1240
+ double, cutlass::layout::RowMajor,
1241
+ double, cutlass::layout::ColumnMajor,
1242
+ double>
1243
+ {
1244
+ using TileShape = Shape<_128, _64, _16>;
1245
+ static constexpr int ThreadCount = 128;
1246
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
1247
+ using TiledMma = TiledMMA<
1248
+ MMA_Atom<SM80_8x8x4_F64F64F64F64_TN>, // Atom
1249
+ Layout<Shape<_2,_2,_1>>, // Atom layout
1250
+ Layout<Shape<_2,_2,_1>>, // Val layout
1251
+ Tile<Layout<_2,_16>,Layout<_2,_16>,Underscore>>; // Mode permutations
1252
+
1253
+ // A (M,K) K-Major
1254
+ using SmemLayoutAtomA = decltype(
1255
+ composition(Swizzle<2,0,4>{},
1256
+ Layout<Shape <_4,_16>,
1257
+ Stride<_1, _4>>{})); // M, K
1258
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, double>;
1259
+ static constexpr int kAlignmentA = 1;
1260
+ using GmemTiledCopyA = decltype(
1261
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<double>, double>{}, // CopyAtom
1262
+ Layout<Shape < _8,_16>,
1263
+ Stride<_16, _1>>{}, // ThrLayout for CopyAtom
1264
+ Layout<Shape<_1,_1>>{})); // Value layout: 1x1 doubles
1265
+
1266
+ // B (N,K) N-Major
1267
+ using SmemLayoutAtomB = decltype(
1268
+ composition(Swizzle<2,2,2>{},
1269
+ Layout<Shape <_16, _4>,
1270
+ Stride< _1,_16>>{})); // N, K
1271
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, double>;
1272
+ static constexpr int kAlignmentB = 2;
1273
+ using GmemTiledCopyB = decltype(
1274
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, double>{}, // CopyAtom
1275
+ Layout<Shape <_16, _8>,
1276
+ Stride< _1,_16>>{}, // ThrLayout for CopyAtom
1277
+ Layout<Shape<_2,_1>>{})); // Value layout: 2x1 doubles
1278
+
1279
+ // Mainloop
1280
+ using CollectiveMainloop = collective::CollectiveMma<
1281
+ DispatchPolicy, TileShape,
1282
+ double, TagToStrideA_t<cutlass::layout::RowMajor>,
1283
+ double, TagToStrideB_t<cutlass::layout::RowMajor>,
1284
+ TiledMma,
1285
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
1286
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
1287
+ >;
1288
+
1289
+ // Epilogue
1290
+ using CollectiveEpilogue = epilogue::collective::DefaultEpilogue<
1291
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1292
+ TagToStrideC_t<cutlass::layout::ColumnMajor>,
1293
+ epilogue::thread::LinearCombination<double, 1, double, double>,
1294
+ cutlass::gemm::EpilogueDefault>;
1295
+ };
1296
+
1297
+ ///////////////////////////////////////////////////////////////////////////////
1298
+
1299
+ // Hopper fp64 MMA TN
1300
+ template <>
1301
+ struct DefaultGemmConfigurationToCutlass3Types<
1302
+ arch::OpClassTensorOp, arch::Sm90,
1303
+ double, cutlass::layout::RowMajor,
1304
+ double, cutlass::layout::ColumnMajor,
1305
+ double, cutlass::layout::ColumnMajor,
1306
+ double>
1307
+ {
1308
+ using TileShape = Shape<_128, _64, _16>;
1309
+ static constexpr int ThreadCount = 128;
1310
+ using DispatchPolicy = MainloopSm80CpAsync<3>;
1311
+ using TiledMma = TiledMMA<
1312
+ MMA_Atom<SM90_16x8x16_F64F64F64F64_TN>,
1313
+ Layout<Shape<_2,_2,_1>>>;
1314
+
1315
+ // A (M,K) K-major
1316
+ using SmemLayoutAtomA = decltype(
1317
+ make_ordered_layout(Shape<_128,_16>{},
1318
+ Step < _2, _1>{})); // M, K
1319
+ using SmemCopyAtomA = Copy_Atom<DefaultCopy, double>;
1320
+ static constexpr int kAlignmentA = 2;
1321
+ using GmemTiledCopyA = decltype(
1322
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, double>{},
1323
+ Layout<Shape <_16,_8>,
1324
+ Stride< _8,_1>>{},
1325
+ Layout<Shape < _1,_2>>{}));
1326
+
1327
+ // B (N,K) K-major
1328
+ using SmemLayoutAtomB = decltype(
1329
+ make_ordered_layout(Shape<_64,_16>{},
1330
+ Step < _2, _1>{})); // N, K
1331
+ using SmemCopyAtomB = Copy_Atom<DefaultCopy, double>;
1332
+ static constexpr int kAlignmentB = 2;
1333
+ using GmemTiledCopyB = decltype(
1334
+ make_tiled_copy(Copy_Atom<SM80_CP_ASYNC_CACHEALWAYS<cute::uint128_t>, double>{},
1335
+ Layout<Shape <_16,_8>,
1336
+ Stride< _8,_1>>{},
1337
+ Layout<Shape < _1,_2>>{}));
1338
+
1339
+ // Mainloop
1340
+ using CollectiveMainloop = collective::CollectiveMma<
1341
+ DispatchPolicy, TileShape,
1342
+ double, TagToStrideA_t<cutlass::layout::RowMajor>,
1343
+ double, TagToStrideB_t<cutlass::layout::ColumnMajor>,
1344
+ TiledMma,
1345
+ GmemTiledCopyA, SmemLayoutAtomA, SmemCopyAtomA, cute::identity, // A
1346
+ GmemTiledCopyB, SmemLayoutAtomB, SmemCopyAtomB, cute::identity // B
1347
+ >;
1348
+
1349
+ // Epilogue
1350
+ using CollectiveEpilogue = typename cutlass::epilogue::collective::CollectiveBuilder<
1351
+ cutlass::arch::Sm90, cutlass::arch::OpClassTensorOp,
1352
+ TileShape, Shape<_1,_1,_1>,
1353
+ cutlass::epilogue::collective::EpilogueTileAuto,
1354
+ double, double,
1355
+ double, cutlass::layout::ColumnMajor, 1,
1356
+ double, cutlass::layout::ColumnMajor, 1,
1357
+ cutlass::epilogue::collective::EpilogueScheduleAuto
1358
+ >::CollectiveOp;
1359
+
1360
+ };
1361
+
1362
+ ///////////////////////////////////////////////////////////////////////////////
1363
+
1364
+ } // namespace device
1365
+ } // namespace gemm
1366
+ } // namespace cutlass
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32n_tensor_op_s32_sm75.cu ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+ /////////////////////////////////////////////////////////////////////////////////////////////////
53
+
54
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x256x512_64x64x512) {
55
+
56
+ using ElementOutput = int32_t;
57
+ using ElementAccumulator = int32_t;
58
+ using ElementCompute = int32_t;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
62
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
63
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
64
+ cutlass::gemm::GemmShape<128, 256, 512>,
65
+ cutlass::gemm::GemmShape<64, 64, 512>,
66
+ cutlass::gemm::GemmShape<8, 8, 128>,
67
+ cutlass::epilogue::thread::LinearCombination<
68
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
69
+ ElementAccumulator, ElementCompute>,
70
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
71
+ false, cutlass::arch::OpXorPopc>;
72
+
73
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
74
+ }
75
+
76
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 256x128x512_64x64x512) {
77
+
78
+ using ElementOutput = int32_t;
79
+ using ElementAccumulator = int32_t;
80
+ using ElementCompute = int32_t;
81
+
82
+ using Gemm = cutlass::gemm::device::Gemm<
83
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
84
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
85
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
86
+ cutlass::gemm::GemmShape<256, 128, 512>,
87
+ cutlass::gemm::GemmShape<64, 64, 512>,
88
+ cutlass::gemm::GemmShape<8, 8, 128>,
89
+ cutlass::epilogue::thread::LinearCombination<
90
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
91
+ ElementAccumulator, ElementCompute>,
92
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
93
+ false, cutlass::arch::OpXorPopc>;
94
+
95
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
96
+ }
97
+
98
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x128x512_64x64x512) {
99
+
100
+ using ElementOutput = int32_t;
101
+ using ElementAccumulator = int32_t;
102
+ using ElementCompute = int32_t;
103
+
104
+ using Gemm = cutlass::gemm::device::Gemm<
105
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
106
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
107
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
108
+ cutlass::gemm::GemmShape<128, 128, 512>,
109
+ cutlass::gemm::GemmShape<64, 64, 512>,
110
+ cutlass::gemm::GemmShape<8, 8, 128>,
111
+ cutlass::epilogue::thread::LinearCombination<
112
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
113
+ ElementAccumulator, ElementCompute>,
114
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
115
+ false, cutlass::arch::OpXorPopc>;
116
+
117
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
118
+ }
119
+
120
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x256x512_64x64x512) {
121
+
122
+ using ElementOutput = int32_t;
123
+ using ElementAccumulator = int32_t;
124
+ using ElementCompute = int32_t;
125
+
126
+ using Gemm = cutlass::gemm::device::Gemm<
127
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
128
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
129
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
130
+ cutlass::gemm::GemmShape<64, 256, 512>,
131
+ cutlass::gemm::GemmShape<64, 64, 512>,
132
+ cutlass::gemm::GemmShape<8, 8, 128>,
133
+ cutlass::epilogue::thread::LinearCombination<
134
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
135
+ ElementAccumulator, ElementCompute>,
136
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
137
+ false, cutlass::arch::OpXorPopc>;
138
+
139
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
140
+ }
141
+
142
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 256x64x512_64x64x512) {
143
+
144
+ using ElementOutput = int32_t;
145
+ using ElementAccumulator = int32_t;
146
+ using ElementCompute = int32_t;
147
+
148
+ using Gemm = cutlass::gemm::device::Gemm<
149
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
150
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
151
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
152
+ cutlass::gemm::GemmShape<256, 64, 512>,
153
+ cutlass::gemm::GemmShape<64, 64, 512>,
154
+ cutlass::gemm::GemmShape<8, 8, 128>,
155
+ cutlass::epilogue::thread::LinearCombination<
156
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
157
+ ElementAccumulator, ElementCompute>,
158
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
159
+ false, cutlass::arch::OpXorPopc>;
160
+
161
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
162
+ }
163
+
164
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x128x512_32x64x512) {
165
+
166
+ using ElementOutput = int32_t;
167
+ using ElementAccumulator = int32_t;
168
+ using ElementCompute = int32_t;
169
+
170
+ using Gemm = cutlass::gemm::device::Gemm<
171
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
172
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
173
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
174
+ cutlass::gemm::GemmShape<64, 128, 512>,
175
+ cutlass::gemm::GemmShape<32, 64, 512>,
176
+ cutlass::gemm::GemmShape<8, 8, 128>,
177
+ cutlass::epilogue::thread::LinearCombination<
178
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
179
+ ElementAccumulator, ElementCompute>,
180
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
181
+ false, cutlass::arch::OpXorPopc>;
182
+
183
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
184
+ }
185
+
186
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x64x512_64x32x512) {
187
+
188
+ using ElementOutput = int32_t;
189
+ using ElementAccumulator = int32_t;
190
+ using ElementCompute = int32_t;
191
+
192
+ using Gemm = cutlass::gemm::device::Gemm<
193
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
194
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
195
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
196
+ cutlass::gemm::GemmShape<128, 64, 512>,
197
+ cutlass::gemm::GemmShape<64, 32, 512>,
198
+ cutlass::gemm::GemmShape<8, 8, 128>,
199
+ cutlass::epilogue::thread::LinearCombination<
200
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
201
+ ElementAccumulator, ElementCompute>,
202
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
203
+ false, cutlass::arch::OpXorPopc>;
204
+
205
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
206
+ }
207
+
208
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x64x512_32x32x512) {
209
+
210
+ using ElementOutput = int32_t;
211
+ using ElementAccumulator = int32_t;
212
+ using ElementCompute = int32_t;
213
+
214
+ using Gemm = cutlass::gemm::device::Gemm<
215
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
216
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
217
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
218
+ cutlass::gemm::GemmShape<64, 64, 512>,
219
+ cutlass::gemm::GemmShape<32, 32, 512>,
220
+ cutlass::gemm::GemmShape<8, 8, 128>,
221
+ cutlass::epilogue::thread::LinearCombination<
222
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
223
+ ElementAccumulator, ElementCompute>,
224
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
225
+ false, cutlass::arch::OpXorPopc>;
226
+
227
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
228
+ }
229
+
230
+ /////////////////////////////////////////////////////////////////////////////////////////////////
231
+
232
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32n_tensor_op_s32_sm80.cu ADDED
@@ -0,0 +1,704 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+
49
+ #if defined(CUTLASS_ARCH_MMA_B1_AND_SM80_ENABLED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x256x1024_64x64x1024) {
54
+ using ElementOutput = int32_t;
55
+ using ElementAccumulator = int32_t;
56
+ using ElementCompute = int32_t;
57
+
58
+ using Gemm = cutlass::gemm::device::Gemm<
59
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
60
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
61
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
62
+ cutlass::gemm::GemmShape<128, 256, 1024>,
63
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
64
+ cutlass::epilogue::thread::LinearCombination<
65
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
66
+ ElementAccumulator, ElementCompute>,
67
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
68
+ false, cutlass::arch::OpAndPopc>;
69
+
70
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
71
+ }
72
+
73
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 256x128x1024_64x64x1024) {
74
+ using ElementOutput = int32_t;
75
+ using ElementAccumulator = int32_t;
76
+ using ElementCompute = int32_t;
77
+
78
+ using Gemm = cutlass::gemm::device::Gemm<
79
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
80
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
81
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
82
+ cutlass::gemm::GemmShape<256, 128, 1024>,
83
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
84
+ cutlass::epilogue::thread::LinearCombination<
85
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
86
+ ElementAccumulator, ElementCompute>,
87
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3,128, 128,
88
+ false, cutlass::arch::OpAndPopc>;
89
+
90
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
91
+ }
92
+
93
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x128x1024_64x64x1024) {
94
+ using ElementOutput = int32_t;
95
+ using ElementAccumulator = int32_t;
96
+ using ElementCompute = int32_t;
97
+
98
+ using Gemm = cutlass::gemm::device::Gemm<
99
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
100
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
101
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
102
+ cutlass::gemm::GemmShape<128, 128, 1024>,
103
+ cutlass::gemm::GemmShape<64, 64, 1024>,
104
+ cutlass::gemm::GemmShape<16, 8, 256>,
105
+ cutlass::epilogue::thread::LinearCombination<
106
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
107
+ ElementAccumulator, ElementCompute>,
108
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
109
+ false, cutlass::arch::OpAndPopc>;
110
+
111
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
112
+ }
113
+
114
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 256x64x1024_64x64x1024) {
115
+ using ElementOutput = int32_t;
116
+ using ElementAccumulator = int32_t;
117
+ using ElementCompute = int32_t;
118
+
119
+ using Gemm = cutlass::gemm::device::Gemm<
120
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
121
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
122
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
123
+ cutlass::gemm::GemmShape<256, 64, 1024>,
124
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
125
+ cutlass::epilogue::thread::LinearCombination<
126
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
127
+ ElementAccumulator, ElementCompute>,
128
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
129
+ false, cutlass::arch::OpAndPopc>;
130
+
131
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
132
+ }
133
+
134
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x256x1024_64x64x1024) {
135
+ using ElementOutput = int32_t;
136
+ using ElementAccumulator = int32_t;
137
+ using ElementCompute = int32_t;
138
+
139
+ using Gemm = cutlass::gemm::device::Gemm<
140
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
141
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
142
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
143
+ cutlass::gemm::GemmShape<64, 256, 1024>,
144
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
145
+ cutlass::epilogue::thread::LinearCombination<
146
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
147
+ ElementAccumulator, ElementCompute>,
148
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
149
+ false, cutlass::arch::OpAndPopc>;
150
+
151
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
152
+ }
153
+
154
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x128x1024_32x64x1024) {
155
+ using ElementOutput = int32_t;
156
+ using ElementAccumulator = int32_t;
157
+ using ElementCompute = int32_t;
158
+
159
+ using Gemm = cutlass::gemm::device::Gemm<
160
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
161
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
162
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
163
+ cutlass::gemm::GemmShape<64, 128, 1024>,
164
+ cutlass::gemm::GemmShape<32, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
165
+ cutlass::epilogue::thread::LinearCombination<
166
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
167
+ ElementAccumulator, ElementCompute>,
168
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
169
+ false, cutlass::arch::OpAndPopc>;
170
+
171
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
172
+ }
173
+
174
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x64x1024_64x32x1024) {
175
+ using ElementOutput = int32_t;
176
+ using ElementAccumulator = int32_t;
177
+ using ElementCompute = int32_t;
178
+
179
+ using Gemm = cutlass::gemm::device::Gemm<
180
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
181
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
182
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
183
+ cutlass::gemm::GemmShape<128, 64, 1024>,
184
+ cutlass::gemm::GemmShape<64, 32, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
185
+ cutlass::epilogue::thread::LinearCombination<
186
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
187
+ ElementAccumulator, ElementCompute>,
188
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
189
+ false, cutlass::arch::OpAndPopc>;
190
+
191
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
192
+ }
193
+
194
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x64x1024_32x32x1024) {
195
+ using ElementOutput = int32_t;
196
+ using ElementAccumulator = int32_t;
197
+ using ElementCompute = int32_t;
198
+
199
+ using Gemm = cutlass::gemm::device::Gemm<
200
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
201
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
202
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
203
+ cutlass::gemm::GemmShape<64, 64, 1024>,
204
+ cutlass::gemm::GemmShape<32, 32, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
205
+ cutlass::epilogue::thread::LinearCombination<
206
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
207
+ ElementAccumulator, ElementCompute>,
208
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
209
+ false, cutlass::arch::OpAndPopc>;
210
+
211
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
212
+ }
213
+
214
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x256x512_64x64x512) {
215
+ using ElementOutput = int32_t;
216
+ using ElementAccumulator = int32_t;
217
+ using ElementCompute = int32_t;
218
+
219
+ using Gemm = cutlass::gemm::device::Gemm<
220
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
221
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
222
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
223
+ cutlass::gemm::GemmShape<128, 256, 512>,
224
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
225
+ cutlass::epilogue::thread::LinearCombination<
226
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
227
+ ElementAccumulator, ElementCompute>,
228
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
229
+ false, cutlass::arch::OpAndPopc>;
230
+
231
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
232
+ }
233
+
234
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 256x128x512_64x64x512) {
235
+ using ElementOutput = int32_t;
236
+ using ElementAccumulator = int32_t;
237
+ using ElementCompute = int32_t;
238
+
239
+ using Gemm = cutlass::gemm::device::Gemm<
240
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
241
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
242
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
243
+ cutlass::gemm::GemmShape<256, 128, 512>,
244
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
245
+ cutlass::epilogue::thread::LinearCombination<
246
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
247
+ ElementAccumulator, ElementCompute>,
248
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
249
+ false, cutlass::arch::OpAndPopc>;
250
+
251
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
252
+ }
253
+
254
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x128x512_64x64x512) {
255
+ using ElementOutput = int32_t;
256
+ using ElementAccumulator = int32_t;
257
+ using ElementCompute = int32_t;
258
+
259
+ using Gemm = cutlass::gemm::device::Gemm<
260
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
261
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
262
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
263
+ cutlass::gemm::GemmShape<128, 128, 512>,
264
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
265
+ cutlass::epilogue::thread::LinearCombination<
266
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
267
+ ElementAccumulator, ElementCompute>,
268
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
269
+ false, cutlass::arch::OpAndPopc>;
270
+
271
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
272
+ }
273
+
274
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 256x64x512_64x64x512) {
275
+ using ElementOutput = int32_t;
276
+ using ElementAccumulator = int32_t;
277
+ using ElementCompute = int32_t;
278
+
279
+ using Gemm = cutlass::gemm::device::Gemm<
280
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
281
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
282
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
283
+ cutlass::gemm::GemmShape<256, 64, 512>,
284
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
285
+ cutlass::epilogue::thread::LinearCombination<
286
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
287
+ ElementAccumulator, ElementCompute>,
288
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
289
+ false, cutlass::arch::OpAndPopc>;
290
+
291
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
292
+ }
293
+
294
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x256x512_64x64x512) {
295
+ using ElementOutput = int32_t;
296
+ using ElementAccumulator = int32_t;
297
+ using ElementCompute = int32_t;
298
+
299
+ using Gemm = cutlass::gemm::device::Gemm<
300
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
301
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
302
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
303
+ cutlass::gemm::GemmShape<64, 256, 512>,
304
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
305
+ cutlass::epilogue::thread::LinearCombination<
306
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
307
+ ElementAccumulator, ElementCompute>,
308
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
309
+ false, cutlass::arch::OpAndPopc>;
310
+
311
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
312
+ }
313
+
314
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x128x512_32x64x512) {
315
+ using ElementOutput = int32_t;
316
+ using ElementAccumulator = int32_t;
317
+ using ElementCompute = int32_t;
318
+
319
+ using Gemm = cutlass::gemm::device::Gemm<
320
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
321
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
322
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
323
+ cutlass::gemm::GemmShape<64, 128, 512>,
324
+ cutlass::gemm::GemmShape<32, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
325
+ cutlass::epilogue::thread::LinearCombination<
326
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
327
+ ElementAccumulator, ElementCompute>,
328
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
329
+ false, cutlass::arch::OpAndPopc>;
330
+
331
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
332
+ }
333
+
334
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 128x64x512_64x32x512) {
335
+ using ElementOutput = int32_t;
336
+ using ElementAccumulator = int32_t;
337
+ using ElementCompute = int32_t;
338
+
339
+ using Gemm = cutlass::gemm::device::Gemm<
340
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
341
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
342
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
343
+ cutlass::gemm::GemmShape<128, 64, 512>,
344
+ cutlass::gemm::GemmShape<64, 32, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
345
+ cutlass::epilogue::thread::LinearCombination<
346
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
347
+ ElementAccumulator, ElementCompute>,
348
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
349
+ false, cutlass::arch::OpAndPopc>;
350
+
351
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
352
+ }
353
+
354
+ TEST(SM80_Device_Gemm_b1t_b1n_s32n_tensor_op_s32, 64x64x512_32x32x512) {
355
+ using ElementOutput = int32_t;
356
+ using ElementAccumulator = int32_t;
357
+ using ElementCompute = int32_t;
358
+
359
+ using Gemm = cutlass::gemm::device::Gemm<
360
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
361
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
362
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
363
+ cutlass::gemm::GemmShape<64, 64, 512>,
364
+ cutlass::gemm::GemmShape<32, 32, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
365
+ cutlass::epilogue::thread::LinearCombination<
366
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
367
+ ElementAccumulator, ElementCompute>,
368
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6, 128, 128,
369
+ false, cutlass::arch::OpAndPopc>;
370
+
371
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
372
+ }
373
+
374
+ #endif // defined(CUTLASS_ARCH_MMA_B1_AND_SM80_ENABLED)
375
+
376
+ ////////////////////////////////////////////////////////////////////////////////
377
+
378
+ #if defined(CUTLASS_ARCH_MMA_B1_XOR_SM80_ENABLED)
379
+
380
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 128x256x1024_64x64x1024) {
381
+ using ElementOutput = int32_t;
382
+ using ElementAccumulator = int32_t;
383
+ using ElementCompute = int32_t;
384
+
385
+ using Gemm = cutlass::gemm::device::Gemm<
386
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
387
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
388
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
389
+ cutlass::gemm::GemmShape<128, 256, 1024>,
390
+ cutlass::gemm::GemmShape<64, 64, 1024>,
391
+ cutlass::gemm::GemmShape<16, 8, 256>,
392
+ cutlass::epilogue::thread::LinearCombination<
393
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
394
+ ElementAccumulator, ElementCompute>,
395
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
396
+ false, cutlass::arch::OpXorPopc>;
397
+
398
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
399
+ }
400
+
401
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 256x128x1024_64x64x1024) {
402
+ using ElementOutput = int32_t;
403
+ using ElementAccumulator = int32_t;
404
+ using ElementCompute = int32_t;
405
+
406
+ using Gemm = cutlass::gemm::device::Gemm<
407
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
408
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
409
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
410
+ cutlass::gemm::GemmShape<256, 128, 1024>,
411
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
412
+ cutlass::epilogue::thread::LinearCombination<
413
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
414
+ ElementAccumulator, ElementCompute>,
415
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
416
+ false, cutlass::arch::OpXorPopc>;
417
+
418
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
419
+ }
420
+
421
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 128x128x1024_64x64x1024) {
422
+ using ElementOutput = int32_t;
423
+ using ElementAccumulator = int32_t;
424
+ using ElementCompute = int32_t;
425
+
426
+ using Gemm = cutlass::gemm::device::Gemm<
427
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
428
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
429
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
430
+ cutlass::gemm::GemmShape<128, 128, 1024>,
431
+ cutlass::gemm::GemmShape<64, 64, 1024>,
432
+ cutlass::gemm::GemmShape<16, 8, 256>,
433
+ cutlass::epilogue::thread::LinearCombination<
434
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
435
+ ElementAccumulator, ElementCompute>,
436
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
437
+ false, cutlass::arch::OpXorPopc>;
438
+
439
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
440
+ }
441
+
442
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 256x64x1024_64x64x1024) {
443
+ using ElementOutput = int32_t;
444
+ using ElementAccumulator = int32_t;
445
+ using ElementCompute = int32_t;
446
+
447
+ using Gemm = cutlass::gemm::device::Gemm<
448
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
449
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
450
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
451
+ cutlass::gemm::GemmShape<256, 64, 1024>,
452
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
453
+ cutlass::epilogue::thread::LinearCombination<
454
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
455
+ ElementAccumulator, ElementCompute>,
456
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
457
+ false, cutlass::arch::OpXorPopc>;
458
+
459
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
460
+ }
461
+
462
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 64x256x1024_64x64x1024) {
463
+ using ElementOutput = int32_t;
464
+ using ElementAccumulator = int32_t;
465
+ using ElementCompute = int32_t;
466
+
467
+ using Gemm = cutlass::gemm::device::Gemm<
468
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
469
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
470
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
471
+ cutlass::gemm::GemmShape<64, 256, 1024>,
472
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
473
+ cutlass::epilogue::thread::LinearCombination<
474
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
475
+ ElementAccumulator, ElementCompute>,
476
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
477
+ false, cutlass::arch::OpXorPopc>;
478
+
479
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
480
+ }
481
+
482
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 64x128x1024_32x64x1024) {
483
+ using ElementOutput = int32_t;
484
+ using ElementAccumulator = int32_t;
485
+ using ElementCompute = int32_t;
486
+
487
+ using Gemm = cutlass::gemm::device::Gemm<
488
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
489
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
490
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
491
+ cutlass::gemm::GemmShape<64, 128, 1024>,
492
+ cutlass::gemm::GemmShape<32, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
493
+ cutlass::epilogue::thread::LinearCombination<
494
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
495
+ ElementAccumulator, ElementCompute>,
496
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
497
+ false, cutlass::arch::OpXorPopc>;
498
+
499
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
500
+ }
501
+
502
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 128x64x1024_64x32x1024) {
503
+ using ElementOutput = int32_t;
504
+ using ElementAccumulator = int32_t;
505
+ using ElementCompute = int32_t;
506
+
507
+ using Gemm = cutlass::gemm::device::Gemm<
508
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
509
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
510
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
511
+ cutlass::gemm::GemmShape<128, 64, 1024>,
512
+ cutlass::gemm::GemmShape<64, 32, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
513
+ cutlass::epilogue::thread::LinearCombination<
514
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
515
+ ElementAccumulator, ElementCompute>,
516
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
517
+ false, cutlass::arch::OpXorPopc>;
518
+
519
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
520
+ }
521
+
522
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 64x64x1024_32x32x1024) {
523
+ using ElementOutput = int32_t;
524
+ using ElementAccumulator = int32_t;
525
+ using ElementCompute = int32_t;
526
+
527
+ using Gemm = cutlass::gemm::device::Gemm<
528
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
529
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
530
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
531
+ cutlass::gemm::GemmShape<64, 64, 1024>,
532
+ cutlass::gemm::GemmShape<32, 32, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
533
+ cutlass::epilogue::thread::LinearCombination<
534
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
535
+ ElementAccumulator, ElementCompute>,
536
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
537
+ false, cutlass::arch::OpXorPopc>;
538
+
539
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
540
+ }
541
+
542
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 128x256x512_64x64x512) {
543
+ using ElementOutput = int32_t;
544
+ using ElementAccumulator = int32_t;
545
+ using ElementCompute = int32_t;
546
+
547
+ using Gemm = cutlass::gemm::device::Gemm<
548
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
549
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
550
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
551
+ cutlass::gemm::GemmShape<128, 256, 512>,
552
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
553
+ cutlass::epilogue::thread::LinearCombination<
554
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
555
+ ElementAccumulator, ElementCompute>,
556
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
557
+ false, cutlass::arch::OpXorPopc>;
558
+
559
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
560
+ }
561
+
562
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 256x128x512_64x64x512) {
563
+ using ElementOutput = int32_t;
564
+ using ElementAccumulator = int32_t;
565
+ using ElementCompute = int32_t;
566
+
567
+ using Gemm = cutlass::gemm::device::Gemm<
568
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
569
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
570
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
571
+ cutlass::gemm::GemmShape<256, 128, 512>,
572
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
573
+ cutlass::epilogue::thread::LinearCombination<
574
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
575
+ ElementAccumulator, ElementCompute>,
576
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
577
+ false, cutlass::arch::OpXorPopc>;
578
+
579
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
580
+ }
581
+
582
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 128x128x512_64x64x512) {
583
+ using ElementOutput = int32_t;
584
+ using ElementAccumulator = int32_t;
585
+ using ElementCompute = int32_t;
586
+
587
+ using Gemm = cutlass::gemm::device::Gemm<
588
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
589
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
590
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
591
+ cutlass::gemm::GemmShape<128, 128, 512>,
592
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
593
+ cutlass::epilogue::thread::LinearCombination<
594
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
595
+ ElementAccumulator, ElementCompute>,
596
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
597
+ false, cutlass::arch::OpXorPopc>;
598
+
599
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
600
+ }
601
+
602
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 256x64x512_64x64x512) {
603
+ using ElementOutput = int32_t;
604
+ using ElementAccumulator = int32_t;
605
+ using ElementCompute = int32_t;
606
+
607
+ using Gemm = cutlass::gemm::device::Gemm<
608
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
609
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
610
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
611
+ cutlass::gemm::GemmShape<256, 64, 512>,
612
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
613
+ cutlass::epilogue::thread::LinearCombination<
614
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
615
+ ElementAccumulator, ElementCompute>,
616
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
617
+ false, cutlass::arch::OpXorPopc>;
618
+
619
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
620
+ }
621
+
622
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 64x256x512_64x64x512) {
623
+ using ElementOutput = int32_t;
624
+ using ElementAccumulator = int32_t;
625
+ using ElementCompute = int32_t;
626
+
627
+ using Gemm = cutlass::gemm::device::Gemm<
628
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
629
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
630
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
631
+ cutlass::gemm::GemmShape<64, 256, 512>,
632
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
633
+ cutlass::epilogue::thread::LinearCombination<
634
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
635
+ ElementAccumulator, ElementCompute>,
636
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
637
+ false, cutlass::arch::OpXorPopc>;
638
+
639
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
640
+ }
641
+
642
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 64x128x512_32x64x512) {
643
+ using ElementOutput = int32_t;
644
+ using ElementAccumulator = int32_t;
645
+ using ElementCompute = int32_t;
646
+
647
+ using Gemm = cutlass::gemm::device::Gemm<
648
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
649
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
650
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
651
+ cutlass::gemm::GemmShape<64, 128, 512>,
652
+ cutlass::gemm::GemmShape<32, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
653
+ cutlass::epilogue::thread::LinearCombination<
654
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
655
+ ElementAccumulator, ElementCompute>,
656
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
657
+ false, cutlass::arch::OpXorPopc>;
658
+
659
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
660
+ }
661
+
662
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 128x64x512_64x32x512) {
663
+ using ElementOutput = int32_t;
664
+ using ElementAccumulator = int32_t;
665
+ using ElementCompute = int32_t;
666
+
667
+ using Gemm = cutlass::gemm::device::Gemm<
668
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
669
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
670
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
671
+ cutlass::gemm::GemmShape<128, 64, 512>,
672
+ cutlass::gemm::GemmShape<64, 32, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
673
+ cutlass::epilogue::thread::LinearCombination<
674
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
675
+ ElementAccumulator, ElementCompute>,
676
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
677
+ false, cutlass::arch::OpXorPopc>;
678
+
679
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
680
+ }
681
+
682
+ TEST(SM80_Device_Gemm_XOR_b1t_b1n_s32n_tensor_op_s32, 64x64x512_32x32x512) {
683
+ using ElementOutput = int32_t;
684
+ using ElementAccumulator = int32_t;
685
+ using ElementCompute = int32_t;
686
+
687
+ using Gemm = cutlass::gemm::device::Gemm<
688
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
689
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
690
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
691
+ cutlass::gemm::GemmShape<64, 64, 512>,
692
+ cutlass::gemm::GemmShape<32, 32, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
693
+ cutlass::epilogue::thread::LinearCombination<
694
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
695
+ ElementAccumulator, ElementCompute>,
696
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6, 128, 128,
697
+ false, cutlass::arch::OpXorPopc>;
698
+
699
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
700
+ }
701
+
702
+ #endif // defined(CUTLASS_ARCH_MMA_B1_XOR_SM80_ENABLED)
703
+
704
+ ////////////////////////////////////////////////////////////////////////////////
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32n_wmma_tensor_op_s32_sm75.cu ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_SUBBYTE_INTEGER_MATRIX_MULTIPLY_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+ /////////////////////////////////////////////////////////////////////////////////////////////////
53
+ ////// WMMA Instruction Shape = 8x8x128, DataType/Instruction = b1 ^ b1 + s32 => s32 /////////
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+
56
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_wmma_tensor_op_s32, 128x256x512_64x64x512_8x8x128) {
57
+
58
+ using ElementOutput = int32_t;
59
+ using ElementAccumulator = int32_t;
60
+
61
+ using Gemm = cutlass::gemm::device::Gemm<
62
+ cutlass::uint1b_t,
63
+ cutlass::layout::RowMajor,
64
+ cutlass::uint1b_t,
65
+ cutlass::layout::ColumnMajor,
66
+ ElementOutput,
67
+ cutlass::layout::ColumnMajor,
68
+ ElementAccumulator,
69
+ cutlass::arch::OpClassWmmaTensorOp,
70
+ cutlass::arch::Sm75,
71
+ cutlass::gemm::GemmShape<128, 256, 512>,
72
+ cutlass::gemm::GemmShape<64, 64, 512>,
73
+ cutlass::gemm::GemmShape<8, 8, 128>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ ElementOutput,
76
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
77
+ ElementAccumulator,
78
+ ElementAccumulator
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 2, 128, 128, false,
82
+ cutlass::arch::OpXorPopc
83
+ >;
84
+
85
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
86
+ }
87
+
88
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_wmma_tensor_op_s32, 256x128x512_64x64x512_8x8x128) {
89
+
90
+ using ElementOutput = int32_t;
91
+ using ElementAccumulator = int32_t;
92
+ using ElementCompute = int32_t;
93
+
94
+ using Gemm = cutlass::gemm::device::Gemm<
95
+ cutlass::uint1b_t,
96
+ cutlass::layout::RowMajor,
97
+ cutlass::uint1b_t,
98
+ cutlass::layout::ColumnMajor,
99
+ ElementOutput,
100
+ cutlass::layout::ColumnMajor,
101
+ ElementAccumulator,
102
+ cutlass::arch::OpClassWmmaTensorOp,
103
+ cutlass::arch::Sm75,
104
+ cutlass::gemm::GemmShape<256, 128, 512>,
105
+ cutlass::gemm::GemmShape<64, 64, 512>,
106
+ cutlass::gemm::GemmShape<8, 8, 128>,
107
+ cutlass::epilogue::thread::LinearCombination<
108
+ ElementOutput,
109
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
110
+ ElementAccumulator,
111
+ ElementCompute>,
112
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
113
+ 2, 128, 128, false,
114
+ cutlass::arch::OpXorPopc>;
115
+
116
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
117
+ }
118
+
119
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_wmma_tensor_op_s32, 128x128x512_64x64x512_8x8x128) {
120
+
121
+ using ElementOutput = int32_t;
122
+ using ElementAccumulator = int32_t;
123
+ using ElementCompute = int32_t;
124
+
125
+ using Gemm = cutlass::gemm::device::Gemm<
126
+ cutlass::uint1b_t,
127
+ cutlass::layout::RowMajor,
128
+ cutlass::uint1b_t,
129
+ cutlass::layout::ColumnMajor,
130
+ ElementOutput,
131
+ cutlass::layout::ColumnMajor,
132
+ ElementAccumulator,
133
+ cutlass::arch::OpClassWmmaTensorOp,
134
+ cutlass::arch::Sm75,
135
+ cutlass::gemm::GemmShape<128, 128, 512>,
136
+ cutlass::gemm::GemmShape<64, 64, 512>,
137
+ cutlass::gemm::GemmShape<8, 8, 128>,
138
+ cutlass::epilogue::thread::LinearCombination<
139
+ ElementOutput,
140
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
141
+ ElementAccumulator,
142
+ ElementCompute>,
143
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
144
+ 2, 128, 128, false,
145
+ cutlass::arch::OpXorPopc>;
146
+
147
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
148
+ }
149
+
150
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_wmma_tensor_op_s32, 64x128x512_32x64x512_8x8x128) {
151
+
152
+ using ElementOutput = int32_t;
153
+ using ElementAccumulator = int32_t;
154
+ using ElementCompute = int32_t;
155
+
156
+ using Gemm = cutlass::gemm::device::Gemm<
157
+ cutlass::uint1b_t,
158
+ cutlass::layout::RowMajor,
159
+ cutlass::uint1b_t,
160
+ cutlass::layout::ColumnMajor,
161
+ ElementOutput,
162
+ cutlass::layout::ColumnMajor,
163
+ ElementAccumulator,
164
+ cutlass::arch::OpClassWmmaTensorOp,
165
+ cutlass::arch::Sm75,
166
+ cutlass::gemm::GemmShape<64, 128, 512>,
167
+ cutlass::gemm::GemmShape<32, 64, 512>,
168
+ cutlass::gemm::GemmShape<8, 8, 128>,
169
+ cutlass::epilogue::thread::LinearCombination<
170
+ ElementOutput,
171
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
172
+ ElementAccumulator,
173
+ ElementCompute>,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
175
+ 2, 128, 128, false,
176
+ cutlass::arch::OpXorPopc>;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
179
+ }
180
+
181
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_wmma_tensor_op_s32, 128x64x512_64x32x512_8x8x128) {
182
+
183
+ using ElementOutput = int32_t;
184
+ using ElementAccumulator = int32_t;
185
+ using ElementCompute = int32_t;
186
+
187
+ using Gemm = cutlass::gemm::device::Gemm<
188
+ cutlass::uint1b_t,
189
+ cutlass::layout::RowMajor,
190
+ cutlass::uint1b_t,
191
+ cutlass::layout::ColumnMajor,
192
+ ElementOutput,
193
+ cutlass::layout::ColumnMajor,
194
+ ElementAccumulator,
195
+ cutlass::arch::OpClassWmmaTensorOp,
196
+ cutlass::arch::Sm75,
197
+ cutlass::gemm::GemmShape<128, 64, 512>,
198
+ cutlass::gemm::GemmShape<64, 32, 512>,
199
+ cutlass::gemm::GemmShape<8, 8, 128>,
200
+ cutlass::epilogue::thread::LinearCombination<
201
+ ElementOutput,
202
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
203
+ ElementAccumulator,
204
+ ElementCompute>,
205
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
206
+ 2, 128, 128, false,
207
+ cutlass::arch::OpXorPopc>;
208
+
209
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
210
+ }
211
+
212
+ TEST(SM75_Device_Gemm_b1t_b1n_s32n_wmma_tensor_op_s32, 64x64x512_32x32x512_8x8x128) {
213
+
214
+ using ElementOutput = int32_t;
215
+ using ElementAccumulator = int32_t;
216
+ using ElementCompute = int32_t;
217
+
218
+ using Gemm = cutlass::gemm::device::Gemm<
219
+ cutlass::uint1b_t,
220
+ cutlass::layout::RowMajor,
221
+ cutlass::uint1b_t,
222
+ cutlass::layout::ColumnMajor,
223
+ ElementOutput,
224
+ cutlass::layout::ColumnMajor,
225
+ ElementAccumulator,
226
+ cutlass::arch::OpClassWmmaTensorOp,
227
+ cutlass::arch::Sm75,
228
+ cutlass::gemm::GemmShape<64, 64, 512>,
229
+ cutlass::gemm::GemmShape<32, 32, 512>,
230
+ cutlass::gemm::GemmShape<8, 8, 128>,
231
+ cutlass::epilogue::thread::LinearCombination<
232
+ ElementOutput,
233
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
234
+ ElementAccumulator,
235
+ ElementCompute>,
236
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
237
+ 2, 128, 128, false,
238
+ cutlass::arch::OpXorPopc>;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
241
+ }
242
+
243
+ #endif //CUTLASS_SUBBYTE_INTEGER_MATRIX_MULTIPLY_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32t_tensor_op_s32_sm75.cu ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+ /////////////////////////////////////////////////////////////////////////////////////////////////
53
+
54
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 128x256x512_64x64x512) {
55
+
56
+ using ElementOutput = int32_t;
57
+ using ElementAccumulator = int32_t;
58
+ using ElementCompute = int32_t;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
62
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
63
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
64
+ cutlass::gemm::GemmShape<128, 256, 512>,
65
+ cutlass::gemm::GemmShape<64, 64, 512>,
66
+ cutlass::gemm::GemmShape<8, 8, 128>,
67
+ cutlass::epilogue::thread::LinearCombination<
68
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
69
+ ElementAccumulator, ElementCompute>,
70
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
71
+ false, cutlass::arch::OpXorPopc>;
72
+
73
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
74
+ }
75
+
76
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 256x128x512_64x64x512) {
77
+
78
+ using ElementOutput = int32_t;
79
+ using ElementAccumulator = int32_t;
80
+ using ElementCompute = int32_t;
81
+
82
+ using Gemm = cutlass::gemm::device::Gemm<
83
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
84
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
85
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
86
+ cutlass::gemm::GemmShape<256, 128, 512>,
87
+ cutlass::gemm::GemmShape<64, 64, 512>,
88
+ cutlass::gemm::GemmShape<8, 8, 128>,
89
+ cutlass::epilogue::thread::LinearCombination<
90
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
91
+ ElementAccumulator, ElementCompute>,
92
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
93
+ false, cutlass::arch::OpXorPopc>;
94
+
95
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
96
+ }
97
+
98
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 128x128x512_64x64x512) {
99
+
100
+ using ElementOutput = int32_t;
101
+ using ElementAccumulator = int32_t;
102
+ using ElementCompute = int32_t;
103
+
104
+ using Gemm = cutlass::gemm::device::Gemm<
105
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
106
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
107
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
108
+ cutlass::gemm::GemmShape<128, 128, 512>,
109
+ cutlass::gemm::GemmShape<64, 64, 512>,
110
+ cutlass::gemm::GemmShape<8, 8, 128>,
111
+ cutlass::epilogue::thread::LinearCombination<
112
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
113
+ ElementAccumulator, ElementCompute>,
114
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
115
+ false, cutlass::arch::OpXorPopc>;
116
+
117
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
118
+ }
119
+
120
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 64x256x512_64x64x512) {
121
+
122
+ using ElementOutput = int32_t;
123
+ using ElementAccumulator = int32_t;
124
+ using ElementCompute = int32_t;
125
+
126
+ using Gemm = cutlass::gemm::device::Gemm<
127
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
128
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
129
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
130
+ cutlass::gemm::GemmShape<64, 256, 512>,
131
+ cutlass::gemm::GemmShape<64, 64, 512>,
132
+ cutlass::gemm::GemmShape<8, 8, 128>,
133
+ cutlass::epilogue::thread::LinearCombination<
134
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
135
+ ElementAccumulator, ElementCompute>,
136
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
137
+ false, cutlass::arch::OpXorPopc>;
138
+
139
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
140
+ }
141
+
142
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 256x64x512_64x64x512) {
143
+
144
+ using ElementOutput = int32_t;
145
+ using ElementAccumulator = int32_t;
146
+ using ElementCompute = int32_t;
147
+
148
+ using Gemm = cutlass::gemm::device::Gemm<
149
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
150
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
151
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
152
+ cutlass::gemm::GemmShape<256, 64, 512>,
153
+ cutlass::gemm::GemmShape<64, 64, 512>,
154
+ cutlass::gemm::GemmShape<8, 8, 128>,
155
+ cutlass::epilogue::thread::LinearCombination<
156
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
157
+ ElementAccumulator, ElementCompute>,
158
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
159
+ false, cutlass::arch::OpXorPopc>;
160
+
161
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
162
+ }
163
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 64x128x512_32x64x512) {
164
+
165
+ using ElementOutput = int32_t;
166
+ using ElementAccumulator = int32_t;
167
+ using ElementCompute = int32_t;
168
+
169
+ using Gemm = cutlass::gemm::device::Gemm<
170
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
171
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
172
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
173
+ cutlass::gemm::GemmShape<64, 128, 512>,
174
+ cutlass::gemm::GemmShape<32, 64, 512>,
175
+ cutlass::gemm::GemmShape<8, 8, 128>,
176
+ cutlass::epilogue::thread::LinearCombination<
177
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
178
+ ElementAccumulator, ElementCompute>,
179
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
180
+ false, cutlass::arch::OpXorPopc>;
181
+
182
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
183
+ }
184
+
185
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 128x64x512_64x32x512) {
186
+
187
+ using ElementOutput = int32_t;
188
+ using ElementAccumulator = int32_t;
189
+ using ElementCompute = int32_t;
190
+
191
+ using Gemm = cutlass::gemm::device::Gemm<
192
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
193
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
194
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
195
+ cutlass::gemm::GemmShape<128, 64, 512>,
196
+ cutlass::gemm::GemmShape<64, 32, 512>,
197
+ cutlass::gemm::GemmShape<8, 8, 128>,
198
+ cutlass::epilogue::thread::LinearCombination<
199
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
200
+ ElementAccumulator, ElementCompute>,
201
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
202
+ false, cutlass::arch::OpXorPopc>;
203
+
204
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
205
+ }
206
+
207
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_tensor_op_s32, 64x64x512_32x32x512) {
208
+
209
+ using ElementOutput = int32_t;
210
+ using ElementAccumulator = int32_t;
211
+ using ElementCompute = int32_t;
212
+
213
+ using Gemm = cutlass::gemm::device::Gemm<
214
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
215
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
216
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm75,
217
+ cutlass::gemm::GemmShape<64, 64, 512>,
218
+ cutlass::gemm::GemmShape<32, 32, 512>,
219
+ cutlass::gemm::GemmShape<8, 8, 128>,
220
+ cutlass::epilogue::thread::LinearCombination<
221
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
222
+ ElementAccumulator, ElementCompute>,
223
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 2, 128, 128,
224
+ false, cutlass::arch::OpXorPopc>;
225
+
226
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
227
+ }
228
+
229
+ /////////////////////////////////////////////////////////////////////////////////////////////////
230
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32t_tensor_op_s32_sm80.cu ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+
34
+ */
35
+
36
+ #include <iostream>
37
+
38
+ #include "../../common/cutlass_unit_test.h"
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+ #include "cutlass/util/host_tensor.h"
42
+ #include "cutlass/util/reference/host/gemm.h"
43
+ #include "cutlass/util/reference/host/tensor_compare.h"
44
+ #include "cutlass/util/reference/host/tensor_copy.h"
45
+ #include "cutlass/util/reference/host/tensor_fill.h"
46
+ #include "cutlass/util/tensor_view_io.h"
47
+
48
+ #include "testbed.h"
49
+
50
+ ////////////////////////////////////////////////////////////////////////////////
51
+
52
+ #if defined(CUTLASS_ARCH_MMA_B1_XOR_SM80_ENABLED)
53
+
54
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 128x256x1024_64x64x1024, {
55
+ using ElementOutput = int32_t;
56
+ using ElementAccumulator = int32_t;
57
+ using ElementCompute = int32_t;
58
+
59
+ using Gemm = cutlass::gemm::device::Gemm<
60
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
61
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
62
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
63
+ cutlass::gemm::GemmShape<128, 256, 1024>,
64
+ cutlass::gemm::GemmShape<64, 64, 1024>,
65
+ cutlass::gemm::GemmShape<16, 8, 256>,
66
+ cutlass::epilogue::thread::LinearCombination<
67
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
68
+ ElementAccumulator, ElementCompute>,
69
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
70
+ false, cutlass::arch::OpXorPopc>;
71
+
72
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
73
+ } )
74
+
75
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 256x128x1024_64x64x1024, {
76
+ using ElementOutput = int32_t;
77
+ using ElementAccumulator = int32_t;
78
+ using ElementCompute = int32_t;
79
+
80
+ using Gemm = cutlass::gemm::device::Gemm<
81
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
82
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
83
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
84
+ cutlass::gemm::GemmShape<256, 128, 1024>,
85
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
86
+ cutlass::epilogue::thread::LinearCombination<
87
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
88
+ ElementAccumulator, ElementCompute>,
89
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
90
+ false, cutlass::arch::OpXorPopc>;
91
+
92
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
93
+ } )
94
+
95
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 128x128x1024_64x64x1024, {
96
+ using ElementOutput = int32_t;
97
+ using ElementAccumulator = int32_t;
98
+ using ElementCompute = int32_t;
99
+
100
+ using Gemm = cutlass::gemm::device::Gemm<
101
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
102
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
103
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
104
+ cutlass::gemm::GemmShape<128, 128, 1024>,
105
+ cutlass::gemm::GemmShape<64, 64, 1024>,
106
+ cutlass::gemm::GemmShape<16, 8, 256>,
107
+ cutlass::epilogue::thread::LinearCombination<
108
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
109
+ ElementAccumulator, ElementCompute>,
110
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
111
+ false, cutlass::arch::OpXorPopc>;
112
+
113
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
114
+ } )
115
+
116
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 256x64x1024_64x64x1024, {
117
+ using ElementOutput = int32_t;
118
+ using ElementAccumulator = int32_t;
119
+ using ElementCompute = int32_t;
120
+
121
+ using Gemm = cutlass::gemm::device::Gemm<
122
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
123
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
124
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
125
+ cutlass::gemm::GemmShape<256, 64, 1024>,
126
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
127
+ cutlass::epilogue::thread::LinearCombination<
128
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
129
+ ElementAccumulator, ElementCompute>,
130
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
131
+ false, cutlass::arch::OpXorPopc>;
132
+
133
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
134
+ } )
135
+
136
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 64x256x1024_64x64x1024, {
137
+ using ElementOutput = int32_t;
138
+ using ElementAccumulator = int32_t;
139
+ using ElementCompute = int32_t;
140
+
141
+ using Gemm = cutlass::gemm::device::Gemm<
142
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
143
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
144
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
145
+ cutlass::gemm::GemmShape<64, 256, 1024>,
146
+ cutlass::gemm::GemmShape<64, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
147
+ cutlass::epilogue::thread::LinearCombination<
148
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
149
+ ElementAccumulator, ElementCompute>,
150
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
151
+ false, cutlass::arch::OpXorPopc>;
152
+
153
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
154
+ } )
155
+
156
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 64x128x1024_32x64x1024, {
157
+ using ElementOutput = int32_t;
158
+ using ElementAccumulator = int32_t;
159
+ using ElementCompute = int32_t;
160
+
161
+ using Gemm = cutlass::gemm::device::Gemm<
162
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
163
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
164
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
165
+ cutlass::gemm::GemmShape<64, 128, 1024>,
166
+ cutlass::gemm::GemmShape<32, 64, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
167
+ cutlass::epilogue::thread::LinearCombination<
168
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
169
+ ElementAccumulator, ElementCompute>,
170
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
171
+ false, cutlass::arch::OpXorPopc>;
172
+
173
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
174
+ } )
175
+
176
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 128x64x1024_64x32x1024, {
177
+ using ElementOutput = int32_t;
178
+ using ElementAccumulator = int32_t;
179
+ using ElementCompute = int32_t;
180
+
181
+ using Gemm = cutlass::gemm::device::Gemm<
182
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
183
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
184
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
185
+ cutlass::gemm::GemmShape<128, 64, 1024>,
186
+ cutlass::gemm::GemmShape<64, 32, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
187
+ cutlass::epilogue::thread::LinearCombination<
188
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
189
+ ElementAccumulator, ElementCompute>,
190
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
191
+ false, cutlass::arch::OpXorPopc>;
192
+
193
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
194
+ } )
195
+
196
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 64x64x1024_32x32x1024, {
197
+ using ElementOutput = int32_t;
198
+ using ElementAccumulator = int32_t;
199
+ using ElementCompute = int32_t;
200
+
201
+ using Gemm = cutlass::gemm::device::Gemm<
202
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
203
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
204
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
205
+ cutlass::gemm::GemmShape<64, 64, 1024>,
206
+ cutlass::gemm::GemmShape<32, 32, 1024>, cutlass::gemm::GemmShape<16, 8, 256>,
207
+ cutlass::epilogue::thread::LinearCombination<
208
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
209
+ ElementAccumulator, ElementCompute>,
210
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
211
+ false, cutlass::arch::OpXorPopc>;
212
+
213
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
214
+ } )
215
+
216
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 128x256x512_64x64x512, {
217
+ using ElementOutput = int32_t;
218
+ using ElementAccumulator = int32_t;
219
+ using ElementCompute = int32_t;
220
+
221
+ using Gemm = cutlass::gemm::device::Gemm<
222
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
223
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
224
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
225
+ cutlass::gemm::GemmShape<128, 256, 512>,
226
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
227
+ cutlass::epilogue::thread::LinearCombination<
228
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
229
+ ElementAccumulator, ElementCompute>,
230
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
231
+ false, cutlass::arch::OpXorPopc>;
232
+
233
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
234
+ } )
235
+
236
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 256x128x512_64x64x512, {
237
+ using ElementOutput = int32_t;
238
+ using ElementAccumulator = int32_t;
239
+ using ElementCompute = int32_t;
240
+
241
+ using Gemm = cutlass::gemm::device::Gemm<
242
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
243
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
244
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
245
+ cutlass::gemm::GemmShape<256, 128, 512>,
246
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
247
+ cutlass::epilogue::thread::LinearCombination<
248
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
249
+ ElementAccumulator, ElementCompute>,
250
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
251
+ false, cutlass::arch::OpXorPopc>;
252
+
253
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
254
+ } )
255
+
256
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 128x128x512_64x64x512, {
257
+ using ElementOutput = int32_t;
258
+ using ElementAccumulator = int32_t;
259
+ using ElementCompute = int32_t;
260
+
261
+ using Gemm = cutlass::gemm::device::Gemm<
262
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
263
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
264
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
265
+ cutlass::gemm::GemmShape<128, 128, 512>,
266
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
267
+ cutlass::epilogue::thread::LinearCombination<
268
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
269
+ ElementAccumulator, ElementCompute>,
270
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
271
+ false, cutlass::arch::OpXorPopc>;
272
+
273
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
274
+ } )
275
+
276
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 256x64x512_64x64x512, {
277
+ using ElementOutput = int32_t;
278
+ using ElementAccumulator = int32_t;
279
+ using ElementCompute = int32_t;
280
+
281
+ using Gemm = cutlass::gemm::device::Gemm<
282
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
283
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
284
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
285
+ cutlass::gemm::GemmShape<256, 64, 512>,
286
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
287
+ cutlass::epilogue::thread::LinearCombination<
288
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
289
+ ElementAccumulator, ElementCompute>,
290
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
291
+ false, cutlass::arch::OpXorPopc>;
292
+
293
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
294
+ } )
295
+
296
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 64x256x512_64x64x512, {
297
+ using ElementOutput = int32_t;
298
+ using ElementAccumulator = int32_t;
299
+ using ElementCompute = int32_t;
300
+
301
+ using Gemm = cutlass::gemm::device::Gemm<
302
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
303
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
304
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
305
+ cutlass::gemm::GemmShape<64, 256, 512>,
306
+ cutlass::gemm::GemmShape<64, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
307
+ cutlass::epilogue::thread::LinearCombination<
308
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
309
+ ElementAccumulator, ElementCompute>,
310
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3, 128, 128,
311
+ false, cutlass::arch::OpXorPopc>;
312
+
313
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
314
+ } )
315
+
316
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 64x128x512_32x64x512, {
317
+ using ElementOutput = int32_t;
318
+ using ElementAccumulator = int32_t;
319
+ using ElementCompute = int32_t;
320
+
321
+ using Gemm = cutlass::gemm::device::Gemm<
322
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
323
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
324
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
325
+ cutlass::gemm::GemmShape<64, 128, 512>,
326
+ cutlass::gemm::GemmShape<32, 64, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
327
+ cutlass::epilogue::thread::LinearCombination<
328
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
329
+ ElementAccumulator, ElementCompute>,
330
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
331
+ false, cutlass::arch::OpXorPopc>;
332
+
333
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
334
+ } )
335
+
336
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 128x64x512_64x32x512, {
337
+ using ElementOutput = int32_t;
338
+ using ElementAccumulator = int32_t;
339
+ using ElementCompute = int32_t;
340
+
341
+ using Gemm = cutlass::gemm::device::Gemm<
342
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
343
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
344
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
345
+ cutlass::gemm::GemmShape<128, 64, 512>,
346
+ cutlass::gemm::GemmShape<64, 32, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
347
+ cutlass::epilogue::thread::LinearCombination<
348
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
349
+ ElementAccumulator, ElementCompute>,
350
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4, 128, 128,
351
+ false, cutlass::arch::OpXorPopc>;
352
+
353
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
354
+ } )
355
+
356
+ CUTLASS_TEST_L1(SM80_Device_Gemm_XOR_b1t_b1n_s32t_tensor_op_s32, 64x64x512_32x32x512, {
357
+ using ElementOutput = int32_t;
358
+ using ElementAccumulator = int32_t;
359
+ using ElementCompute = int32_t;
360
+
361
+ using Gemm = cutlass::gemm::device::Gemm<
362
+ cutlass::uint1b_t, cutlass::layout::RowMajor, cutlass::uint1b_t,
363
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
364
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
365
+ cutlass::gemm::GemmShape<64, 64, 512>,
366
+ cutlass::gemm::GemmShape<32, 32, 512>, cutlass::gemm::GemmShape<16, 8, 256>,
367
+ cutlass::epilogue::thread::LinearCombination<
368
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
369
+ ElementAccumulator, ElementCompute>,
370
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6, 128, 128,
371
+ false, cutlass::arch::OpXorPopc>;
372
+
373
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
374
+ } )
375
+
376
+ ////////////////////////////////////////////////////////////////////////////////
377
+
378
+ #endif // #if defined(CUTLASS_ARCH_MMA_B1_XOR_SM80_ENABLED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_b1t_b1n_s32t_wmma_tensor_op_s32_sm75.cu ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_SUBBYTE_INTEGER_MATRIX_MULTIPLY_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+ /////////////////////////////////////////////////////////////////////////////////////////////////
53
+ ////// WMMA Instruction Shape = 8x8x128, DataType/Instruction = b1 ^ b1 + s32 => s32 /////////
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+
56
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_wmma_tensor_op_s32, 128x256x512_64x64x512_8x8x128) {
57
+
58
+ using ElementOutput = int32_t;
59
+ using ElementAccumulator = int32_t;
60
+
61
+ using Gemm = cutlass::gemm::device::Gemm<
62
+ cutlass::uint1b_t,
63
+ cutlass::layout::RowMajor,
64
+ cutlass::uint1b_t,
65
+ cutlass::layout::ColumnMajor,
66
+ ElementOutput,
67
+ cutlass::layout::RowMajor,
68
+ ElementAccumulator,
69
+ cutlass::arch::OpClassWmmaTensorOp,
70
+ cutlass::arch::Sm75,
71
+ cutlass::gemm::GemmShape<128, 256, 512>,
72
+ cutlass::gemm::GemmShape<64, 64, 512>,
73
+ cutlass::gemm::GemmShape<8, 8, 128>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ ElementOutput,
76
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
77
+ ElementAccumulator,
78
+ ElementAccumulator
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 2, 128, 128, false,
82
+ cutlass::arch::OpXorPopc
83
+ >;
84
+
85
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
86
+ }
87
+
88
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_wmma_tensor_op_s32, 256x128x512_64x64x512_8x8x128) {
89
+
90
+ using ElementOutput = int32_t;
91
+ using ElementAccumulator = int32_t;
92
+ using ElementCompute = int32_t;
93
+
94
+ using Gemm = cutlass::gemm::device::Gemm<
95
+ cutlass::uint1b_t,
96
+ cutlass::layout::RowMajor,
97
+ cutlass::uint1b_t,
98
+ cutlass::layout::ColumnMajor,
99
+ ElementOutput,
100
+ cutlass::layout::RowMajor,
101
+ ElementAccumulator,
102
+ cutlass::arch::OpClassWmmaTensorOp,
103
+ cutlass::arch::Sm75,
104
+ cutlass::gemm::GemmShape<256, 128, 512>,
105
+ cutlass::gemm::GemmShape<64, 64, 512>,
106
+ cutlass::gemm::GemmShape<8, 8, 128>,
107
+ cutlass::epilogue::thread::LinearCombination<
108
+ ElementOutput,
109
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
110
+ ElementAccumulator,
111
+ ElementCompute>,
112
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
113
+ 2, 128, 128, false,
114
+ cutlass::arch::OpXorPopc>;
115
+
116
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
117
+ }
118
+
119
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_wmma_tensor_op_s32, 128x128x512_64x64x512_8x8x128) {
120
+
121
+ using ElementOutput = int32_t;
122
+ using ElementAccumulator = int32_t;
123
+ using ElementCompute = int32_t;
124
+
125
+ using Gemm = cutlass::gemm::device::Gemm<
126
+ cutlass::uint1b_t,
127
+ cutlass::layout::RowMajor,
128
+ cutlass::uint1b_t,
129
+ cutlass::layout::ColumnMajor,
130
+ ElementOutput,
131
+ cutlass::layout::RowMajor,
132
+ ElementAccumulator,
133
+ cutlass::arch::OpClassWmmaTensorOp,
134
+ cutlass::arch::Sm75,
135
+ cutlass::gemm::GemmShape<128, 128, 512>,
136
+ cutlass::gemm::GemmShape<64, 64, 512>,
137
+ cutlass::gemm::GemmShape<8, 8, 128>,
138
+ cutlass::epilogue::thread::LinearCombination<
139
+ ElementOutput,
140
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
141
+ ElementAccumulator,
142
+ ElementCompute>,
143
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
144
+ 2, 128, 128, false,
145
+ cutlass::arch::OpXorPopc>;
146
+
147
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
148
+ }
149
+
150
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_wmma_tensor_op_s32, 64x128x512_32x64x512_8x8x128) {
151
+
152
+ using ElementOutput = int32_t;
153
+ using ElementAccumulator = int32_t;
154
+ using ElementCompute = int32_t;
155
+
156
+ using Gemm = cutlass::gemm::device::Gemm<
157
+ cutlass::uint1b_t,
158
+ cutlass::layout::RowMajor,
159
+ cutlass::uint1b_t,
160
+ cutlass::layout::ColumnMajor,
161
+ ElementOutput,
162
+ cutlass::layout::RowMajor,
163
+ ElementAccumulator,
164
+ cutlass::arch::OpClassWmmaTensorOp,
165
+ cutlass::arch::Sm75,
166
+ cutlass::gemm::GemmShape<64, 128, 512>,
167
+ cutlass::gemm::GemmShape<32, 64, 512>,
168
+ cutlass::gemm::GemmShape<8, 8, 128>,
169
+ cutlass::epilogue::thread::LinearCombination<
170
+ ElementOutput,
171
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
172
+ ElementAccumulator,
173
+ ElementCompute>,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
175
+ 2, 128, 128, false,
176
+ cutlass::arch::OpXorPopc>;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
179
+ }
180
+
181
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_wmma_tensor_op_s32, 128x64x512_64x32x512_8x8x128) {
182
+
183
+ using ElementOutput = int32_t;
184
+ using ElementAccumulator = int32_t;
185
+ using ElementCompute = int32_t;
186
+
187
+ using Gemm = cutlass::gemm::device::Gemm<
188
+ cutlass::uint1b_t,
189
+ cutlass::layout::RowMajor,
190
+ cutlass::uint1b_t,
191
+ cutlass::layout::ColumnMajor,
192
+ ElementOutput,
193
+ cutlass::layout::RowMajor,
194
+ ElementAccumulator,
195
+ cutlass::arch::OpClassWmmaTensorOp,
196
+ cutlass::arch::Sm75,
197
+ cutlass::gemm::GemmShape<128, 64, 512>,
198
+ cutlass::gemm::GemmShape<64, 32, 512>,
199
+ cutlass::gemm::GemmShape<8, 8, 128>,
200
+ cutlass::epilogue::thread::LinearCombination<
201
+ ElementOutput,
202
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
203
+ ElementAccumulator,
204
+ ElementCompute>,
205
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
206
+ 2, 128, 128, false,
207
+ cutlass::arch::OpXorPopc>;
208
+
209
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
210
+ }
211
+
212
+ TEST(SM75_Device_Gemm_b1t_b1n_s32t_wmma_tensor_op_s32, 64x64x512_32x32x512_8x8x128) {
213
+
214
+ using ElementOutput = int32_t;
215
+ using ElementAccumulator = int32_t;
216
+ using ElementCompute = int32_t;
217
+
218
+ using Gemm = cutlass::gemm::device::Gemm<
219
+ cutlass::uint1b_t,
220
+ cutlass::layout::RowMajor,
221
+ cutlass::uint1b_t,
222
+ cutlass::layout::ColumnMajor,
223
+ ElementOutput,
224
+ cutlass::layout::RowMajor,
225
+ ElementAccumulator,
226
+ cutlass::arch::OpClassWmmaTensorOp,
227
+ cutlass::arch::Sm75,
228
+ cutlass::gemm::GemmShape<64, 64, 512>,
229
+ cutlass::gemm::GemmShape<32, 32, 512>,
230
+ cutlass::gemm::GemmShape<8, 8, 128>,
231
+ cutlass::epilogue::thread::LinearCombination<
232
+ ElementOutput,
233
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
234
+ ElementAccumulator,
235
+ ElementCompute>,
236
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
237
+ 2, 128, 128, false,
238
+ cutlass::arch::OpXorPopc>;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
241
+ }
242
+ #endif //CUTLASS_SUBBYTE_INTEGER_MATRIX_MULTIPLY_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_bf16n_bf16n_f32t_tensor_op_f32_sm80.cu ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+
49
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 128x256x64_64x64x64) {
54
+ using ElementOutput = float;
55
+ using ElementAccumulator = float;
56
+
57
+ using Gemm = cutlass::gemm::device::Gemm<
58
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
59
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
60
+ cutlass::layout::RowMajor, ElementAccumulator,
61
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
62
+ cutlass::gemm::GemmShape<128, 256, 64>,
63
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
64
+ cutlass::epilogue::thread::LinearCombination<
65
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
66
+ ElementAccumulator, ElementAccumulator>,
67
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
68
+
69
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
70
+ }
71
+
72
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 256x128x64_64x64x64) {
73
+ using ElementOutput = float;
74
+ using ElementAccumulator = float;
75
+
76
+ using Gemm = cutlass::gemm::device::Gemm<
77
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
78
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
79
+ cutlass::layout::RowMajor, ElementAccumulator,
80
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
81
+ cutlass::gemm::GemmShape<256, 128, 64>,
82
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
83
+ cutlass::epilogue::thread::LinearCombination<
84
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
85
+ ElementAccumulator, ElementAccumulator>,
86
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
87
+
88
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
89
+ }
90
+
91
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 128x128x64_64x64x64) {
92
+ using ElementOutput = float;
93
+ using ElementAccumulator = float;
94
+
95
+ using Gemm = cutlass::gemm::device::Gemm<
96
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
97
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
98
+ cutlass::layout::RowMajor, ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
100
+ cutlass::gemm::GemmShape<128, 128, 64>,
101
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
102
+ cutlass::epilogue::thread::LinearCombination<
103
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
104
+ ElementAccumulator, ElementAccumulator>,
105
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
106
+
107
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
108
+ }
109
+
110
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 256x64x64_64x64x64) {
111
+ using ElementOutput = float;
112
+ using ElementAccumulator = float;
113
+
114
+ using Gemm = cutlass::gemm::device::Gemm<
115
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
116
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
117
+ cutlass::layout::RowMajor, ElementAccumulator,
118
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
119
+ cutlass::gemm::GemmShape<256, 64, 64>,
120
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
121
+ cutlass::epilogue::thread::LinearCombination<
122
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
123
+ ElementAccumulator, ElementAccumulator>,
124
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
125
+
126
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
127
+ }
128
+
129
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 64x256x64_64x64x64) {
130
+ using ElementOutput = float;
131
+ using ElementAccumulator = float;
132
+
133
+ using Gemm = cutlass::gemm::device::Gemm<
134
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
135
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
136
+ cutlass::layout::RowMajor, ElementAccumulator,
137
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
138
+ cutlass::gemm::GemmShape<64, 256, 64>,
139
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
140
+ cutlass::epilogue::thread::LinearCombination<
141
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
142
+ ElementAccumulator, ElementAccumulator>,
143
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
144
+
145
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
146
+ }
147
+
148
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 64x128x64_32x64x64) {
149
+ using ElementOutput = float;
150
+ using ElementAccumulator = float;
151
+
152
+ using Gemm = cutlass::gemm::device::Gemm<
153
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
154
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
155
+ cutlass::layout::RowMajor, ElementAccumulator,
156
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
157
+ cutlass::gemm::GemmShape<64, 128, 64>,
158
+ cutlass::gemm::GemmShape<32, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
159
+ cutlass::epilogue::thread::LinearCombination<
160
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
161
+ ElementAccumulator, ElementAccumulator>,
162
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
163
+
164
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
165
+ }
166
+
167
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 128x64x64_64x32x64) {
168
+ using ElementOutput = float;
169
+ using ElementAccumulator = float;
170
+
171
+ using Gemm = cutlass::gemm::device::Gemm<
172
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
173
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
174
+ cutlass::layout::RowMajor, ElementAccumulator,
175
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
176
+ cutlass::gemm::GemmShape<128, 64, 64>,
177
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
178
+ cutlass::epilogue::thread::LinearCombination<
179
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
180
+ ElementAccumulator, ElementAccumulator>,
181
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
182
+
183
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
184
+ }
185
+
186
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 64x64x64_32x32x64) {
187
+ using ElementOutput = float;
188
+ using ElementAccumulator = float;
189
+
190
+ using Gemm = cutlass::gemm::device::Gemm<
191
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
192
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
193
+ cutlass::layout::RowMajor, ElementAccumulator,
194
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
195
+ cutlass::gemm::GemmShape<64, 64, 64>,
196
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
197
+ cutlass::epilogue::thread::LinearCombination<
198
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
199
+ ElementAccumulator, ElementAccumulator>,
200
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
201
+
202
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
203
+ }
204
+
205
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 128x256x32_64x64x32) {
206
+ using ElementOutput = float;
207
+ using ElementAccumulator = float;
208
+
209
+ using Gemm = cutlass::gemm::device::Gemm<
210
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
211
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
212
+ cutlass::layout::RowMajor, ElementAccumulator,
213
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
214
+ cutlass::gemm::GemmShape<128, 256, 32>,
215
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
216
+ cutlass::epilogue::thread::LinearCombination<
217
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
218
+ ElementAccumulator, ElementAccumulator>,
219
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
220
+
221
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
222
+ }
223
+
224
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 256x128x32_64x64x32) {
225
+ using ElementOutput = float;
226
+ using ElementAccumulator = float;
227
+
228
+ using Gemm = cutlass::gemm::device::Gemm<
229
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
230
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
231
+ cutlass::layout::RowMajor, ElementAccumulator,
232
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
233
+ cutlass::gemm::GemmShape<256, 128, 32>,
234
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
235
+ cutlass::epilogue::thread::LinearCombination<
236
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
237
+ ElementAccumulator, ElementAccumulator>,
238
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
241
+ }
242
+
243
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 128x128x32_64x64x32) {
244
+ using ElementOutput = float;
245
+ using ElementAccumulator = float;
246
+
247
+ using Gemm = cutlass::gemm::device::Gemm<
248
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
249
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
250
+ cutlass::layout::RowMajor, ElementAccumulator,
251
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
252
+ cutlass::gemm::GemmShape<128, 128, 32>,
253
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
254
+ cutlass::epilogue::thread::LinearCombination<
255
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
256
+ ElementAccumulator, ElementAccumulator>,
257
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
258
+
259
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
260
+ }
261
+
262
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 256x64x32_64x64x32) {
263
+ using ElementOutput = float;
264
+ using ElementAccumulator = float;
265
+
266
+ using Gemm = cutlass::gemm::device::Gemm<
267
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
268
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
269
+ cutlass::layout::RowMajor, ElementAccumulator,
270
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
271
+ cutlass::gemm::GemmShape<256, 64, 32>,
272
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
273
+ cutlass::epilogue::thread::LinearCombination<
274
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
275
+ ElementAccumulator, ElementAccumulator>,
276
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
277
+
278
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
279
+ }
280
+
281
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 64x256x32_64x64x32) {
282
+ using ElementOutput = float;
283
+ using ElementAccumulator = float;
284
+
285
+ using Gemm = cutlass::gemm::device::Gemm<
286
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
287
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
288
+ cutlass::layout::RowMajor, ElementAccumulator,
289
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
290
+ cutlass::gemm::GemmShape<64, 256, 32>,
291
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
292
+ cutlass::epilogue::thread::LinearCombination<
293
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
294
+ ElementAccumulator, ElementAccumulator>,
295
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
296
+
297
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
298
+ }
299
+
300
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 64x128x32_32x64x32) {
301
+ using ElementOutput = float;
302
+ using ElementAccumulator = float;
303
+
304
+ using Gemm = cutlass::gemm::device::Gemm<
305
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
306
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
307
+ cutlass::layout::RowMajor, ElementAccumulator,
308
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
309
+ cutlass::gemm::GemmShape<64, 128, 32>,
310
+ cutlass::gemm::GemmShape<32, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
311
+ cutlass::epilogue::thread::LinearCombination<
312
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
313
+ ElementAccumulator, ElementAccumulator>,
314
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
315
+
316
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
317
+ }
318
+
319
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 128x64x32_64x32x32) {
320
+ using ElementOutput = float;
321
+ using ElementAccumulator = float;
322
+
323
+ using Gemm = cutlass::gemm::device::Gemm<
324
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
325
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
326
+ cutlass::layout::RowMajor, ElementAccumulator,
327
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
328
+ cutlass::gemm::GemmShape<128, 64, 32>,
329
+ cutlass::gemm::GemmShape<64, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
330
+ cutlass::epilogue::thread::LinearCombination<
331
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
332
+ ElementAccumulator, ElementAccumulator>,
333
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
334
+
335
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
336
+ }
337
+
338
+ TEST(SM80_Device_Gemm_bf16n_bf16n_f32t_tensor_op_f32, 64x64x32_32x32x32) {
339
+ using ElementOutput = float;
340
+ using ElementAccumulator = float;
341
+
342
+ using Gemm = cutlass::gemm::device::Gemm<
343
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor,
344
+ cutlass::bfloat16_t, cutlass::layout::ColumnMajor, ElementOutput,
345
+ cutlass::layout::RowMajor, ElementAccumulator,
346
+ cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
347
+ cutlass::gemm::GemmShape<64, 64, 32>,
348
+ cutlass::gemm::GemmShape<32, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
349
+ cutlass::epilogue::thread::LinearCombination<
350
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
351
+ ElementAccumulator, ElementAccumulator>,
352
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
353
+
354
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
355
+ }
356
+
357
+ ////////////////////////////////////////////////////////////////////////////////
358
+
359
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_bf16t_bf16t_bf16t_tensor_op_f32_sm80.cu ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+
49
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 128x256x64_64x64x64) {
54
+ using ElementOutput = cutlass::bfloat16_t;
55
+ using ElementAccumulator = float;
56
+
57
+ using Gemm = cutlass::gemm::device::Gemm<
58
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
59
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
63
+ cutlass::epilogue::thread::LinearCombination<
64
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
65
+ ElementAccumulator, ElementAccumulator>,
66
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
67
+
68
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
69
+ }
70
+
71
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 256x128x64_64x64x64) {
72
+ using ElementOutput = cutlass::bfloat16_t;
73
+ using ElementAccumulator = float;
74
+
75
+ using Gemm = cutlass::gemm::device::Gemm<
76
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
77
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
78
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
79
+ cutlass::gemm::GemmShape<256, 128, 64>,
80
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
81
+ cutlass::epilogue::thread::LinearCombination<
82
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
83
+ ElementAccumulator, ElementAccumulator>,
84
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
87
+ }
88
+
89
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 128x128x64_64x64x64) {
90
+ using ElementOutput = cutlass::bfloat16_t;
91
+ using ElementAccumulator = float;
92
+
93
+ using Gemm = cutlass::gemm::device::Gemm<
94
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
95
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
96
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
97
+ cutlass::gemm::GemmShape<128, 128, 64>,
98
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
99
+ cutlass::epilogue::thread::LinearCombination<
100
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
101
+ ElementAccumulator, ElementAccumulator>,
102
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
105
+ }
106
+
107
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 256x64x64_64x64x64) {
108
+ using ElementOutput = cutlass::bfloat16_t;
109
+ using ElementAccumulator = float;
110
+
111
+ using Gemm = cutlass::gemm::device::Gemm<
112
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
113
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
114
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
115
+ cutlass::gemm::GemmShape<256, 64, 64>,
116
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
117
+ cutlass::epilogue::thread::LinearCombination<
118
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
119
+ ElementAccumulator, ElementAccumulator>,
120
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
121
+
122
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
123
+ }
124
+
125
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 64x256x64_64x64x64) {
126
+ using ElementOutput = cutlass::bfloat16_t;
127
+ using ElementAccumulator = float;
128
+
129
+ using Gemm = cutlass::gemm::device::Gemm<
130
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
131
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
132
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
133
+ cutlass::gemm::GemmShape<64, 256, 64>,
134
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
137
+ ElementAccumulator, ElementAccumulator>,
138
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
139
+
140
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
141
+ }
142
+
143
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 64x128x64_32x64x64) {
144
+ using ElementOutput = cutlass::bfloat16_t;
145
+ using ElementAccumulator = float;
146
+
147
+ using Gemm = cutlass::gemm::device::Gemm<
148
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
149
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
150
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
151
+ cutlass::gemm::GemmShape<64, 128, 64>,
152
+ cutlass::gemm::GemmShape<32, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
153
+ cutlass::epilogue::thread::LinearCombination<
154
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
155
+ ElementAccumulator, ElementAccumulator>,
156
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
157
+
158
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
159
+ }
160
+
161
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 128x64x64_64x32x64) {
162
+ using ElementOutput = cutlass::bfloat16_t;
163
+ using ElementAccumulator = float;
164
+
165
+ using Gemm = cutlass::gemm::device::Gemm<
166
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
167
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
168
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
169
+ cutlass::gemm::GemmShape<128, 64, 64>,
170
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
171
+ cutlass::epilogue::thread::LinearCombination<
172
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
173
+ ElementAccumulator, ElementAccumulator>,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
175
+
176
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
177
+ }
178
+
179
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 64x64x64_32x32x64) {
180
+ using ElementOutput = cutlass::bfloat16_t;
181
+ using ElementAccumulator = float;
182
+
183
+ using Gemm = cutlass::gemm::device::Gemm<
184
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
185
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
186
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
187
+ cutlass::gemm::GemmShape<64, 64, 64>,
188
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
189
+ cutlass::epilogue::thread::LinearCombination<
190
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
191
+ ElementAccumulator, ElementAccumulator>,
192
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
193
+
194
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
195
+ }
196
+
197
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 128x256x32_64x64x32) {
198
+ using ElementOutput = cutlass::bfloat16_t;
199
+ using ElementAccumulator = float;
200
+
201
+ using Gemm = cutlass::gemm::device::Gemm<
202
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
203
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
204
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
205
+ cutlass::gemm::GemmShape<128, 256, 32>,
206
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
207
+ cutlass::epilogue::thread::LinearCombination<
208
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
209
+ ElementAccumulator, ElementAccumulator>,
210
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
211
+
212
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
213
+ }
214
+
215
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 256x128x32_64x64x32) {
216
+ using ElementOutput = cutlass::bfloat16_t;
217
+ using ElementAccumulator = float;
218
+
219
+ using Gemm = cutlass::gemm::device::Gemm<
220
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
221
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
222
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
223
+ cutlass::gemm::GemmShape<256, 128, 32>,
224
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
225
+ cutlass::epilogue::thread::LinearCombination<
226
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
227
+ ElementAccumulator, ElementAccumulator>,
228
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
229
+
230
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
231
+ }
232
+
233
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 128x128x32_64x64x32) {
234
+ using ElementOutput = cutlass::bfloat16_t;
235
+ using ElementAccumulator = float;
236
+
237
+ using Gemm = cutlass::gemm::device::Gemm<
238
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
239
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
240
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
241
+ cutlass::gemm::GemmShape<128, 128, 32>,
242
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
243
+ cutlass::epilogue::thread::LinearCombination<
244
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
245
+ ElementAccumulator, ElementAccumulator>,
246
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
247
+
248
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
249
+ }
250
+
251
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 256x64x32_64x64x32) {
252
+ using ElementOutput = cutlass::bfloat16_t;
253
+ using ElementAccumulator = float;
254
+
255
+ using Gemm = cutlass::gemm::device::Gemm<
256
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
257
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
258
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
259
+ cutlass::gemm::GemmShape<256, 64, 32>,
260
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
263
+ ElementAccumulator, ElementAccumulator>,
264
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
265
+
266
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
267
+ }
268
+
269
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 64x256x32_64x64x32) {
270
+ using ElementOutput = cutlass::bfloat16_t;
271
+ using ElementAccumulator = float;
272
+
273
+ using Gemm = cutlass::gemm::device::Gemm<
274
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
275
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
276
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
277
+ cutlass::gemm::GemmShape<64, 256, 32>,
278
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
279
+ cutlass::epilogue::thread::LinearCombination<
280
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
281
+ ElementAccumulator, ElementAccumulator>,
282
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
283
+
284
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
285
+ }
286
+
287
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 64x128x32_32x64x32) {
288
+ using ElementOutput = cutlass::bfloat16_t;
289
+ using ElementAccumulator = float;
290
+
291
+ using Gemm = cutlass::gemm::device::Gemm<
292
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
293
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
294
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
295
+ cutlass::gemm::GemmShape<64, 128, 32>,
296
+ cutlass::gemm::GemmShape<32, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
297
+ cutlass::epilogue::thread::LinearCombination<
298
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
299
+ ElementAccumulator, ElementAccumulator>,
300
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
301
+
302
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
303
+ }
304
+
305
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 128x64x32_64x32x32) {
306
+ using ElementOutput = cutlass::bfloat16_t;
307
+ using ElementAccumulator = float;
308
+
309
+ using Gemm = cutlass::gemm::device::Gemm<
310
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
311
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
312
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
313
+ cutlass::gemm::GemmShape<128, 64, 32>,
314
+ cutlass::gemm::GemmShape<64, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
315
+ cutlass::epilogue::thread::LinearCombination<
316
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
317
+ ElementAccumulator, ElementAccumulator>,
318
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
319
+
320
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
321
+ }
322
+
323
+ TEST(SM80_Device_Gemm_bf16t_bf16t_bf16t_tensor_op_f32, 64x64x32_32x32x32) {
324
+ using ElementOutput = cutlass::bfloat16_t;
325
+ using ElementAccumulator = float;
326
+
327
+ using Gemm = cutlass::gemm::device::Gemm<
328
+ cutlass::bfloat16_t, cutlass::layout::RowMajor, cutlass::bfloat16_t,
329
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
330
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
331
+ cutlass::gemm::GemmShape<64, 64, 32>,
332
+ cutlass::gemm::GemmShape<32, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
333
+ cutlass::epilogue::thread::LinearCombination<
334
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
335
+ ElementAccumulator, ElementAccumulator>,
336
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
337
+
338
+ EXPECT_TRUE(test::gemm::device::TestAllGemmBasic<Gemm>());
339
+ }
340
+
341
+ ////////////////////////////////////////////////////////////////////////////////
342
+
343
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32_sm80.cu ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_complex.h"
40
+
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/reference/host/gemm.h"
44
+ #include "cutlass/util/reference/host/tensor_compare.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/tensor_view_io.h"
48
+
49
+ #include "testbed_complex.h"
50
+
51
+ /////////////////////////////////////////////////////////////////////////////////////////////////
52
+
53
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
54
+
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+ // Operands data type: complex<float>
57
+ // Rounding: float -> tfloat32_t (half_ulp_truncate)
58
+ // Instruction operand data type: tfloat32_t (real part) and tfloat32_t (imaginary part)
59
+ // Math instruction: mma.sync.aligned.m16n8k8.f32.tf32.tf32.f32
60
+ // Instruction output/accumulation data type: f32 (real part) and f32 (imaginary part)
61
+ // Output data type: complex<float>
62
+ /////////////////////////////////////////////////////////////////////////////////////////////////
63
+
64
+
65
+ TEST(SM80_Device_Gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32, 32x32x16_16x16x16) {
66
+
67
+ using Element = cutlass::complex<float>;
68
+
69
+ using Gemm = cutlass::gemm::device::GemmComplex<
70
+ Element,
71
+ cutlass::layout::ColumnMajor,
72
+ Element,
73
+ cutlass::layout::RowMajor,
74
+ Element,
75
+ cutlass::layout::RowMajor,
76
+ Element,
77
+ cutlass::arch::OpClassTensorOp,
78
+ cutlass::arch::Sm80,
79
+ cutlass::gemm::GemmShape<32, 32, 16>,
80
+ cutlass::gemm::GemmShape<16, 16, 16>,
81
+ cutlass::gemm::GemmShape<16, 8, 8>,
82
+ cutlass::epilogue::thread::LinearCombination<
83
+ Element,
84
+ 1,
85
+ Element,
86
+ Element
87
+ >,
88
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
89
+ 3
90
+ >;
91
+
92
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
93
+ }
94
+
95
+
96
+ /////////////////////////////////////////////////////////////////////////////////////////////////
97
+
98
+ TEST(SM80_Device_Gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32, 64x64x16_16x32x16) {
99
+
100
+ using Element = cutlass::complex<float>;
101
+
102
+ using Gemm = cutlass::gemm::device::GemmComplex<
103
+ Element,
104
+ cutlass::layout::ColumnMajor,
105
+ Element,
106
+ cutlass::layout::RowMajor,
107
+ Element,
108
+ cutlass::layout::RowMajor,
109
+ Element,
110
+ cutlass::arch::OpClassTensorOp,
111
+ cutlass::arch::Sm80,
112
+ cutlass::gemm::GemmShape<64, 64, 16>,
113
+ cutlass::gemm::GemmShape<16, 32, 16>,
114
+ cutlass::gemm::GemmShape<16, 8, 8>,
115
+ cutlass::epilogue::thread::LinearCombination<
116
+ Element,
117
+ 1,
118
+ Element,
119
+ Element
120
+ >,
121
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
122
+ 3
123
+ >;
124
+
125
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
126
+ }
127
+
128
+ /////////////////////////////////////////////////////////////////////////////////////////////////
129
+
130
+ TEST(SM80_Device_Gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32, 64x64x16_32x32x16) {
131
+
132
+
133
+ using Element = cutlass::complex<float>;
134
+
135
+ using Gemm = cutlass::gemm::device::GemmComplex<
136
+ Element,
137
+ cutlass::layout::ColumnMajor,
138
+ Element,
139
+ cutlass::layout::RowMajor,
140
+ Element,
141
+ cutlass::layout::RowMajor,
142
+ Element,
143
+ cutlass::arch::OpClassTensorOp,
144
+ cutlass::arch::Sm80,
145
+ cutlass::gemm::GemmShape<64, 64, 16>,
146
+ cutlass::gemm::GemmShape<32, 32, 16>,
147
+ cutlass::gemm::GemmShape<16, 8, 8>,
148
+ cutlass::epilogue::thread::LinearCombination<
149
+ Element,
150
+ 1,
151
+ Element,
152
+ Element
153
+ >,
154
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
155
+ 3
156
+ >;
157
+
158
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
159
+ }
160
+
161
+ /////////////////////////////////////////////////////////////////////////////////////////////////
162
+
163
+ TEST(SM80_Device_Gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32, 128x64x16_64x32x16) {
164
+
165
+ using Element = cutlass::complex<float>;;
166
+
167
+ using Gemm = cutlass::gemm::device::GemmComplex<
168
+ Element,
169
+ cutlass::layout::ColumnMajor,
170
+ Element,
171
+ cutlass::layout::RowMajor,
172
+ Element,
173
+ cutlass::layout::RowMajor,
174
+ Element,
175
+ cutlass::arch::OpClassTensorOp,
176
+ cutlass::arch::Sm80,
177
+ cutlass::gemm::GemmShape<128, 64, 16>,
178
+ cutlass::gemm::GemmShape<64, 32, 16>,
179
+ cutlass::gemm::GemmShape<16, 8, 8>,
180
+ cutlass::epilogue::thread::LinearCombination<
181
+ Element,
182
+ 1,
183
+ Element,
184
+ Element
185
+ >,
186
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
187
+ 4
188
+ >;
189
+
190
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
191
+ }
192
+
193
+ /////////////////////////////////////////////////////////////////////////////////////////////////
194
+
195
+ TEST(SM80_Device_Gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32, 64x128x16_32x64x16) {
196
+
197
+ using Element = cutlass::complex<float>;;
198
+
199
+ using Gemm = cutlass::gemm::device::GemmComplex<
200
+ Element,
201
+ cutlass::layout::ColumnMajor,
202
+ Element,
203
+ cutlass::layout::RowMajor,
204
+ Element,
205
+ cutlass::layout::RowMajor,
206
+ Element,
207
+ cutlass::arch::OpClassTensorOp,
208
+ cutlass::arch::Sm80,
209
+ cutlass::gemm::GemmShape<64, 128, 16>,
210
+ cutlass::gemm::GemmShape<32, 64, 16>,
211
+ cutlass::gemm::GemmShape<16, 8, 8>,
212
+ cutlass::epilogue::thread::LinearCombination<
213
+ Element,
214
+ 1,
215
+ Element,
216
+ Element
217
+ >,
218
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
219
+ 3
220
+ >;
221
+
222
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
223
+ }
224
+
225
+ /////////////////////////////////////////////////////////////////////////////////////////////////
226
+
227
+ TEST(SM80_Device_Gemm_cf32n_cf32t_cf32t_tensor_op_tf32_f32, 128x128x16_32x64x16) {
228
+
229
+ using Element = cutlass::complex<float>;
230
+
231
+ using Gemm = cutlass::gemm::device::GemmComplex<
232
+ Element,
233
+ cutlass::layout::ColumnMajor,
234
+ Element,
235
+ cutlass::layout::RowMajor,
236
+ Element,
237
+ cutlass::layout::RowMajor,
238
+ Element,
239
+ cutlass::arch::OpClassTensorOp,
240
+ cutlass::arch::Sm80,
241
+ cutlass::gemm::GemmShape<128, 128, 16>,
242
+ cutlass::gemm::GemmShape<32, 64, 16>,
243
+ cutlass::gemm::GemmShape<16, 8, 8>,
244
+ cutlass::epilogue::thread::LinearCombination<
245
+ Element,
246
+ 1,
247
+ Element,
248
+ Element
249
+ >,
250
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
251
+ 3
252
+ >;
253
+
254
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
255
+ }
256
+
257
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
258
+
259
+ /////////////////////////////////////////////////////////////////////////////////////////////////
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32_sm80.cu ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_complex.h"
40
+
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/reference/host/gemm.h"
44
+ #include "cutlass/util/reference/host/tensor_compare.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/tensor_view_io.h"
48
+
49
+ #include "testbed_complex.h"
50
+
51
+ /////////////////////////////////////////////////////////////////////////////////////////////////
52
+
53
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
54
+
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+ // Operands data type: complex<float>
57
+ // Rounding: float -> tfloat32_t (round to nearest)
58
+ // Instruction operand data type: tfloat32_t (real part) and tfloat32_t (imaginary part)
59
+ // Math instruction: mma.sync.aligned.m16n8k8.f32.tf32.tf32.f32
60
+ // Instruction output/accumulation data type: f32 (real part) and f32 (imaginary part)
61
+ // Output data type: complex<float>
62
+ /////////////////////////////////////////////////////////////////////////////////////////////////
63
+
64
+ TEST(SM80_Device_Gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32, 32x32x16_16x16x16) {
65
+
66
+ using Element = cutlass::complex<float>;
67
+
68
+ using Gemm = cutlass::gemm::device::GemmComplex<
69
+ Element,
70
+ cutlass::layout::RowMajor,
71
+ Element,
72
+ cutlass::layout::ColumnMajor,
73
+ Element,
74
+ cutlass::layout::RowMajor,
75
+ Element,
76
+ cutlass::arch::OpClassTensorOp,
77
+ cutlass::arch::Sm80,
78
+ cutlass::gemm::GemmShape<32, 32, 16>,
79
+ cutlass::gemm::GemmShape<16, 16, 16>,
80
+ cutlass::gemm::GemmShape<16, 8, 8>,
81
+ cutlass::epilogue::thread::LinearCombination<
82
+ Element,
83
+ 1,
84
+ Element,
85
+ Element
86
+ >,
87
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
88
+ 3
89
+ >;
90
+
91
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
92
+ }
93
+
94
+
95
+ /////////////////////////////////////////////////////////////////////////////////////////////////
96
+
97
+ TEST(SM80_Device_Gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32, 64x64x16_16x32x16) {
98
+
99
+ using Element = cutlass::complex<float>;
100
+
101
+ using Gemm = cutlass::gemm::device::GemmComplex<
102
+ Element,
103
+ cutlass::layout::RowMajor,
104
+ Element,
105
+ cutlass::layout::ColumnMajor,
106
+ Element,
107
+ cutlass::layout::RowMajor,
108
+ Element,
109
+ cutlass::arch::OpClassTensorOp,
110
+ cutlass::arch::Sm80,
111
+ cutlass::gemm::GemmShape<64, 64, 16>,
112
+ cutlass::gemm::GemmShape<16, 32, 16>,
113
+ cutlass::gemm::GemmShape<16, 8, 8>,
114
+ cutlass::epilogue::thread::LinearCombination<
115
+ Element,
116
+ 1,
117
+ Element,
118
+ Element
119
+ >,
120
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
121
+ 3
122
+ >;
123
+
124
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
125
+ }
126
+
127
+ /////////////////////////////////////////////////////////////////////////////////////////////////
128
+
129
+ TEST(SM80_Device_Gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32, 64x64x16_32x32x16) {
130
+
131
+
132
+ using Element = cutlass::complex<float>;
133
+
134
+ using Gemm = cutlass::gemm::device::GemmComplex<
135
+ Element,
136
+ cutlass::layout::RowMajor,
137
+ Element,
138
+ cutlass::layout::ColumnMajor,
139
+ Element,
140
+ cutlass::layout::RowMajor,
141
+ Element,
142
+ cutlass::arch::OpClassTensorOp,
143
+ cutlass::arch::Sm80,
144
+ cutlass::gemm::GemmShape<64, 64, 16>,
145
+ cutlass::gemm::GemmShape<32, 32, 16>,
146
+ cutlass::gemm::GemmShape<16, 8, 8>,
147
+ cutlass::epilogue::thread::LinearCombination<
148
+ Element,
149
+ 1,
150
+ Element,
151
+ Element
152
+ >,
153
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
154
+ 3
155
+ >;
156
+
157
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
158
+ }
159
+
160
+ /////////////////////////////////////////////////////////////////////////////////////////////////
161
+
162
+ TEST(SM80_Device_Gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32, 128x64x16_64x32x16) {
163
+
164
+ using Element = cutlass::complex<float>;;
165
+
166
+ using Gemm = cutlass::gemm::device::GemmComplex<
167
+ Element,
168
+ cutlass::layout::RowMajor,
169
+ Element,
170
+ cutlass::layout::ColumnMajor,
171
+ Element,
172
+ cutlass::layout::RowMajor,
173
+ Element,
174
+ cutlass::arch::OpClassTensorOp,
175
+ cutlass::arch::Sm80,
176
+ cutlass::gemm::GemmShape<128, 64, 16>,
177
+ cutlass::gemm::GemmShape<64, 32, 16>,
178
+ cutlass::gemm::GemmShape<16, 8, 8>,
179
+ cutlass::epilogue::thread::LinearCombination<
180
+ Element,
181
+ 1,
182
+ Element,
183
+ Element
184
+ >,
185
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
186
+ 4
187
+ >;
188
+
189
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
190
+ }
191
+
192
+ /////////////////////////////////////////////////////////////////////////////////////////////////
193
+
194
+ TEST(SM80_Device_Gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32, 64x128x16_32x64x16) {
195
+
196
+ using Element = cutlass::complex<float>;;
197
+
198
+ using Gemm = cutlass::gemm::device::GemmComplex<
199
+ Element,
200
+ cutlass::layout::RowMajor,
201
+ Element,
202
+ cutlass::layout::ColumnMajor,
203
+ Element,
204
+ cutlass::layout::RowMajor,
205
+ Element,
206
+ cutlass::arch::OpClassTensorOp,
207
+ cutlass::arch::Sm80,
208
+ cutlass::gemm::GemmShape<64, 128, 16>,
209
+ cutlass::gemm::GemmShape<32, 64, 16>,
210
+ cutlass::gemm::GemmShape<16, 8, 8>,
211
+ cutlass::epilogue::thread::LinearCombination<
212
+ Element,
213
+ 1,
214
+ Element,
215
+ Element
216
+ >,
217
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
218
+ 3
219
+ >;
220
+
221
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
222
+ }
223
+
224
+ /////////////////////////////////////////////////////////////////////////////////////////////////
225
+
226
+ TEST(SM80_Device_Gemm_cf32t_cf32n_cf32t_tensor_op_tf32_f32, 128x128x16_32x64x16) {
227
+
228
+ using Element = cutlass::complex<float>;;
229
+
230
+ using Gemm = cutlass::gemm::device::GemmComplex<
231
+ Element,
232
+ cutlass::layout::RowMajor,
233
+ Element,
234
+ cutlass::layout::ColumnMajor,
235
+ Element,
236
+ cutlass::layout::RowMajor,
237
+ Element,
238
+ cutlass::arch::OpClassTensorOp,
239
+ cutlass::arch::Sm80,
240
+ cutlass::gemm::GemmShape<128, 128, 16>,
241
+ cutlass::gemm::GemmShape<32, 64, 16>,
242
+ cutlass::gemm::GemmShape<16, 8, 8>,
243
+ cutlass::epilogue::thread::LinearCombination<
244
+ Element,
245
+ 1,
246
+ Element,
247
+ Element
248
+ >,
249
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
250
+ 3
251
+ >;
252
+
253
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
254
+ }
255
+
256
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
257
+
258
+ /////////////////////////////////////////////////////////////////////////////////////////////////
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64n_cf64t_cf64t_tensor_op_f64_sm90.cu ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface with Hopper FP64
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_complex.h"
40
+
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/reference/host/gemm.h"
44
+ #include "cutlass/util/reference/host/tensor_compare.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/tensor_view_io.h"
48
+
49
+ #include "testbed_complex.h"
50
+
51
+ /////////////////////////////////////////////////////////////////////////////////////////////////
52
+
53
+ #if defined(CUTLASS_ARCH_MMA_SM90_F64_MMA_ENABLED)
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+
56
+ TEST(SM90_Device_Gemm_cf64n_cf64t_cf64t_tensor_op_f64, 32x32x16_16x16x16) {
57
+
58
+ using Element = cutlass::complex<double>;
59
+
60
+ using Gemm = cutlass::gemm::device::GemmComplex<
61
+ Element,
62
+ cutlass::layout::ColumnMajor,
63
+ Element,
64
+ cutlass::layout::RowMajor,
65
+ Element,
66
+ cutlass::layout::RowMajor,
67
+ Element,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm90,
70
+ cutlass::gemm::GemmShape<32, 32, 16>,
71
+ cutlass::gemm::GemmShape<16, 16, 16>,
72
+ cutlass::gemm::GemmShape<16, 8, 4>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ Element,
75
+ 1,
76
+ Element,
77
+ Element
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 3
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
84
+ }
85
+
86
+ /////////////////////////////////////////////////////////////////////////////////////////////////
87
+
88
+ TEST(SM90_Device_Gemm_cf64n_cf64t_cf64t_tensor_op_f64, 32x32x8_16x16x8) {
89
+
90
+ using Element = cutlass::complex<double>;
91
+
92
+ using Gemm = cutlass::gemm::device::GemmComplex<
93
+ Element,
94
+ cutlass::layout::ColumnMajor,
95
+ Element,
96
+ cutlass::layout::RowMajor,
97
+ Element,
98
+ cutlass::layout::RowMajor,
99
+ Element,
100
+ cutlass::arch::OpClassTensorOp,
101
+ cutlass::arch::Sm90,
102
+ cutlass::gemm::GemmShape<32, 32, 8>,
103
+ cutlass::gemm::GemmShape<16, 16, 8>,
104
+ cutlass::gemm::GemmShape<16, 8, 4>,
105
+ cutlass::epilogue::thread::LinearCombination<
106
+ Element,
107
+ 1,
108
+ Element,
109
+ Element
110
+ >,
111
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
112
+ 3
113
+ >;
114
+
115
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
116
+ }
117
+
118
+ /////////////////////////////////////////////////////////////////////////////////////////////////
119
+
120
+ TEST(SM90_Device_Gemm_cf64n_cf64t_cf64t_tensor_op_f64, 64x64x16_16x32x16) {
121
+
122
+ using Element = cutlass::complex<double>;
123
+
124
+ using Gemm = cutlass::gemm::device::GemmComplex<
125
+ Element,
126
+ cutlass::layout::ColumnMajor,
127
+ Element,
128
+ cutlass::layout::RowMajor,
129
+ Element,
130
+ cutlass::layout::RowMajor,
131
+ Element,
132
+ cutlass::arch::OpClassTensorOp,
133
+ cutlass::arch::Sm90,
134
+ cutlass::gemm::GemmShape<64, 64, 16>,
135
+ cutlass::gemm::GemmShape<16, 32, 16>,
136
+ cutlass::gemm::GemmShape<16, 8, 4>,
137
+ cutlass::epilogue::thread::LinearCombination<
138
+ Element,
139
+ 1,
140
+ Element,
141
+ Element
142
+ >,
143
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
144
+ 3
145
+ >;
146
+
147
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
148
+ }
149
+
150
+ /////////////////////////////////////////////////////////////////////////////////////////////////
151
+
152
+ TEST(SM90_Device_Gemm_cf64n_cf64t_cf64t_tensor_op_f64, 64x64x8_16x32x8) {
153
+
154
+ using Element = cutlass::complex<double>;
155
+
156
+ using Gemm = cutlass::gemm::device::GemmComplex<
157
+ Element,
158
+ cutlass::layout::ColumnMajor,
159
+ Element,
160
+ cutlass::layout::RowMajor,
161
+ Element,
162
+ cutlass::layout::RowMajor,
163
+ Element,
164
+ cutlass::arch::OpClassTensorOp,
165
+ cutlass::arch::Sm90,
166
+ cutlass::gemm::GemmShape<64, 64, 8>,
167
+ cutlass::gemm::GemmShape<16, 32, 8>,
168
+ cutlass::gemm::GemmShape<16, 8, 4>,
169
+ cutlass::epilogue::thread::LinearCombination<
170
+ Element,
171
+ 1,
172
+ Element,
173
+ Element
174
+ >,
175
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
176
+ 3
177
+ >;
178
+
179
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
180
+ }
181
+
182
+ /////////////////////////////////////////////////////////////////////////////////////////////////
183
+
184
+ TEST(SM90_Device_Gemm_cf64n_cf64t_cf64t_tensor_op_f64, 64x64x16_32x32x16) {
185
+
186
+
187
+ using Element = cutlass::complex<double>;
188
+
189
+ using Gemm = cutlass::gemm::device::GemmComplex<
190
+ Element,
191
+ cutlass::layout::ColumnMajor,
192
+ Element,
193
+ cutlass::layout::RowMajor,
194
+ Element,
195
+ cutlass::layout::RowMajor,
196
+ Element,
197
+ cutlass::arch::OpClassTensorOp,
198
+ cutlass::arch::Sm90,
199
+ cutlass::gemm::GemmShape<64, 64, 16>,
200
+ cutlass::gemm::GemmShape<32, 32, 16>,
201
+ cutlass::gemm::GemmShape<16, 8, 4>,
202
+ cutlass::epilogue::thread::LinearCombination<
203
+ Element,
204
+ 1,
205
+ Element,
206
+ Element
207
+ >,
208
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
209
+ 3
210
+ >;
211
+
212
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
213
+ }
214
+
215
+ /////////////////////////////////////////////////////////////////////////////////////////////////
216
+
217
+ TEST(SM90_Device_Gemm_cf64n_cf64t_cf64t_tensor_op_f64, 64x64x8_32x32x8) {
218
+
219
+ using Element = cutlass::complex<double>;
220
+
221
+ using Gemm = cutlass::gemm::device::GemmComplex<
222
+ Element,
223
+ cutlass::layout::ColumnMajor,
224
+ Element,
225
+ cutlass::layout::RowMajor,
226
+ Element,
227
+ cutlass::layout::RowMajor,
228
+ Element,
229
+ cutlass::arch::OpClassTensorOp,
230
+ cutlass::arch::Sm90,
231
+ cutlass::gemm::GemmShape<64, 64, 8>,
232
+ cutlass::gemm::GemmShape<32, 32, 8>,
233
+ cutlass::gemm::GemmShape<16, 8, 4>,
234
+ cutlass::epilogue::thread::LinearCombination<
235
+ Element,
236
+ 1,
237
+ Element,
238
+ Element
239
+ >,
240
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
241
+ 3
242
+ >;
243
+
244
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
245
+ }
246
+
247
+ /////////////////////////////////////////////////////////////////////////////////////////////////
248
+
249
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM90_F64_MMA_ENABLED)
250
+
251
+ /////////////////////////////////////////////////////////////////////////////////////////////////
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian_sm80.cu ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_complex.h"
40
+
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/reference/host/gemm.h"
44
+ #include "cutlass/util/reference/host/tensor_compare.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/tensor_view_io.h"
48
+
49
+ #include "testbed_complex.h"
50
+
51
+ /////////////////////////////////////////////////////////////////////////////////////////////////
52
+
53
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
54
+
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+
57
+ TEST(SM80_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 32x32x8_16x16x8) {
58
+
59
+ using Element = cutlass::complex<double>;
60
+
61
+ using Gemm = cutlass::gemm::device::GemmComplex<
62
+ Element,
63
+ cutlass::layout::RowMajor,
64
+ Element,
65
+ cutlass::layout::ColumnMajor,
66
+ Element,
67
+ cutlass::layout::RowMajor,
68
+ Element,
69
+ cutlass::arch::OpClassTensorOp,
70
+ cutlass::arch::Sm80,
71
+ cutlass::gemm::GemmShape<32, 32, 8>,
72
+ cutlass::gemm::GemmShape<16, 16, 8>,
73
+ cutlass::gemm::GemmShape<8, 8, 4>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ Element,
76
+ 1,
77
+ Element,
78
+ Element
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 3,
82
+ cutlass::ComplexTransform::kNone,
83
+ cutlass::ComplexTransform::kNone,
84
+ cutlass::arch::OpMultiplyAddGaussianComplex
85
+ >;
86
+
87
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
88
+ }
89
+
90
+ TEST(SM80_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 64x64x8_32x16x8) {
91
+
92
+ using Element = cutlass::complex<double>;
93
+
94
+ using Gemm = cutlass::gemm::device::GemmComplex<
95
+ Element,
96
+ cutlass::layout::RowMajor,
97
+ Element,
98
+ cutlass::layout::ColumnMajor,
99
+ Element,
100
+ cutlass::layout::RowMajor,
101
+ Element,
102
+ cutlass::arch::OpClassTensorOp,
103
+ cutlass::arch::Sm80,
104
+ cutlass::gemm::GemmShape<64, 64, 8>,
105
+ cutlass::gemm::GemmShape<32, 16, 8>,
106
+ cutlass::gemm::GemmShape<8, 8, 4>,
107
+ cutlass::epilogue::thread::LinearCombination<
108
+ Element,
109
+ 1,
110
+ Element,
111
+ Element
112
+ >,
113
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
114
+ 3,
115
+ cutlass::ComplexTransform::kNone,
116
+ cutlass::ComplexTransform::kNone,
117
+ cutlass::arch::OpMultiplyAddGaussianComplex
118
+ >;
119
+
120
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
121
+ }
122
+
123
+ /////////////////////////////////////////////////////////////////////////////////////////////////
124
+
125
+ TEST(SM80_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 32x32x16_16x16x16) {
126
+
127
+ using Element = cutlass::complex<double>;
128
+
129
+ using Gemm = cutlass::gemm::device::GemmComplex<
130
+ Element,
131
+ cutlass::layout::RowMajor,
132
+ Element,
133
+ cutlass::layout::ColumnMajor,
134
+ Element,
135
+ cutlass::layout::RowMajor,
136
+ Element,
137
+ cutlass::arch::OpClassTensorOp,
138
+ cutlass::arch::Sm80,
139
+ cutlass::gemm::GemmShape<32, 32, 16>,
140
+ cutlass::gemm::GemmShape<16, 16, 16>,
141
+ cutlass::gemm::GemmShape<8, 8, 4>,
142
+ cutlass::epilogue::thread::LinearCombination<
143
+ Element,
144
+ 1,
145
+ Element,
146
+ Element
147
+ >,
148
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
149
+ 3,
150
+ cutlass::ComplexTransform::kNone,
151
+ cutlass::ComplexTransform::kNone,
152
+ cutlass::arch::OpMultiplyAddGaussianComplex
153
+ >;
154
+
155
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
156
+ }
157
+
158
+ TEST(SM80_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 64x64x16_32x16x16) {
159
+
160
+ using Element = cutlass::complex<double>;
161
+
162
+ using Gemm = cutlass::gemm::device::GemmComplex<
163
+ Element,
164
+ cutlass::layout::RowMajor,
165
+ Element,
166
+ cutlass::layout::ColumnMajor,
167
+ Element,
168
+ cutlass::layout::RowMajor,
169
+ Element,
170
+ cutlass::arch::OpClassTensorOp,
171
+ cutlass::arch::Sm80,
172
+ cutlass::gemm::GemmShape<64, 64, 16>,
173
+ cutlass::gemm::GemmShape<32, 16, 16>,
174
+ cutlass::gemm::GemmShape<8, 8, 4>,
175
+ cutlass::epilogue::thread::LinearCombination<
176
+ Element,
177
+ 1,
178
+ Element,
179
+ Element
180
+ >,
181
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
182
+ 3,
183
+ cutlass::ComplexTransform::kNone,
184
+ cutlass::ComplexTransform::kNone,
185
+ cutlass::arch::OpMultiplyAddGaussianComplex
186
+ >;
187
+
188
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
189
+ }
190
+
191
+
192
+ /////////////////////////////////////////////////////////////////////////////////////////////////
193
+
194
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
195
+
196
+ /////////////////////////////////////////////////////////////////////////////////////////////////
197
+
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian_sm90.cu ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface with Hopper FP64
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_complex.h"
40
+
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/reference/host/gemm.h"
44
+ #include "cutlass/util/reference/host/tensor_compare.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/tensor_view_io.h"
48
+
49
+ #include "testbed_complex.h"
50
+
51
+ /////////////////////////////////////////////////////////////////////////////////////////////////
52
+
53
+ #if defined(CUTLASS_ARCH_MMA_SM90_F64_MMA_ENABLED)
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+
56
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 32x32x8_16x16x8) {
57
+
58
+ using Element = cutlass::complex<double>;
59
+
60
+ using Gemm = cutlass::gemm::device::GemmComplex<
61
+ Element,
62
+ cutlass::layout::RowMajor,
63
+ Element,
64
+ cutlass::layout::ColumnMajor,
65
+ Element,
66
+ cutlass::layout::RowMajor,
67
+ Element,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm90,
70
+ cutlass::gemm::GemmShape<32, 32, 8>,
71
+ cutlass::gemm::GemmShape<16, 16, 8>,
72
+ cutlass::gemm::GemmShape<16, 8, 4>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ Element,
75
+ 1,
76
+ Element,
77
+ Element
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 3,
81
+ cutlass::ComplexTransform::kNone,
82
+ cutlass::ComplexTransform::kNone,
83
+ cutlass::arch::OpMultiplyAddGaussianComplex
84
+ >;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
87
+ }
88
+
89
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 64x64x8_32x16x8) {
90
+
91
+ using Element = cutlass::complex<double>;
92
+
93
+ using Gemm = cutlass::gemm::device::GemmComplex<
94
+ Element,
95
+ cutlass::layout::RowMajor,
96
+ Element,
97
+ cutlass::layout::ColumnMajor,
98
+ Element,
99
+ cutlass::layout::RowMajor,
100
+ Element,
101
+ cutlass::arch::OpClassTensorOp,
102
+ cutlass::arch::Sm90,
103
+ cutlass::gemm::GemmShape<64, 64, 8>,
104
+ cutlass::gemm::GemmShape<32, 16, 8>,
105
+ cutlass::gemm::GemmShape<16, 8, 4>,
106
+ cutlass::epilogue::thread::LinearCombination<
107
+ Element,
108
+ 1,
109
+ Element,
110
+ Element
111
+ >,
112
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
113
+ 3,
114
+ cutlass::ComplexTransform::kNone,
115
+ cutlass::ComplexTransform::kNone,
116
+ cutlass::arch::OpMultiplyAddGaussianComplex
117
+ >;
118
+
119
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
120
+ }
121
+
122
+ /////////////////////////////////////////////////////////////////////////////////////////////////
123
+
124
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 32x32x16_16x16x16) {
125
+
126
+ using Element = cutlass::complex<double>;
127
+
128
+ using Gemm = cutlass::gemm::device::GemmComplex<
129
+ Element,
130
+ cutlass::layout::RowMajor,
131
+ Element,
132
+ cutlass::layout::ColumnMajor,
133
+ Element,
134
+ cutlass::layout::RowMajor,
135
+ Element,
136
+ cutlass::arch::OpClassTensorOp,
137
+ cutlass::arch::Sm90,
138
+ cutlass::gemm::GemmShape<32, 32, 16>,
139
+ cutlass::gemm::GemmShape<16, 16, 16>,
140
+ cutlass::gemm::GemmShape<16, 8, 4>,
141
+ cutlass::epilogue::thread::LinearCombination<
142
+ Element,
143
+ 1,
144
+ Element,
145
+ Element
146
+ >,
147
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
148
+ 3,
149
+ cutlass::ComplexTransform::kNone,
150
+ cutlass::ComplexTransform::kNone,
151
+ cutlass::arch::OpMultiplyAddGaussianComplex
152
+ >;
153
+
154
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
155
+ }
156
+
157
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64_gaussian, 64x64x16_32x16x16) {
158
+
159
+ using Element = cutlass::complex<double>;
160
+
161
+ using Gemm = cutlass::gemm::device::GemmComplex<
162
+ Element,
163
+ cutlass::layout::RowMajor,
164
+ Element,
165
+ cutlass::layout::ColumnMajor,
166
+ Element,
167
+ cutlass::layout::RowMajor,
168
+ Element,
169
+ cutlass::arch::OpClassTensorOp,
170
+ cutlass::arch::Sm90,
171
+ cutlass::gemm::GemmShape<64, 64, 16>,
172
+ cutlass::gemm::GemmShape<32, 16, 16>,
173
+ cutlass::gemm::GemmShape<16, 8, 4>,
174
+ cutlass::epilogue::thread::LinearCombination<
175
+ Element,
176
+ 1,
177
+ Element,
178
+ Element
179
+ >,
180
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
181
+ 3,
182
+ cutlass::ComplexTransform::kNone,
183
+ cutlass::ComplexTransform::kNone,
184
+ cutlass::arch::OpMultiplyAddGaussianComplex
185
+ >;
186
+
187
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
188
+ }
189
+
190
+
191
+ /////////////////////////////////////////////////////////////////////////////////////////////////
192
+
193
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM90_F64_MMA_ENABLED)
194
+
195
+ /////////////////////////////////////////////////////////////////////////////////////////////////
196
+
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_cf64t_cf64n_cf64t_tensor_op_f64_sm90.cu ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface with Hopper FP64
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_complex.h"
40
+
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/reference/host/gemm.h"
44
+ #include "cutlass/util/reference/host/tensor_compare.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/tensor_view_io.h"
48
+
49
+ #include "testbed_complex.h"
50
+
51
+ /////////////////////////////////////////////////////////////////////////////////////////////////
52
+
53
+ #if defined(CUTLASS_ARCH_MMA_SM90_F64_MMA_ENABLED)
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+
56
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 32x32x8_16x16x8) {
57
+
58
+ using Element = cutlass::complex<double>;
59
+
60
+ using Gemm = cutlass::gemm::device::GemmComplex<
61
+ Element,
62
+ cutlass::layout::RowMajor,
63
+ Element,
64
+ cutlass::layout::ColumnMajor,
65
+ Element,
66
+ cutlass::layout::RowMajor,
67
+ Element,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm90,
70
+ cutlass::gemm::GemmShape<32, 32, 8>,
71
+ cutlass::gemm::GemmShape<16, 16, 8>,
72
+ cutlass::gemm::GemmShape<16, 8, 4>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ Element,
75
+ 1,
76
+ Element,
77
+ Element
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 3
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
84
+ }
85
+
86
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 64x64x8_32x32x8) {
87
+
88
+ using Element = cutlass::complex<double>;
89
+
90
+ using Gemm = cutlass::gemm::device::GemmComplex<
91
+ Element,
92
+ cutlass::layout::RowMajor,
93
+ Element,
94
+ cutlass::layout::ColumnMajor,
95
+ Element,
96
+ cutlass::layout::RowMajor,
97
+ Element,
98
+ cutlass::arch::OpClassTensorOp,
99
+ cutlass::arch::Sm90,
100
+ cutlass::gemm::GemmShape<64, 64, 8>,
101
+ cutlass::gemm::GemmShape<32, 32, 8>,
102
+ cutlass::gemm::GemmShape<16, 8, 4>,
103
+ cutlass::epilogue::thread::LinearCombination<
104
+ Element,
105
+ 1,
106
+ Element,
107
+ Element
108
+ >,
109
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
110
+ 3
111
+ >;
112
+
113
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
114
+ }
115
+
116
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 64x128x8_32x32x8) {
117
+
118
+ using Element = cutlass::complex<double>;
119
+
120
+ using Gemm = cutlass::gemm::device::GemmComplex<
121
+ Element,
122
+ cutlass::layout::RowMajor,
123
+ Element,
124
+ cutlass::layout::ColumnMajor,
125
+ Element,
126
+ cutlass::layout::RowMajor,
127
+ Element,
128
+ cutlass::arch::OpClassTensorOp,
129
+ cutlass::arch::Sm90,
130
+ cutlass::gemm::GemmShape<64, 128, 8>,
131
+ cutlass::gemm::GemmShape<32, 32, 8>,
132
+ cutlass::gemm::GemmShape<16, 8, 4>,
133
+ cutlass::epilogue::thread::LinearCombination<
134
+ Element,
135
+ 1,
136
+ Element,
137
+ Element
138
+ >,
139
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
140
+ 3
141
+ >;
142
+
143
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
144
+ }
145
+
146
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 128x64x8_32x32x8) {
147
+
148
+ using Element = cutlass::complex<double>;
149
+
150
+ using Gemm = cutlass::gemm::device::GemmComplex<
151
+ Element,
152
+ cutlass::layout::RowMajor,
153
+ Element,
154
+ cutlass::layout::ColumnMajor,
155
+ Element,
156
+ cutlass::layout::RowMajor,
157
+ Element,
158
+ cutlass::arch::OpClassTensorOp,
159
+ cutlass::arch::Sm90,
160
+ cutlass::gemm::GemmShape<64, 128, 8>,
161
+ cutlass::gemm::GemmShape<32, 32, 8>,
162
+ cutlass::gemm::GemmShape<16, 8, 4>,
163
+ cutlass::epilogue::thread::LinearCombination<
164
+ Element,
165
+ 1,
166
+ Element,
167
+ Element
168
+ >,
169
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
170
+ 3
171
+ >;
172
+
173
+
174
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
175
+ }
176
+
177
+ /////////////////////////////////////////////////////////////////////////////////////////////////
178
+
179
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 32x32x16_16x16x16) {
180
+
181
+ using Element = cutlass::complex<double>;
182
+
183
+ using Gemm = cutlass::gemm::device::GemmComplex<
184
+ Element,
185
+ cutlass::layout::RowMajor,
186
+ Element,
187
+ cutlass::layout::ColumnMajor,
188
+ Element,
189
+ cutlass::layout::RowMajor,
190
+ Element,
191
+ cutlass::arch::OpClassTensorOp,
192
+ cutlass::arch::Sm90,
193
+ cutlass::gemm::GemmShape<32, 32, 16>,
194
+ cutlass::gemm::GemmShape<16, 16, 16>,
195
+ cutlass::gemm::GemmShape<16, 8, 4>,
196
+ cutlass::epilogue::thread::LinearCombination<
197
+ Element,
198
+ 1,
199
+ Element,
200
+ Element
201
+ >,
202
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
203
+ 3
204
+ >;
205
+
206
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
207
+ }
208
+
209
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 64x64x16_32x32x16) {
210
+
211
+ using Element = cutlass::complex<double>;
212
+
213
+ using Gemm = cutlass::gemm::device::GemmComplex<
214
+ Element,
215
+ cutlass::layout::RowMajor,
216
+ Element,
217
+ cutlass::layout::ColumnMajor,
218
+ Element,
219
+ cutlass::layout::RowMajor,
220
+ Element,
221
+ cutlass::arch::OpClassTensorOp,
222
+ cutlass::arch::Sm90,
223
+ cutlass::gemm::GemmShape<64, 64, 16>,
224
+ cutlass::gemm::GemmShape<32, 32, 16>,
225
+ cutlass::gemm::GemmShape<16, 8, 4>,
226
+ cutlass::epilogue::thread::LinearCombination<
227
+ Element,
228
+ 1,
229
+ Element,
230
+ Element
231
+ >,
232
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
233
+ 3
234
+ >;
235
+
236
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
237
+ }
238
+
239
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 64x128x16_32x32x16) {
240
+
241
+ using Element = cutlass::complex<double>;
242
+
243
+ using Gemm = cutlass::gemm::device::GemmComplex<
244
+ Element,
245
+ cutlass::layout::RowMajor,
246
+ Element,
247
+ cutlass::layout::ColumnMajor,
248
+ Element,
249
+ cutlass::layout::RowMajor,
250
+ Element,
251
+ cutlass::arch::OpClassTensorOp,
252
+ cutlass::arch::Sm90,
253
+ cutlass::gemm::GemmShape<64, 128, 16>,
254
+ cutlass::gemm::GemmShape<32, 32, 16>,
255
+ cutlass::gemm::GemmShape<16, 8, 4>,
256
+ cutlass::epilogue::thread::LinearCombination<
257
+ Element,
258
+ 1,
259
+ Element,
260
+ Element
261
+ >,
262
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
263
+ 3
264
+ >;
265
+
266
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
267
+ }
268
+
269
+ TEST(SM90_Device_Gemm_cf64t_cf64n_cf64t_tensor_op_f64, 128x64x16_32x32x16) {
270
+
271
+ using Element = cutlass::complex<double>;
272
+
273
+ using Gemm = cutlass::gemm::device::GemmComplex<
274
+ Element,
275
+ cutlass::layout::RowMajor,
276
+ Element,
277
+ cutlass::layout::ColumnMajor,
278
+ Element,
279
+ cutlass::layout::RowMajor,
280
+ Element,
281
+ cutlass::arch::OpClassTensorOp,
282
+ cutlass::arch::Sm90,
283
+ cutlass::gemm::GemmShape<64, 128, 16>,
284
+ cutlass::gemm::GemmShape<32, 32, 16>,
285
+ cutlass::gemm::GemmShape<16, 8, 4>,
286
+ cutlass::epilogue::thread::LinearCombination<
287
+ Element,
288
+ 1,
289
+ Element,
290
+ Element
291
+ >,
292
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
293
+ 3
294
+ >;
295
+
296
+ EXPECT_TRUE(test::gemm::device::TestAllGemmComplex<Gemm>());
297
+ }
298
+
299
+ /////////////////////////////////////////////////////////////////////////////////////////////////
300
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM90_F64_MMA_ENABLED)
301
+
302
+ /////////////////////////////////////////////////////////////////////////////////////////////////
303
+
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16n_direct_store_tensor_op_f32_sm80.cu ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+
40
+ #include "cutlass/gemm/kernel/gemm_universal.h"
41
+ #include "cutlass/gemm/device/gemm_universal.h"
42
+ #include "cutlass/gemm/device/gemm_universal_adapter.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/reference/host/gemm.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_fill.h"
49
+ #include "cutlass/util/tensor_view_io.h"
50
+
51
+ #include "testbed_universal.h"
52
+
53
+ ////////////////////////////////////////////////////////////////////////////////
54
+
55
+ #include "cutlass/epilogue/threadblock/epilogue_direct_store.h"
56
+ #include "cutlass/epilogue/threadblock/default_epilogue_direct_store.h"
57
+
58
+ ////////////////////////////////////////////////////////////////////////////////
59
+
60
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
61
+
62
+ ////////////////////////////////////////////////////////////////////////////////
63
+
64
+ TEST(SM80_Device_GemmUniversal_DirectStore_f16n_f16t_f32n_tensor_op_f32, 128x128x32_64x64x32) {
65
+
66
+ using ElementOutput = float;
67
+ using ElementAccumulator = float;
68
+
69
+ // Define the GEMM kernel
70
+ using GemmBase = cutlass::gemm::device::GemmUniversal<
71
+ cutlass::half_t,
72
+ cutlass::layout::ColumnMajor,
73
+ cutlass::half_t,
74
+ cutlass::layout::RowMajor,
75
+ ElementOutput, cutlass::layout::ColumnMajor,
76
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
77
+ cutlass::gemm::GemmShape<128, 128, 32>,
78
+ cutlass::gemm::GemmShape<64, 64, 32>,
79
+ cutlass::gemm::GemmShape<16, 8, 16>,
80
+ cutlass::epilogue::thread::LinearCombination<
81
+ ElementOutput,
82
+ 4, // This is the vector size of the epilogue.
83
+ ElementAccumulator,
84
+ ElementAccumulator>,
85
+ cutlass::gemm::threadblock::GemmBatchedIdentityThreadblockSwizzle,
86
+ 3,
87
+ 8,
88
+ 8
89
+ >;
90
+
91
+ // Define the direct store epilogue
92
+ using EpilogueDirectStore = typename cutlass::epilogue::threadblock::DefaultEpilogueDirectStore<
93
+ typename GemmBase::GemmKernel::Epilogue
94
+ >::Epilogue;
95
+
96
+ // Define a new kernel
97
+ using Kernel = cutlass::gemm::kernel::GemmUniversal<
98
+ typename GemmBase::GemmKernel::Mma,
99
+ EpilogueDirectStore,
100
+ typename GemmBase::GemmKernel::ThreadblockSwizzle
101
+ >;
102
+
103
+ // Define the adaptor
104
+ using Gemm = cutlass::gemm::device::GemmUniversalAdapter<Kernel>;
105
+
106
+ EXPECT_TRUE(test::gemm::device::TestAllGemmUniversal<Gemm>());
107
+ }
108
+
109
+ ////////////////////////////////////////////////////////////////////////////////
110
+
111
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
112
+
113
+ ////////////////////////////////////////////////////////////////////////////////
114
+
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16n_wmma_tensor_op_f16_sm70.cu ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F16=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+
57
+ TEST(SM70_Device_Gemm_f16n_f16n_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_16x16x16) {
58
+ // single cta, two warps horizontally two waprs vertically
59
+ using ElementOutput = cutlass::half_t;
60
+ using ElementAccumulator = cutlass::half_t;
61
+
62
+ using Gemm = cutlass::gemm::device::Gemm<
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ cutlass::half_t,
66
+ cutlass::layout::ColumnMajor,
67
+ ElementOutput,
68
+ cutlass::layout::ColumnMajor,
69
+ ElementAccumulator,
70
+ cutlass::arch::OpClassWmmaTensorOp,
71
+ cutlass::arch::Sm70,
72
+ cutlass::gemm::GemmShape<128, 128, 32>,
73
+ cutlass::gemm::GemmShape<64, 64, 32>,
74
+ cutlass::gemm::GemmShape<16, 16, 16>,
75
+ cutlass::epilogue::thread::LinearCombination<
76
+ ElementOutput,
77
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
78
+ ElementAccumulator,
79
+ ElementAccumulator
80
+ >,
81
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
82
+ 2
83
+ >;
84
+
85
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
86
+ }
87
+
88
+
89
+ /////////////////////////////////////////////////////////////////////////////////////////////////
90
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F16=>F16 //////////
91
+ /////////////////////////////////////////////////////////////////////////////////////////////////
92
+ TEST(SM70_Device_Gemm_f16n_f16n_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_32x8x16) {
93
+
94
+ using ElementOutput = cutlass::half_t;
95
+ using ElementAccumulator = cutlass::half_t;
96
+
97
+ using Gemm = cutlass::gemm::device::Gemm<
98
+ cutlass::half_t,
99
+ cutlass::layout::ColumnMajor,
100
+ cutlass::half_t,
101
+ cutlass::layout::ColumnMajor,
102
+ ElementOutput,
103
+ cutlass::layout::ColumnMajor,
104
+ ElementAccumulator,
105
+ cutlass::arch::OpClassWmmaTensorOp,
106
+ cutlass::arch::Sm70,
107
+ cutlass::gemm::GemmShape<128, 128, 32>,
108
+ cutlass::gemm::GemmShape<64, 64, 32>,
109
+ cutlass::gemm::GemmShape<32, 8, 16>,
110
+ cutlass::epilogue::thread::LinearCombination<
111
+ ElementOutput,
112
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
113
+ ElementAccumulator,
114
+ ElementAccumulator
115
+ >,
116
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
117
+ 2
118
+ >;
119
+
120
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
121
+ }
122
+
123
+ /////////////////////////////////////////////////////////////////////////////////////////////////
124
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F16=>F16 //////////
125
+ /////////////////////////////////////////////////////////////////////////////////////////////////
126
+ TEST(SM70_Device_Gemm_f16n_f16n_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_8x32x16) {
127
+
128
+ using ElementOutput = cutlass::half_t;
129
+ using ElementAccumulator = cutlass::half_t;
130
+
131
+ using Gemm = cutlass::gemm::device::Gemm<
132
+ cutlass::half_t,
133
+ cutlass::layout::ColumnMajor,
134
+ cutlass::half_t,
135
+ cutlass::layout::ColumnMajor,
136
+ ElementOutput,
137
+ cutlass::layout::ColumnMajor,
138
+ ElementAccumulator,
139
+ cutlass::arch::OpClassWmmaTensorOp,
140
+ cutlass::arch::Sm70,
141
+ cutlass::gemm::GemmShape<128, 128, 32>,
142
+ cutlass::gemm::GemmShape<64, 64, 32>,
143
+ cutlass::gemm::GemmShape<8, 32, 16>,
144
+ cutlass::epilogue::thread::LinearCombination<
145
+ ElementOutput,
146
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
147
+ ElementAccumulator,
148
+ ElementAccumulator
149
+ >,
150
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
151
+ 2
152
+ >;
153
+
154
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
155
+ }
156
+
157
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16n_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+ TEST(SM70_Device_Gemm_f16n_f16n_f16n_wmma_tensor_op_f32, 128x128x32_64x64x32_16x16x16) {
57
+ // single cta, two warps horizontally two waprs vertically
58
+ using ElementOutput = cutlass::half_t;
59
+ using ElementAccumulator = float;
60
+
61
+ using Gemm = cutlass::gemm::device::Gemm<
62
+ cutlass::half_t,
63
+ cutlass::layout::ColumnMajor,
64
+ cutlass::half_t,
65
+ cutlass::layout::ColumnMajor,
66
+ ElementOutput,
67
+ cutlass::layout::ColumnMajor,
68
+ ElementAccumulator,
69
+ cutlass::arch::OpClassWmmaTensorOp,
70
+ cutlass::arch::Sm70,
71
+ cutlass::gemm::GemmShape<128, 128, 32>,
72
+ cutlass::gemm::GemmShape<64, 64, 32>,
73
+ cutlass::gemm::GemmShape<16, 16, 16>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ ElementOutput,
76
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
77
+ ElementAccumulator,
78
+ ElementAccumulator
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 2
82
+ >;
83
+
84
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
85
+ }
86
+
87
+ /////////////////////////////////////////////////////////////////////////////////////////////////
88
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F16=>F16 //////////
89
+ /////////////////////////////////////////////////////////////////////////////////////////////////
90
+ TEST(SM70_Device_Gemm_f16n_f16n_f16n_wmma_tensor_op_f32, 64x64x32_64x64x32_32x8x16) {
91
+
92
+ using ElementOutput = cutlass::half_t;
93
+ using ElementAccumulator = float;
94
+
95
+ using Gemm = cutlass::gemm::device::Gemm<
96
+ cutlass::half_t,
97
+ cutlass::layout::ColumnMajor,
98
+ cutlass::half_t,
99
+ cutlass::layout::ColumnMajor,
100
+ ElementOutput,
101
+ cutlass::layout::ColumnMajor,
102
+ ElementAccumulator,
103
+ cutlass::arch::OpClassWmmaTensorOp,
104
+ cutlass::arch::Sm70,
105
+ cutlass::gemm::GemmShape<64, 64, 32>,
106
+ cutlass::gemm::GemmShape<64, 64, 32>,
107
+ cutlass::gemm::GemmShape<32, 8, 16>,
108
+ cutlass::epilogue::thread::LinearCombination<
109
+ ElementOutput,
110
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
111
+ ElementAccumulator,
112
+ ElementAccumulator
113
+ >,
114
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
115
+ 2
116
+ >;
117
+
118
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
119
+ }
120
+
121
+ /////////////////////////////////////////////////////////////////////////////////////////////////
122
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F16=>F16 //////////
123
+ /////////////////////////////////////////////////////////////////////////////////////////////////
124
+ TEST(SM70_Device_Gemm_f16n_f16n_f16n_wmma_tensor_op_f32, 64x64x32_64x64x32_8x32x16) {
125
+
126
+ using ElementOutput = cutlass::half_t;
127
+ using ElementAccumulator = float;
128
+
129
+ using Gemm = cutlass::gemm::device::Gemm<
130
+ cutlass::half_t,
131
+ cutlass::layout::ColumnMajor,
132
+ cutlass::half_t,
133
+ cutlass::layout::ColumnMajor,
134
+ ElementOutput,
135
+ cutlass::layout::ColumnMajor,
136
+ ElementAccumulator,
137
+ cutlass::arch::OpClassWmmaTensorOp,
138
+ cutlass::arch::Sm70,
139
+ cutlass::gemm::GemmShape<64, 64, 32>,
140
+ cutlass::gemm::GemmShape<64, 64, 32>,
141
+ cutlass::gemm::GemmShape<8, 32, 16>,
142
+ cutlass::epilogue::thread::LinearCombination<
143
+ ElementOutput,
144
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
145
+ ElementAccumulator,
146
+ ElementAccumulator
147
+ >,
148
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
149
+ 2
150
+ >;
151
+
152
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
153
+ }
154
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_tensor_op_f32_sm75.cu ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x256x32_64x64x32) {
56
+
57
+ using ElementOutput = cutlass::half_t;
58
+ using ElementAccumulator = float;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm75,
70
+ cutlass::gemm::GemmShape<128, 256, 32>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<16, 8, 8>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x256x32_64x64x32_brief) {
87
+
88
+ using ElementOutput = cutlass::half_t;
89
+ using ElementAccumulator = float;
90
+
91
+ using Gemm = cutlass::gemm::device::Gemm<
92
+ cutlass::half_t,
93
+ cutlass::layout::ColumnMajor,
94
+ cutlass::half_t,
95
+ cutlass::layout::ColumnMajor,
96
+ ElementOutput,
97
+ cutlass::layout::RowMajor,
98
+ ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp,
100
+ cutlass::arch::Sm75,
101
+ cutlass::gemm::GemmShape<128, 256, 32>
102
+ >;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
105
+ }
106
+
107
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x128x32_64x64x32) {
108
+
109
+ using ElementOutput = cutlass::half_t;
110
+ using ElementAccumulator = float;
111
+
112
+ using Gemm = cutlass::gemm::device::Gemm<
113
+ cutlass::half_t,
114
+ cutlass::layout::ColumnMajor,
115
+ cutlass::half_t,
116
+ cutlass::layout::ColumnMajor,
117
+ ElementOutput,
118
+ cutlass::layout::RowMajor,
119
+ ElementAccumulator,
120
+ cutlass::arch::OpClassTensorOp,
121
+ cutlass::arch::Sm75,
122
+ cutlass::gemm::GemmShape<256, 128, 32>,
123
+ cutlass::gemm::GemmShape<64, 64, 32>,
124
+ cutlass::gemm::GemmShape<16, 8, 8>,
125
+ cutlass::epilogue::thread::LinearCombination<
126
+ ElementOutput,
127
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
128
+ ElementAccumulator,
129
+ ElementAccumulator
130
+ >,
131
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
132
+ 2
133
+ >;
134
+
135
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
136
+ }
137
+
138
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x128x32_64x64x32) {
139
+
140
+ using ElementOutput = cutlass::half_t;
141
+ using ElementAccumulator = float;
142
+
143
+ using Gemm = cutlass::gemm::device::Gemm<
144
+ cutlass::half_t,
145
+ cutlass::layout::ColumnMajor,
146
+ cutlass::half_t,
147
+ cutlass::layout::ColumnMajor,
148
+ ElementOutput,
149
+ cutlass::layout::RowMajor,
150
+ ElementAccumulator,
151
+ cutlass::arch::OpClassTensorOp,
152
+ cutlass::arch::Sm75,
153
+ cutlass::gemm::GemmShape<128, 128, 32>,
154
+ cutlass::gemm::GemmShape<64, 64, 32>,
155
+ cutlass::gemm::GemmShape<16, 8, 8>,
156
+ cutlass::epilogue::thread::LinearCombination<
157
+ ElementOutput,
158
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
159
+ ElementAccumulator,
160
+ ElementAccumulator
161
+ >,
162
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
163
+ 2
164
+ >;
165
+
166
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
167
+ }
168
+
169
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x128x32_64x64x32_brief) {
170
+
171
+ using ElementOutput = cutlass::half_t;
172
+ using ElementAccumulator = float;
173
+
174
+ using Gemm = cutlass::gemm::device::Gemm<
175
+ cutlass::half_t,
176
+ cutlass::layout::ColumnMajor,
177
+ cutlass::half_t,
178
+ cutlass::layout::ColumnMajor,
179
+ ElementOutput,
180
+ cutlass::layout::RowMajor,
181
+ ElementAccumulator,
182
+ cutlass::arch::OpClassTensorOp,
183
+ cutlass::arch::Sm75,
184
+ cutlass::gemm::GemmShape<128, 128, 32>
185
+ >;
186
+
187
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
188
+ }
189
+
190
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x128x32_32x64x32) {
191
+
192
+ using ElementOutput = cutlass::half_t;
193
+ using ElementAccumulator = float;
194
+
195
+ using Gemm = cutlass::gemm::device::Gemm<
196
+ cutlass::half_t,
197
+ cutlass::layout::ColumnMajor,
198
+ cutlass::half_t,
199
+ cutlass::layout::ColumnMajor,
200
+ ElementOutput,
201
+ cutlass::layout::RowMajor,
202
+ ElementAccumulator,
203
+ cutlass::arch::OpClassTensorOp,
204
+ cutlass::arch::Sm75,
205
+ cutlass::gemm::GemmShape<64, 128, 32>,
206
+ cutlass::gemm::GemmShape<32, 64, 32>,
207
+ cutlass::gemm::GemmShape<16, 8, 8>,
208
+ cutlass::epilogue::thread::LinearCombination<
209
+ ElementOutput,
210
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
211
+ ElementAccumulator,
212
+ ElementAccumulator
213
+ >,
214
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
215
+ 2
216
+ >;
217
+
218
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
219
+ }
220
+
221
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x128x32_32x64x32_brief) {
222
+
223
+ using ElementOutput = cutlass::half_t;
224
+ using ElementAccumulator = float;
225
+
226
+ using Gemm = cutlass::gemm::device::Gemm<
227
+ cutlass::half_t,
228
+ cutlass::layout::ColumnMajor,
229
+ cutlass::half_t,
230
+ cutlass::layout::ColumnMajor,
231
+ ElementOutput,
232
+ cutlass::layout::RowMajor,
233
+ ElementAccumulator,
234
+ cutlass::arch::OpClassTensorOp,
235
+ cutlass::arch::Sm75,
236
+ cutlass::gemm::GemmShape<64, 128, 32>,
237
+ cutlass::gemm::GemmShape<32, 64, 32>
238
+ >;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
241
+ }
242
+
243
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x64x32_64x32x32) {
244
+
245
+ using ElementOutput = cutlass::half_t;
246
+ using ElementAccumulator = float;
247
+
248
+ using Gemm = cutlass::gemm::device::Gemm<
249
+ cutlass::half_t,
250
+ cutlass::layout::ColumnMajor,
251
+ cutlass::half_t,
252
+ cutlass::layout::ColumnMajor,
253
+ ElementOutput,
254
+ cutlass::layout::RowMajor,
255
+ ElementAccumulator,
256
+ cutlass::arch::OpClassTensorOp,
257
+ cutlass::arch::Sm75,
258
+ cutlass::gemm::GemmShape<128, 64, 32>,
259
+ cutlass::gemm::GemmShape<64, 32, 32>,
260
+ cutlass::gemm::GemmShape<16, 8, 8>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput,
263
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator,
265
+ ElementAccumulator
266
+ >,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
268
+ 2
269
+ >;
270
+
271
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
272
+ }
273
+
274
+ TEST(SM75_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x64x32_32x32x32) {
275
+
276
+ using ElementOutput = cutlass::half_t;
277
+ using ElementAccumulator = float;
278
+
279
+ using Gemm = cutlass::gemm::device::Gemm<
280
+ cutlass::half_t,
281
+ cutlass::layout::ColumnMajor,
282
+ cutlass::half_t,
283
+ cutlass::layout::ColumnMajor,
284
+ ElementOutput,
285
+ cutlass::layout::RowMajor,
286
+ ElementAccumulator,
287
+ cutlass::arch::OpClassTensorOp,
288
+ cutlass::arch::Sm75,
289
+ cutlass::gemm::GemmShape<64, 64, 32>,
290
+ cutlass::gemm::GemmShape<32, 32, 32>,
291
+ cutlass::gemm::GemmShape<16, 8, 8>,
292
+ cutlass::epilogue::thread::LinearCombination<
293
+ ElementOutput,
294
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
295
+ ElementAccumulator,
296
+ ElementAccumulator
297
+ >,
298
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
299
+ 2
300
+ >;
301
+
302
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
303
+ }
304
+
305
+ /////////////////////////////////////////////////////////////////////////////////////////////////
306
+
307
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_tensor_op_f32_sm80.cu ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+
49
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x256x64_64x64x64) {
54
+ using ElementOutput = cutlass::half_t;
55
+ using ElementAccumulator = float;
56
+
57
+ using Gemm = cutlass::gemm::device::Gemm<
58
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
59
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
63
+ cutlass::epilogue::thread::LinearCombination<
64
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
65
+ ElementAccumulator, ElementAccumulator>,
66
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
67
+
68
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
69
+ }
70
+
71
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x128x64_64x64x64) {
72
+ using ElementOutput = cutlass::half_t;
73
+ using ElementAccumulator = float;
74
+
75
+ using Gemm = cutlass::gemm::device::Gemm<
76
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
77
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
78
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
79
+ cutlass::gemm::GemmShape<256, 128, 64>,
80
+ cutlass::gemm::GemmShape<64, 64, 64>,
81
+ cutlass::gemm::GemmShape<16, 8, 16>,
82
+ cutlass::epilogue::thread::LinearCombination<
83
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
84
+ ElementAccumulator, ElementAccumulator>,
85
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
86
+
87
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
88
+ }
89
+
90
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x128x64_64x64x64) {
91
+ using ElementOutput = cutlass::half_t;
92
+ using ElementAccumulator = float;
93
+
94
+ using Gemm = cutlass::gemm::device::Gemm<
95
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
96
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
97
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
98
+ cutlass::gemm::GemmShape<128, 128, 64>,
99
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
100
+ cutlass::epilogue::thread::LinearCombination<
101
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
102
+ ElementAccumulator, ElementAccumulator>,
103
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
104
+
105
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
106
+ }
107
+
108
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x64x64_64x64x64) {
109
+ using ElementOutput = cutlass::half_t;
110
+ using ElementAccumulator = float;
111
+
112
+ using Gemm = cutlass::gemm::device::Gemm<
113
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
114
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
115
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
116
+ cutlass::gemm::GemmShape<256, 64, 64>,
117
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
118
+ cutlass::epilogue::thread::LinearCombination<
119
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
120
+ ElementAccumulator, ElementAccumulator>,
121
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
122
+
123
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
124
+ }
125
+
126
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x256x64_64x64x64) {
127
+ using ElementOutput = cutlass::half_t;
128
+ using ElementAccumulator = float;
129
+
130
+ using Gemm = cutlass::gemm::device::Gemm<
131
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
132
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
133
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
134
+ cutlass::gemm::GemmShape<64, 256, 64>,
135
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
136
+ cutlass::epilogue::thread::LinearCombination<
137
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
138
+ ElementAccumulator, ElementAccumulator>,
139
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
140
+
141
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
142
+ }
143
+
144
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x128x64_32x64x64) {
145
+ using ElementOutput = cutlass::half_t;
146
+ using ElementAccumulator = float;
147
+
148
+ using Gemm = cutlass::gemm::device::Gemm<
149
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
150
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
151
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
152
+ cutlass::gemm::GemmShape<64, 128, 64>,
153
+ cutlass::gemm::GemmShape<32, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
154
+ cutlass::epilogue::thread::LinearCombination<
155
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
156
+ ElementAccumulator, ElementAccumulator>,
157
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
158
+
159
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
160
+ }
161
+
162
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x64x64_64x32x64) {
163
+ using ElementOutput = cutlass::half_t;
164
+ using ElementAccumulator = float;
165
+
166
+ using Gemm = cutlass::gemm::device::Gemm<
167
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
168
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
169
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
170
+ cutlass::gemm::GemmShape<128, 64, 64>,
171
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
172
+ cutlass::epilogue::thread::LinearCombination<
173
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
174
+ ElementAccumulator, ElementAccumulator>,
175
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
176
+
177
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
178
+ }
179
+
180
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x64x64_32x32x64) {
181
+ using ElementOutput = cutlass::half_t;
182
+ using ElementAccumulator = float;
183
+
184
+ using Gemm = cutlass::gemm::device::Gemm<
185
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
186
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
187
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
188
+ cutlass::gemm::GemmShape<64, 64, 64>,
189
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
190
+ cutlass::epilogue::thread::LinearCombination<
191
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
192
+ ElementAccumulator, ElementAccumulator>,
193
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
194
+
195
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
196
+ }
197
+
198
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x256x32_64x64x32) {
199
+ using ElementOutput = cutlass::half_t;
200
+ using ElementAccumulator = float;
201
+
202
+ using Gemm = cutlass::gemm::device::Gemm<
203
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
204
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
205
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
206
+ cutlass::gemm::GemmShape<128, 256, 32>,
207
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
208
+ cutlass::epilogue::thread::LinearCombination<
209
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
210
+ ElementAccumulator, ElementAccumulator>,
211
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
212
+
213
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
214
+ }
215
+
216
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x128x32_64x64x32) {
217
+ using ElementOutput = cutlass::half_t;
218
+ using ElementAccumulator = float;
219
+
220
+ using Gemm = cutlass::gemm::device::Gemm<
221
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
222
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
223
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
224
+ cutlass::gemm::GemmShape<256, 128, 32>,
225
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
226
+ cutlass::epilogue::thread::LinearCombination<
227
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
228
+ ElementAccumulator, ElementAccumulator>,
229
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
230
+
231
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
232
+ }
233
+
234
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x128x32_64x64x32) {
235
+ using ElementOutput = cutlass::half_t;
236
+ using ElementAccumulator = float;
237
+
238
+ using Gemm = cutlass::gemm::device::Gemm<
239
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
240
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
241
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
242
+ cutlass::gemm::GemmShape<128, 128, 32>,
243
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
244
+ cutlass::epilogue::thread::LinearCombination<
245
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
246
+ ElementAccumulator, ElementAccumulator>,
247
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
248
+
249
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
250
+ }
251
+
252
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x64x32_64x64x32) {
253
+ using ElementOutput = cutlass::half_t;
254
+ using ElementAccumulator = float;
255
+
256
+ using Gemm = cutlass::gemm::device::Gemm<
257
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
258
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
259
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
260
+ cutlass::gemm::GemmShape<256, 64, 32>,
261
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
262
+ cutlass::epilogue::thread::LinearCombination<
263
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator, ElementAccumulator>,
265
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
266
+
267
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
268
+ }
269
+
270
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x256x32_64x64x32) {
271
+ using ElementOutput = cutlass::half_t;
272
+ using ElementAccumulator = float;
273
+
274
+ using Gemm = cutlass::gemm::device::Gemm<
275
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
276
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
277
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
278
+ cutlass::gemm::GemmShape<64, 256, 32>,
279
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
280
+ cutlass::epilogue::thread::LinearCombination<
281
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
282
+ ElementAccumulator, ElementAccumulator>,
283
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
284
+
285
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
286
+ }
287
+
288
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x128x32_32x64x32) {
289
+ using ElementOutput = cutlass::half_t;
290
+ using ElementAccumulator = float;
291
+
292
+ using Gemm = cutlass::gemm::device::Gemm<
293
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
294
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
295
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
296
+ cutlass::gemm::GemmShape<64, 128, 32>,
297
+ cutlass::gemm::GemmShape<32, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
298
+ cutlass::epilogue::thread::LinearCombination<
299
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
300
+ ElementAccumulator, ElementAccumulator>,
301
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
302
+
303
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
304
+ }
305
+
306
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x64x32_64x32x32) {
307
+ using ElementOutput = cutlass::half_t;
308
+ using ElementAccumulator = float;
309
+
310
+ using Gemm = cutlass::gemm::device::Gemm<
311
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
312
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
313
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
314
+ cutlass::gemm::GemmShape<128, 64, 32>,
315
+ cutlass::gemm::GemmShape<64, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
316
+ cutlass::epilogue::thread::LinearCombination<
317
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
318
+ ElementAccumulator, ElementAccumulator>,
319
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
320
+
321
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
322
+ }
323
+
324
+ TEST(SM80_Device_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x64x32_32x32x32) {
325
+ using ElementOutput = cutlass::half_t;
326
+ using ElementAccumulator = float;
327
+
328
+ using Gemm = cutlass::gemm::device::Gemm<
329
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
330
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
331
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
332
+ cutlass::gemm::GemmShape<64, 64, 32>,
333
+ cutlass::gemm::GemmShape<32, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
334
+ cutlass::epilogue::thread::LinearCombination<
335
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
336
+ ElementAccumulator, ElementAccumulator>,
337
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
338
+
339
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
340
+ }
341
+
342
+ ////////////////////////////////////////////////////////////////////////////////
343
+
344
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_tensor_op_f32_sparse_sm80.cu ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_sparse.h"
40
+ #include "cutlass/gemm/device/gemm_sparse_row_broadcast.h"
41
+ #include "cutlass/util/host_tensor.h"
42
+ #include "cutlass/util/reference/host/gemm.h"
43
+ #include "cutlass/util/reference/host/tensor_compare.h"
44
+ #include "cutlass/util/reference/host/tensor_copy.h"
45
+ #include "cutlass/util/reference/host/tensor_fill.h"
46
+ #include "cutlass/util/tensor_view_io.h"
47
+
48
+ #include "testbed_sparse.h"
49
+
50
+ #if defined(CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED)
51
+
52
+ ////////////////////////////////////////////////////////////////////////////////
53
+
54
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x256x64_64x64x64) {
55
+ using ElementOutput = cutlass::half_t;
56
+ using ElementAccumulator = float;
57
+
58
+ using Gemm = cutlass::gemm::device::SparseGemm<
59
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
60
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
61
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
62
+ cutlass::gemm::GemmShape<128, 256, 64>,
63
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
64
+ cutlass::epilogue::thread::LinearCombination<
65
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
66
+ ElementAccumulator, ElementAccumulator>,
67
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
68
+
69
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
70
+ }
71
+
72
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x128x64_64x64x64) {
73
+ using ElementOutput = cutlass::half_t;
74
+ using ElementAccumulator = float;
75
+
76
+ using Gemm = cutlass::gemm::device::SparseGemm<
77
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
78
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
79
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
80
+ cutlass::gemm::GemmShape<256, 128, 64>,
81
+ cutlass::gemm::GemmShape<64, 64, 64>,
82
+ cutlass::gemm::GemmShape<16, 8, 32>,
83
+ cutlass::epilogue::thread::LinearCombination<
84
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
85
+ ElementAccumulator, ElementAccumulator>,
86
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
87
+
88
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
89
+ }
90
+
91
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x128x64_64x64x64) {
92
+ using ElementOutput = cutlass::half_t;
93
+ using ElementAccumulator = float;
94
+
95
+ using Gemm = cutlass::gemm::device::SparseGemm<
96
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
97
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
98
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
99
+ cutlass::gemm::GemmShape<128, 128, 64>,
100
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
101
+ cutlass::epilogue::thread::LinearCombination<
102
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
103
+ ElementAccumulator, ElementAccumulator>,
104
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
105
+
106
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
107
+ }
108
+
109
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x64x64_64x64x64) {
110
+ using ElementOutput = cutlass::half_t;
111
+ using ElementAccumulator = float;
112
+
113
+ using Gemm = cutlass::gemm::device::SparseGemm<
114
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
115
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
116
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
117
+ cutlass::gemm::GemmShape<256, 64, 64>,
118
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
119
+ cutlass::epilogue::thread::LinearCombination<
120
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
121
+ ElementAccumulator, ElementAccumulator>,
122
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
123
+
124
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
125
+ }
126
+
127
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x256x64_64x64x64) {
128
+ using ElementOutput = cutlass::half_t;
129
+ using ElementAccumulator = float;
130
+
131
+ using Gemm = cutlass::gemm::device::SparseGemm<
132
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
133
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
134
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
135
+ cutlass::gemm::GemmShape<64, 256, 64>,
136
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
137
+ cutlass::epilogue::thread::LinearCombination<
138
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
139
+ ElementAccumulator, ElementAccumulator>,
140
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
141
+
142
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
143
+ }
144
+
145
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x128x64_32x64x64) {
146
+ using ElementOutput = cutlass::half_t;
147
+ using ElementAccumulator = float;
148
+
149
+ using Gemm = cutlass::gemm::device::SparseGemm<
150
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
151
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
152
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
153
+ cutlass::gemm::GemmShape<64, 128, 64>,
154
+ cutlass::gemm::GemmShape<32, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
155
+ cutlass::epilogue::thread::LinearCombination<
156
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
157
+ ElementAccumulator, ElementAccumulator>,
158
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
159
+
160
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
161
+ }
162
+
163
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x64x64_64x32x64) {
164
+ using ElementOutput = cutlass::half_t;
165
+ using ElementAccumulator = float;
166
+
167
+ using Gemm = cutlass::gemm::device::SparseGemm<
168
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
169
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
170
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
171
+ cutlass::gemm::GemmShape<128, 64, 64>,
172
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
173
+ cutlass::epilogue::thread::LinearCombination<
174
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
175
+ ElementAccumulator, ElementAccumulator>,
176
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
179
+ }
180
+
181
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x64x64_32x32x64) {
182
+ using ElementOutput = cutlass::half_t;
183
+ using ElementAccumulator = float;
184
+
185
+ using Gemm = cutlass::gemm::device::SparseGemm<
186
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
187
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
188
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
189
+ cutlass::gemm::GemmShape<64, 64, 64>,
190
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
191
+ cutlass::epilogue::thread::LinearCombination<
192
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
193
+ ElementAccumulator, ElementAccumulator>,
194
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
195
+
196
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
197
+ }
198
+
199
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x128x128_64x64x128) {
200
+ using ElementOutput = cutlass::half_t;
201
+ using ElementAccumulator = float;
202
+
203
+ using Gemm = cutlass::gemm::device::SparseGemm<
204
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
205
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
206
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
207
+ cutlass::gemm::GemmShape<128, 128, 128>,
208
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
209
+ cutlass::epilogue::thread::LinearCombination<
210
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
211
+ ElementAccumulator, ElementAccumulator>,
212
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
213
+
214
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
215
+ }
216
+
217
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 256x64x128_64x64x128) {
218
+ using ElementOutput = cutlass::half_t;
219
+ using ElementAccumulator = float;
220
+
221
+ using Gemm = cutlass::gemm::device::SparseGemm<
222
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
223
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
224
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
225
+ cutlass::gemm::GemmShape<256, 64, 128>,
226
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
227
+ cutlass::epilogue::thread::LinearCombination<
228
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
229
+ ElementAccumulator, ElementAccumulator>,
230
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
231
+
232
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
233
+ }
234
+
235
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 128x64x128_64x32x128) {
236
+ using ElementOutput = cutlass::half_t;
237
+ using ElementAccumulator = float;
238
+
239
+ using Gemm = cutlass::gemm::device::SparseGemm<
240
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
241
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
242
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
243
+ cutlass::gemm::GemmShape<128, 64, 128>,
244
+ cutlass::gemm::GemmShape<64, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
245
+ cutlass::epilogue::thread::LinearCombination<
246
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
247
+ ElementAccumulator, ElementAccumulator>,
248
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
249
+
250
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
251
+ }
252
+
253
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f16t_tensor_op_f32, 64x64x128_32x32x128) {
254
+ using ElementOutput = cutlass::half_t;
255
+ using ElementAccumulator = float;
256
+
257
+ using Gemm = cutlass::gemm::device::SparseGemm<
258
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
259
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
260
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
261
+ cutlass::gemm::GemmShape<64, 64, 128>,
262
+ cutlass::gemm::GemmShape<32, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
263
+ cutlass::epilogue::thread::LinearCombination<
264
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
265
+ ElementAccumulator, ElementAccumulator>,
266
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
267
+
268
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
269
+ }
270
+
271
+ TEST(SM80_Device_Sparse_Gemm_Row_Broadcast_f16n_f16n_f16t_tensor_op_f32, 64x64x128_32x32x128) {
272
+ using ElementOutput = cutlass::half_t;
273
+ using ElementAccumulator = float;
274
+
275
+ using Gemm = cutlass::gemm::device::SparseGemmRowBroadcast<
276
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
277
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
278
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
279
+ cutlass::gemm::GemmShape<64, 64, 128>,
280
+ cutlass::gemm::GemmShape<32, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
281
+ cutlass::epilogue::thread::LinearCombination<
282
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
283
+ ElementAccumulator, ElementAccumulator>,
284
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
285
+
286
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>(true));
287
+ }
288
+
289
+ ////////////////////////////////////////////////////////////////////////////////
290
+
291
+ #endif // #if defined(CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_volta_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM70_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_volta_tensor_op_f32, 128x256x32_64x64x32) {
56
+
57
+ using ElementOutput = cutlass::half_t;
58
+ using ElementAccumulator = float;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm70,
70
+ cutlass::gemm::GemmShape<128, 256, 32>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<8, 8, 4>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_volta_tensor_op_f32, 256x128x32_64x64x32) {
87
+
88
+ using ElementOutput = cutlass::half_t;
89
+ using ElementAccumulator = float;
90
+
91
+ using Gemm = cutlass::gemm::device::Gemm<
92
+ cutlass::half_t,
93
+ cutlass::layout::ColumnMajor,
94
+ cutlass::half_t,
95
+ cutlass::layout::ColumnMajor,
96
+ ElementOutput,
97
+ cutlass::layout::RowMajor,
98
+ ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp,
100
+ cutlass::arch::Sm70,
101
+ cutlass::gemm::GemmShape<256, 128, 32>,
102
+ cutlass::gemm::GemmShape<64, 64, 32>,
103
+ cutlass::gemm::GemmShape<8, 8, 4>,
104
+ cutlass::epilogue::thread::LinearCombination<
105
+ ElementOutput,
106
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
107
+ ElementAccumulator,
108
+ ElementAccumulator
109
+ >,
110
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
111
+ 2
112
+ >;
113
+
114
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
115
+ }
116
+
117
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_volta_tensor_op_f32, 128x128x32_64x64x32) {
118
+
119
+ using ElementOutput = cutlass::half_t;
120
+ using ElementAccumulator = float;
121
+
122
+ using Gemm = cutlass::gemm::device::Gemm<
123
+ cutlass::half_t,
124
+ cutlass::layout::ColumnMajor,
125
+ cutlass::half_t,
126
+ cutlass::layout::ColumnMajor,
127
+ ElementOutput,
128
+ cutlass::layout::RowMajor,
129
+ ElementAccumulator,
130
+ cutlass::arch::OpClassTensorOp,
131
+ cutlass::arch::Sm70,
132
+ cutlass::gemm::GemmShape<128, 128, 32>,
133
+ cutlass::gemm::GemmShape<64, 64, 32>,
134
+ cutlass::gemm::GemmShape<8, 8, 4>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput,
137
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
138
+ ElementAccumulator,
139
+ ElementAccumulator
140
+ >,
141
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
142
+ 2
143
+ >;
144
+
145
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
146
+ }
147
+
148
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_volta_tensor_op_f32, 128x64x32_64x32x32) {
149
+
150
+ using ElementOutput = cutlass::half_t;
151
+ using ElementAccumulator = float;
152
+
153
+ using Gemm = cutlass::gemm::device::Gemm<
154
+ cutlass::half_t,
155
+ cutlass::layout::ColumnMajor,
156
+ cutlass::half_t,
157
+ cutlass::layout::ColumnMajor,
158
+ ElementOutput,
159
+ cutlass::layout::RowMajor,
160
+ ElementAccumulator,
161
+ cutlass::arch::OpClassTensorOp,
162
+ cutlass::arch::Sm70,
163
+ cutlass::gemm::GemmShape<128, 64, 32>,
164
+ cutlass::gemm::GemmShape<64, 32, 32>,
165
+ cutlass::gemm::GemmShape<8, 8, 4>,
166
+ cutlass::epilogue::thread::LinearCombination<
167
+ ElementOutput,
168
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
169
+ ElementAccumulator,
170
+ ElementAccumulator
171
+ >,
172
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
173
+ 2
174
+ >;
175
+
176
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
177
+ }
178
+
179
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_volta_tensor_op_f32, 64x128x32_32x64x32) {
180
+
181
+ using ElementOutput = cutlass::half_t;
182
+ using ElementAccumulator = float;
183
+
184
+ using Gemm = cutlass::gemm::device::Gemm<
185
+ cutlass::half_t,
186
+ cutlass::layout::ColumnMajor,
187
+ cutlass::half_t,
188
+ cutlass::layout::ColumnMajor,
189
+ ElementOutput,
190
+ cutlass::layout::RowMajor,
191
+ ElementAccumulator,
192
+ cutlass::arch::OpClassTensorOp,
193
+ cutlass::arch::Sm70,
194
+ cutlass::gemm::GemmShape<64, 128, 32>,
195
+ cutlass::gemm::GemmShape<32, 64, 32>,
196
+ cutlass::gemm::GemmShape<8, 8, 4>,
197
+ cutlass::epilogue::thread::LinearCombination<
198
+ ElementOutput,
199
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
200
+ ElementAccumulator,
201
+ ElementAccumulator
202
+ >,
203
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
204
+ 2
205
+ >;
206
+
207
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
208
+ }
209
+
210
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_volta_tensor_op_f32, 64x64x32_64x64x32) {
211
+
212
+ using ElementOutput = cutlass::half_t;
213
+ using ElementAccumulator = float;
214
+
215
+ using Gemm = cutlass::gemm::device::Gemm<
216
+ cutlass::half_t,
217
+ cutlass::layout::ColumnMajor,
218
+ cutlass::half_t,
219
+ cutlass::layout::ColumnMajor,
220
+ ElementOutput,
221
+ cutlass::layout::RowMajor,
222
+ ElementAccumulator,
223
+ cutlass::arch::OpClassTensorOp,
224
+ cutlass::arch::Sm70,
225
+ cutlass::gemm::GemmShape<64, 64, 32>,
226
+ cutlass::gemm::GemmShape<64, 64, 32>,
227
+ cutlass::gemm::GemmShape<8, 8, 4>,
228
+ cutlass::epilogue::thread::LinearCombination<
229
+ ElementOutput,
230
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
231
+ ElementAccumulator,
232
+ ElementAccumulator
233
+ >,
234
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
235
+ 2
236
+ >;
237
+
238
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
239
+ }
240
+
241
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_volta_tensor_op_f32, 64x64x32_32x32x32) {
242
+
243
+ using ElementOutput = cutlass::half_t;
244
+ using ElementAccumulator = float;
245
+
246
+ using Gemm = cutlass::gemm::device::Gemm<
247
+ cutlass::half_t,
248
+ cutlass::layout::ColumnMajor,
249
+ cutlass::half_t,
250
+ cutlass::layout::ColumnMajor,
251
+ ElementOutput,
252
+ cutlass::layout::RowMajor,
253
+ ElementAccumulator,
254
+ cutlass::arch::OpClassTensorOp,
255
+ cutlass::arch::Sm70,
256
+ cutlass::gemm::GemmShape<64, 64, 32>,
257
+ cutlass::gemm::GemmShape<32, 32, 32>,
258
+ cutlass::gemm::GemmShape<8, 8, 4>,
259
+ cutlass::epilogue::thread::LinearCombination<
260
+ ElementOutput,
261
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
262
+ ElementAccumulator,
263
+ ElementAccumulator
264
+ >,
265
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
266
+ 2
267
+ >;
268
+
269
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
270
+ }
271
+
272
+ /////////////////////////////////////////////////////////////////////////////////////////////////
273
+
274
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_wmma_tensor_op_f16_sm70.cu ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F16=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 64x64x32_64x64x32_16x16x16) {
57
+
58
+ using ElementOutput = cutlass::half_t;
59
+ using ElementAccumulator = cutlass::half_t;
60
+
61
+ using Gemm = cutlass::gemm::device::Gemm<
62
+ cutlass::half_t,
63
+ cutlass::layout::ColumnMajor,
64
+ cutlass::half_t,
65
+ cutlass::layout::ColumnMajor,
66
+ ElementOutput,
67
+ cutlass::layout::RowMajor,
68
+ ElementAccumulator,
69
+ cutlass::arch::OpClassWmmaTensorOp,
70
+ cutlass::arch::Sm70,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<64, 64, 32>,
73
+ cutlass::gemm::GemmShape<16, 16, 16>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ ElementOutput,
76
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
77
+ ElementAccumulator,
78
+ ElementAccumulator
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 2
82
+ >;
83
+
84
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
85
+ }
86
+
87
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 64x128x32_64x64x32_16x16x16) {
88
+ // single cta, two warps horizontally
89
+ using ElementOutput = cutlass::half_t;
90
+ using ElementAccumulator = cutlass::half_t;
91
+
92
+ using Gemm = cutlass::gemm::device::Gemm<
93
+ cutlass::half_t,
94
+ cutlass::layout::ColumnMajor,
95
+ cutlass::half_t,
96
+ cutlass::layout::ColumnMajor,
97
+ ElementOutput,
98
+ cutlass::layout::RowMajor,
99
+ ElementAccumulator,
100
+ cutlass::arch::OpClassWmmaTensorOp,
101
+ cutlass::arch::Sm70,
102
+ cutlass::gemm::GemmShape<64, 128, 32>,
103
+ cutlass::gemm::GemmShape<64, 64, 32>,
104
+ cutlass::gemm::GemmShape<16, 16, 16>,
105
+ cutlass::epilogue::thread::LinearCombination<
106
+ ElementOutput,
107
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
108
+ ElementAccumulator,
109
+ ElementAccumulator
110
+ >,
111
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
112
+ 2
113
+ >;
114
+
115
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
116
+ }
117
+
118
+
119
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 128x64x32_64x64x32_16x16x16) {
120
+ // single cta, two warps vertically
121
+ using ElementOutput = cutlass::half_t;
122
+ using ElementAccumulator = cutlass::half_t;
123
+
124
+ using Gemm = cutlass::gemm::device::Gemm<
125
+ cutlass::half_t,
126
+ cutlass::layout::ColumnMajor,
127
+ cutlass::half_t,
128
+ cutlass::layout::ColumnMajor,
129
+ ElementOutput,
130
+ cutlass::layout::RowMajor,
131
+ ElementAccumulator,
132
+ cutlass::arch::OpClassWmmaTensorOp,
133
+ cutlass::arch::Sm70,
134
+ cutlass::gemm::GemmShape<128, 64, 32>,
135
+ cutlass::gemm::GemmShape<64, 64, 32>,
136
+ cutlass::gemm::GemmShape<16, 16, 16>,
137
+ cutlass::epilogue::thread::LinearCombination<
138
+ ElementOutput,
139
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
140
+ ElementAccumulator,
141
+ ElementAccumulator
142
+ >,
143
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
144
+ 2
145
+ >;
146
+
147
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
148
+ }
149
+
150
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 128x128x32_64x64x32_16x16x16) {
151
+ // single cta, two warps horizontally two waprs vertically
152
+ using ElementOutput = cutlass::half_t;
153
+ using ElementAccumulator = cutlass::half_t;
154
+
155
+ using Gemm = cutlass::gemm::device::Gemm<
156
+ cutlass::half_t,
157
+ cutlass::layout::ColumnMajor,
158
+ cutlass::half_t,
159
+ cutlass::layout::ColumnMajor,
160
+ ElementOutput,
161
+ cutlass::layout::RowMajor,
162
+ ElementAccumulator,
163
+ cutlass::arch::OpClassWmmaTensorOp,
164
+ cutlass::arch::Sm70,
165
+ cutlass::gemm::GemmShape<128, 128, 32>,
166
+ cutlass::gemm::GemmShape<64, 64, 32>,
167
+ cutlass::gemm::GemmShape<16, 16, 16>,
168
+ cutlass::epilogue::thread::LinearCombination<
169
+ ElementOutput,
170
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
171
+ ElementAccumulator,
172
+ ElementAccumulator
173
+ >,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
175
+ 2
176
+ >;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
179
+ }
180
+
181
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 128x256x32_64x64x32_16x16x16) {
182
+
183
+ using ElementOutput = cutlass::half_t;
184
+ using ElementAccumulator = cutlass::half_t;
185
+
186
+ using Gemm = cutlass::gemm::device::Gemm<
187
+ cutlass::half_t,
188
+ cutlass::layout::ColumnMajor,
189
+ cutlass::half_t,
190
+ cutlass::layout::ColumnMajor,
191
+ ElementOutput,
192
+ cutlass::layout::RowMajor,
193
+ ElementAccumulator,
194
+ cutlass::arch::OpClassWmmaTensorOp,
195
+ cutlass::arch::Sm70,
196
+ cutlass::gemm::GemmShape<128, 256, 32>,
197
+ cutlass::gemm::GemmShape<64, 64, 32>,
198
+ cutlass::gemm::GemmShape<16, 16, 16>,
199
+ cutlass::epilogue::thread::LinearCombination<
200
+ ElementOutput,
201
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
202
+ ElementAccumulator,
203
+ ElementAccumulator
204
+ >,
205
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
206
+ 2
207
+ >;
208
+
209
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
210
+ }
211
+
212
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 256x128x32_64x64x32_16x16x16) {
213
+
214
+ using ElementOutput = cutlass::half_t;
215
+ using ElementAccumulator = cutlass::half_t;
216
+
217
+ using Gemm = cutlass::gemm::device::Gemm<
218
+ cutlass::half_t,
219
+ cutlass::layout::ColumnMajor,
220
+ cutlass::half_t,
221
+ cutlass::layout::ColumnMajor,
222
+ ElementOutput,
223
+ cutlass::layout::RowMajor,
224
+ ElementAccumulator,
225
+ cutlass::arch::OpClassWmmaTensorOp,
226
+ cutlass::arch::Sm70,
227
+ cutlass::gemm::GemmShape<256, 128, 32>,
228
+ cutlass::gemm::GemmShape<64, 64, 32>,
229
+ cutlass::gemm::GemmShape<16, 16, 16>,
230
+ cutlass::epilogue::thread::LinearCombination<
231
+ ElementOutput,
232
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
233
+ ElementAccumulator,
234
+ ElementAccumulator
235
+ >,
236
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
237
+ 2
238
+ >;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
241
+ }
242
+
243
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 128x64x32_64x32x32_16x16x16) {
244
+
245
+ using ElementOutput = cutlass::half_t;
246
+ using ElementAccumulator = cutlass::half_t;
247
+
248
+ using Gemm = cutlass::gemm::device::Gemm<
249
+ cutlass::half_t,
250
+ cutlass::layout::ColumnMajor,
251
+ cutlass::half_t,
252
+ cutlass::layout::ColumnMajor,
253
+ ElementOutput,
254
+ cutlass::layout::RowMajor,
255
+ ElementAccumulator,
256
+ cutlass::arch::OpClassWmmaTensorOp,
257
+ cutlass::arch::Sm70,
258
+ cutlass::gemm::GemmShape<128, 64, 32>,
259
+ cutlass::gemm::GemmShape<64, 32, 32>,
260
+ cutlass::gemm::GemmShape<16, 16, 16>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput,
263
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator,
265
+ ElementAccumulator
266
+ >,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
268
+ 2
269
+ >;
270
+
271
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
272
+ }
273
+
274
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 64x128x32_32x64x32_16x16x16) {
275
+
276
+ using ElementOutput = cutlass::half_t;
277
+ using ElementAccumulator = cutlass::half_t;
278
+
279
+ using Gemm = cutlass::gemm::device::Gemm<
280
+ cutlass::half_t,
281
+ cutlass::layout::ColumnMajor,
282
+ cutlass::half_t,
283
+ cutlass::layout::ColumnMajor,
284
+ ElementOutput,
285
+ cutlass::layout::RowMajor,
286
+ ElementAccumulator,
287
+ cutlass::arch::OpClassWmmaTensorOp,
288
+ cutlass::arch::Sm70,
289
+ cutlass::gemm::GemmShape<64, 128, 32>,
290
+ cutlass::gemm::GemmShape<32, 64, 32>,
291
+ cutlass::gemm::GemmShape<16, 16, 16>,
292
+ cutlass::epilogue::thread::LinearCombination<
293
+ ElementOutput,
294
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
295
+ ElementAccumulator,
296
+ ElementAccumulator
297
+ >,
298
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
299
+ 2
300
+ >;
301
+
302
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
303
+ }
304
+
305
+
306
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 64x64x32_32x32x32_16x16x16) {
307
+
308
+ using ElementOutput = cutlass::half_t;
309
+ using ElementAccumulator = cutlass::half_t;
310
+
311
+ using Gemm = cutlass::gemm::device::Gemm<
312
+ cutlass::half_t,
313
+ cutlass::layout::ColumnMajor,
314
+ cutlass::half_t,
315
+ cutlass::layout::ColumnMajor,
316
+ ElementOutput,
317
+ cutlass::layout::RowMajor,
318
+ ElementAccumulator,
319
+ cutlass::arch::OpClassWmmaTensorOp,
320
+ cutlass::arch::Sm70,
321
+ cutlass::gemm::GemmShape<64, 64, 32>,
322
+ cutlass::gemm::GemmShape<32, 32, 32>,
323
+ cutlass::gemm::GemmShape<16, 16, 16>,
324
+ cutlass::epilogue::thread::LinearCombination<
325
+ ElementOutput,
326
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
327
+ ElementAccumulator,
328
+ ElementAccumulator
329
+ >,
330
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
331
+ 2
332
+ >;
333
+
334
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
335
+ }
336
+
337
+ /////////////////////////////////////////////////////////////////////////////////////////////////
338
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F16=>F16 //////////
339
+ /////////////////////////////////////////////////////////////////////////////////////////////////
340
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 128x128x32_64x64x32_32x8x16) {
341
+
342
+ using ElementOutput = cutlass::half_t;
343
+ using ElementAccumulator = cutlass::half_t;
344
+
345
+ using Gemm = cutlass::gemm::device::Gemm<
346
+ cutlass::half_t,
347
+ cutlass::layout::ColumnMajor,
348
+ cutlass::half_t,
349
+ cutlass::layout::ColumnMajor,
350
+ ElementOutput,
351
+ cutlass::layout::RowMajor,
352
+ ElementAccumulator,
353
+ cutlass::arch::OpClassWmmaTensorOp,
354
+ cutlass::arch::Sm70,
355
+ cutlass::gemm::GemmShape<128, 128, 32>,
356
+ cutlass::gemm::GemmShape<64, 64, 32>,
357
+ cutlass::gemm::GemmShape<32, 8, 16>,
358
+ cutlass::epilogue::thread::LinearCombination<
359
+ ElementOutput,
360
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
361
+ ElementAccumulator,
362
+ ElementAccumulator
363
+ >,
364
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
365
+ 2
366
+ >;
367
+
368
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
369
+ }
370
+
371
+ /////////////////////////////////////////////////////////////////////////////////////////////////
372
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F16=>F16 //////////
373
+ /////////////////////////////////////////////////////////////////////////////////////////////////
374
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f16, 128x128x32_64x64x32_8x32x16) {
375
+
376
+ using ElementOutput = cutlass::half_t;
377
+ using ElementAccumulator = cutlass::half_t;
378
+
379
+ using Gemm = cutlass::gemm::device::Gemm<
380
+ cutlass::half_t,
381
+ cutlass::layout::ColumnMajor,
382
+ cutlass::half_t,
383
+ cutlass::layout::ColumnMajor,
384
+ ElementOutput,
385
+ cutlass::layout::RowMajor,
386
+ ElementAccumulator,
387
+ cutlass::arch::OpClassWmmaTensorOp,
388
+ cutlass::arch::Sm70,
389
+ cutlass::gemm::GemmShape<128, 128, 32>,
390
+ cutlass::gemm::GemmShape<64, 64, 32>,
391
+ cutlass::gemm::GemmShape<8, 32, 16>,
392
+ cutlass::epilogue::thread::LinearCombination<
393
+ ElementOutput,
394
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
395
+ ElementAccumulator,
396
+ ElementAccumulator
397
+ >,
398
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
399
+ 2
400
+ >;
401
+
402
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
403
+ }
404
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f16t_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 64x64x32_64x64x32_16x16x16) {
57
+
58
+ using ElementOutput = cutlass::half_t;
59
+ using ElementAccumulator = float;
60
+
61
+ using Gemm = cutlass::gemm::device::Gemm<
62
+ cutlass::half_t,
63
+ cutlass::layout::ColumnMajor,
64
+ cutlass::half_t,
65
+ cutlass::layout::ColumnMajor,
66
+ ElementOutput,
67
+ cutlass::layout::RowMajor,
68
+ ElementAccumulator,
69
+ cutlass::arch::OpClassWmmaTensorOp,
70
+ cutlass::arch::Sm70,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<64, 64, 32>,
73
+ cutlass::gemm::GemmShape<16, 16, 16>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ ElementOutput,
76
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
77
+ ElementAccumulator,
78
+ ElementAccumulator
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 2
82
+ >;
83
+
84
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
85
+ }
86
+
87
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 64x128x32_64x64x32_16x16x16) {
88
+ // single cta, two warps horizontally
89
+ using ElementOutput = cutlass::half_t;
90
+ using ElementAccumulator = float;
91
+
92
+ using Gemm = cutlass::gemm::device::Gemm<
93
+ cutlass::half_t,
94
+ cutlass::layout::ColumnMajor,
95
+ cutlass::half_t,
96
+ cutlass::layout::ColumnMajor,
97
+ ElementOutput,
98
+ cutlass::layout::RowMajor,
99
+ ElementAccumulator,
100
+ cutlass::arch::OpClassWmmaTensorOp,
101
+ cutlass::arch::Sm70,
102
+ cutlass::gemm::GemmShape<64, 128, 32>,
103
+ cutlass::gemm::GemmShape<64, 64, 32>,
104
+ cutlass::gemm::GemmShape<16, 16, 16>,
105
+ cutlass::epilogue::thread::LinearCombination<
106
+ ElementOutput,
107
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
108
+ ElementAccumulator,
109
+ ElementAccumulator
110
+ >,
111
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
112
+ 2
113
+ >;
114
+
115
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
116
+ }
117
+
118
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 128x64x32_64x64x32_16x16x16) {
119
+ // single cta, two warps vertically
120
+ using ElementOutput = cutlass::half_t;
121
+ using ElementAccumulator = float;
122
+
123
+ using Gemm = cutlass::gemm::device::Gemm<
124
+ cutlass::half_t,
125
+ cutlass::layout::ColumnMajor,
126
+ cutlass::half_t,
127
+ cutlass::layout::ColumnMajor,
128
+ ElementOutput,
129
+ cutlass::layout::RowMajor,
130
+ ElementAccumulator,
131
+ cutlass::arch::OpClassWmmaTensorOp,
132
+ cutlass::arch::Sm70,
133
+ cutlass::gemm::GemmShape<128, 64, 32>,
134
+ cutlass::gemm::GemmShape<64, 64, 32>,
135
+ cutlass::gemm::GemmShape<16, 16, 16>,
136
+ cutlass::epilogue::thread::LinearCombination<
137
+ ElementOutput,
138
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
139
+ ElementAccumulator,
140
+ ElementAccumulator
141
+ >,
142
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
143
+ 2
144
+ >;
145
+
146
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
147
+ }
148
+
149
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 128x128x32_64x64x32_16x16x16) {
150
+ // single cta, two warps horizontally two waprs vertically
151
+ using ElementOutput = cutlass::half_t;
152
+ using ElementAccumulator = float;
153
+
154
+ using Gemm = cutlass::gemm::device::Gemm<
155
+ cutlass::half_t,
156
+ cutlass::layout::ColumnMajor,
157
+ cutlass::half_t,
158
+ cutlass::layout::ColumnMajor,
159
+ ElementOutput,
160
+ cutlass::layout::RowMajor,
161
+ ElementAccumulator,
162
+ cutlass::arch::OpClassWmmaTensorOp,
163
+ cutlass::arch::Sm70,
164
+ cutlass::gemm::GemmShape<128, 128, 32>,
165
+ cutlass::gemm::GemmShape<64, 64, 32>,
166
+ cutlass::gemm::GemmShape<16, 16, 16>,
167
+ cutlass::epilogue::thread::LinearCombination<
168
+ ElementOutput,
169
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
170
+ ElementAccumulator,
171
+ ElementAccumulator
172
+ >,
173
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
174
+ 2
175
+ >;
176
+
177
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
178
+ }
179
+
180
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 128x256x32_64x64x32_16x16x16) {
181
+
182
+ using ElementOutput = cutlass::half_t;
183
+ using ElementAccumulator = float;
184
+
185
+ using Gemm = cutlass::gemm::device::Gemm<
186
+ cutlass::half_t,
187
+ cutlass::layout::ColumnMajor,
188
+ cutlass::half_t,
189
+ cutlass::layout::ColumnMajor,
190
+ ElementOutput,
191
+ cutlass::layout::RowMajor,
192
+ ElementAccumulator,
193
+ cutlass::arch::OpClassWmmaTensorOp,
194
+ cutlass::arch::Sm70,
195
+ cutlass::gemm::GemmShape<128, 256, 32>,
196
+ cutlass::gemm::GemmShape<64, 64, 32>,
197
+ cutlass::gemm::GemmShape<16, 16, 16>,
198
+ cutlass::epilogue::thread::LinearCombination<
199
+ ElementOutput,
200
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
201
+ ElementAccumulator,
202
+ ElementAccumulator
203
+ >,
204
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
205
+ 2
206
+ >;
207
+
208
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
209
+ }
210
+
211
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 256x128x32_64x64x32_16x16x16) {
212
+
213
+ using ElementOutput = cutlass::half_t;
214
+ using ElementAccumulator = float;
215
+
216
+ using Gemm = cutlass::gemm::device::Gemm<
217
+ cutlass::half_t,
218
+ cutlass::layout::ColumnMajor,
219
+ cutlass::half_t,
220
+ cutlass::layout::ColumnMajor,
221
+ ElementOutput,
222
+ cutlass::layout::RowMajor,
223
+ ElementAccumulator,
224
+ cutlass::arch::OpClassWmmaTensorOp,
225
+ cutlass::arch::Sm70,
226
+ cutlass::gemm::GemmShape<256, 128, 32>,
227
+ cutlass::gemm::GemmShape<64, 64, 32>,
228
+ cutlass::gemm::GemmShape<16, 16, 16>,
229
+ cutlass::epilogue::thread::LinearCombination<
230
+ ElementOutput,
231
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
232
+ ElementAccumulator,
233
+ ElementAccumulator
234
+ >,
235
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
236
+ 2
237
+ >;
238
+
239
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
240
+ }
241
+
242
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 128x64x32_64x32x32_16x16x16) {
243
+
244
+ using ElementOutput = cutlass::half_t;
245
+ using ElementAccumulator = float;
246
+
247
+ using Gemm = cutlass::gemm::device::Gemm<
248
+ cutlass::half_t,
249
+ cutlass::layout::ColumnMajor,
250
+ cutlass::half_t,
251
+ cutlass::layout::ColumnMajor,
252
+ ElementOutput,
253
+ cutlass::layout::RowMajor,
254
+ ElementAccumulator,
255
+ cutlass::arch::OpClassWmmaTensorOp,
256
+ cutlass::arch::Sm70,
257
+ cutlass::gemm::GemmShape<128, 64, 32>,
258
+ cutlass::gemm::GemmShape<64, 32, 32>,
259
+ cutlass::gemm::GemmShape<16, 16, 16>,
260
+ cutlass::epilogue::thread::LinearCombination<
261
+ ElementOutput,
262
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
263
+ ElementAccumulator,
264
+ ElementAccumulator
265
+ >,
266
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
267
+ 2
268
+ >;
269
+
270
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
271
+ }
272
+
273
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 64x128x32_32x64x32_16x16x16) {
274
+
275
+ using ElementOutput = cutlass::half_t;
276
+ using ElementAccumulator = float;
277
+
278
+ using Gemm = cutlass::gemm::device::Gemm<
279
+ cutlass::half_t,
280
+ cutlass::layout::ColumnMajor,
281
+ cutlass::half_t,
282
+ cutlass::layout::ColumnMajor,
283
+ ElementOutput,
284
+ cutlass::layout::RowMajor,
285
+ ElementAccumulator,
286
+ cutlass::arch::OpClassWmmaTensorOp,
287
+ cutlass::arch::Sm70,
288
+ cutlass::gemm::GemmShape<64, 128, 32>,
289
+ cutlass::gemm::GemmShape<32, 64, 32>,
290
+ cutlass::gemm::GemmShape<16, 16, 16>,
291
+ cutlass::epilogue::thread::LinearCombination<
292
+ ElementOutput,
293
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
294
+ ElementAccumulator,
295
+ ElementAccumulator
296
+ >,
297
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
298
+ 2
299
+ >;
300
+
301
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
302
+ }
303
+
304
+
305
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 64x64x32_32x32x32_16x16x16) {
306
+
307
+ using ElementOutput = cutlass::half_t;
308
+ using ElementAccumulator = float;
309
+
310
+ using Gemm = cutlass::gemm::device::Gemm<
311
+ cutlass::half_t,
312
+ cutlass::layout::ColumnMajor,
313
+ cutlass::half_t,
314
+ cutlass::layout::ColumnMajor,
315
+ ElementOutput,
316
+ cutlass::layout::RowMajor,
317
+ ElementAccumulator,
318
+ cutlass::arch::OpClassWmmaTensorOp,
319
+ cutlass::arch::Sm70,
320
+ cutlass::gemm::GemmShape<64, 64, 32>,
321
+ cutlass::gemm::GemmShape<32, 32, 32>,
322
+ cutlass::gemm::GemmShape<16, 16, 16>,
323
+ cutlass::epilogue::thread::LinearCombination<
324
+ ElementOutput,
325
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
326
+ ElementAccumulator,
327
+ ElementAccumulator
328
+ >,
329
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
330
+ 2
331
+ >;
332
+
333
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
334
+ }
335
+
336
+ /////////////////////////////////////////////////////////////////////////////////////////////////
337
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F16=>F16 //////////
338
+ /////////////////////////////////////////////////////////////////////////////////////////////////
339
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 64x64x32_64x64x32_32x8x16) {
340
+
341
+ using ElementOutput = cutlass::half_t;
342
+ using ElementAccumulator = float;
343
+
344
+ using Gemm = cutlass::gemm::device::Gemm<
345
+ cutlass::half_t,
346
+ cutlass::layout::ColumnMajor,
347
+ cutlass::half_t,
348
+ cutlass::layout::ColumnMajor,
349
+ ElementOutput,
350
+ cutlass::layout::RowMajor,
351
+ ElementAccumulator,
352
+ cutlass::arch::OpClassWmmaTensorOp,
353
+ cutlass::arch::Sm70,
354
+ cutlass::gemm::GemmShape<64, 64, 32>,
355
+ cutlass::gemm::GemmShape<64, 64, 32>,
356
+ cutlass::gemm::GemmShape<32, 8, 16>,
357
+ cutlass::epilogue::thread::LinearCombination<
358
+ ElementOutput,
359
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
360
+ ElementAccumulator,
361
+ ElementAccumulator
362
+ >,
363
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
364
+ 2
365
+ >;
366
+
367
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
368
+ }
369
+
370
+ /////////////////////////////////////////////////////////////////////////////////////////////////
371
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F16=>F16 //////////
372
+ /////////////////////////////////////////////////////////////////////////////////////////////////
373
+ TEST(SM70_Device_Gemm_f16n_f16n_f16t_wmma_tensor_op_f32, 64x64x32_64x64x32_8x32x16) {
374
+
375
+ using ElementOutput = cutlass::half_t;
376
+ using ElementAccumulator = float;
377
+
378
+ using Gemm = cutlass::gemm::device::Gemm<
379
+ cutlass::half_t,
380
+ cutlass::layout::ColumnMajor,
381
+ cutlass::half_t,
382
+ cutlass::layout::ColumnMajor,
383
+ ElementOutput,
384
+ cutlass::layout::RowMajor,
385
+ ElementAccumulator,
386
+ cutlass::arch::OpClassWmmaTensorOp,
387
+ cutlass::arch::Sm70,
388
+ cutlass::gemm::GemmShape<64, 64, 32>,
389
+ cutlass::gemm::GemmShape<64, 64, 32>,
390
+ cutlass::gemm::GemmShape<8, 32, 16>,
391
+ cutlass::epilogue::thread::LinearCombination<
392
+ ElementOutput,
393
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
394
+ ElementAccumulator,
395
+ ElementAccumulator
396
+ >,
397
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
398
+ 2
399
+ >;
400
+
401
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
402
+ }
403
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32n_tensor_op_f32_sm75.cu ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x256x32_64x64x32) {
56
+
57
+ using ElementOutput = float;
58
+ using ElementAccumulator = float;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ ElementOutput,
66
+ cutlass::layout::ColumnMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm75,
70
+ cutlass::gemm::GemmShape<128, 256, 32>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<16, 8, 8>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x256x32_64x64x32_brief) {
87
+
88
+ using ElementOutput = float;
89
+ using ElementAccumulator = float;
90
+
91
+ using Gemm = cutlass::gemm::device::Gemm<
92
+ cutlass::half_t,
93
+ cutlass::layout::ColumnMajor,
94
+ cutlass::half_t,
95
+ cutlass::layout::ColumnMajor,
96
+ ElementOutput,
97
+ cutlass::layout::ColumnMajor,
98
+ ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp,
100
+ cutlass::arch::Sm75,
101
+ cutlass::gemm::GemmShape<128, 256, 32>
102
+ >;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
105
+ }
106
+
107
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 256x128x32_64x64x32) {
108
+
109
+ using ElementOutput = float;
110
+ using ElementAccumulator = float;
111
+
112
+ using Gemm = cutlass::gemm::device::Gemm<
113
+ cutlass::half_t,
114
+ cutlass::layout::ColumnMajor,
115
+ cutlass::half_t,
116
+ cutlass::layout::ColumnMajor,
117
+ ElementOutput,
118
+ cutlass::layout::ColumnMajor,
119
+ ElementAccumulator,
120
+ cutlass::arch::OpClassTensorOp,
121
+ cutlass::arch::Sm75,
122
+ cutlass::gemm::GemmShape<256, 128, 32>,
123
+ cutlass::gemm::GemmShape<64, 64, 32>,
124
+ cutlass::gemm::GemmShape<16, 8, 8>,
125
+ cutlass::epilogue::thread::LinearCombination<
126
+ ElementOutput,
127
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
128
+ ElementAccumulator,
129
+ ElementAccumulator
130
+ >,
131
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
132
+ 2
133
+ >;
134
+
135
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
136
+ }
137
+
138
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x128x32_64x64x32) {
139
+
140
+ using ElementOutput = float;
141
+ using ElementAccumulator = float;
142
+
143
+ using Gemm = cutlass::gemm::device::Gemm<
144
+ cutlass::half_t,
145
+ cutlass::layout::ColumnMajor,
146
+ cutlass::half_t,
147
+ cutlass::layout::ColumnMajor,
148
+ ElementOutput,
149
+ cutlass::layout::ColumnMajor,
150
+ ElementAccumulator,
151
+ cutlass::arch::OpClassTensorOp,
152
+ cutlass::arch::Sm75,
153
+ cutlass::gemm::GemmShape<128, 128, 32>,
154
+ cutlass::gemm::GemmShape<64, 64, 32>,
155
+ cutlass::gemm::GemmShape<16, 8, 8>,
156
+ cutlass::epilogue::thread::LinearCombination<
157
+ ElementOutput,
158
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
159
+ ElementAccumulator,
160
+ ElementAccumulator
161
+ >,
162
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
163
+ 2
164
+ >;
165
+
166
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
167
+ }
168
+
169
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x128x32_64x64x32_brief) {
170
+
171
+ using ElementOutput = float;
172
+ using ElementAccumulator = float;
173
+
174
+ using Gemm = cutlass::gemm::device::Gemm<
175
+ cutlass::half_t,
176
+ cutlass::layout::ColumnMajor,
177
+ cutlass::half_t,
178
+ cutlass::layout::ColumnMajor,
179
+ ElementOutput,
180
+ cutlass::layout::ColumnMajor,
181
+ ElementAccumulator,
182
+ cutlass::arch::OpClassTensorOp,
183
+ cutlass::arch::Sm75,
184
+ cutlass::gemm::GemmShape<128, 128, 32>
185
+ >;
186
+
187
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
188
+ }
189
+
190
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x128x32_32x64x32) {
191
+
192
+ using ElementOutput = float;
193
+ using ElementAccumulator = float;
194
+
195
+ using Gemm = cutlass::gemm::device::Gemm<
196
+ cutlass::half_t,
197
+ cutlass::layout::ColumnMajor,
198
+ cutlass::half_t,
199
+ cutlass::layout::ColumnMajor,
200
+ ElementOutput,
201
+ cutlass::layout::ColumnMajor,
202
+ ElementAccumulator,
203
+ cutlass::arch::OpClassTensorOp,
204
+ cutlass::arch::Sm75,
205
+ cutlass::gemm::GemmShape<64, 128, 32>,
206
+ cutlass::gemm::GemmShape<32, 64, 32>,
207
+ cutlass::gemm::GemmShape<16, 8, 8>,
208
+ cutlass::epilogue::thread::LinearCombination<
209
+ ElementOutput,
210
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
211
+ ElementAccumulator,
212
+ ElementAccumulator
213
+ >,
214
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
215
+ 2
216
+ >;
217
+
218
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
219
+ }
220
+
221
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x128x32_32x64x32_brief) {
222
+
223
+ using ElementOutput = float;
224
+ using ElementAccumulator = float;
225
+
226
+ using Gemm = cutlass::gemm::device::Gemm<
227
+ cutlass::half_t,
228
+ cutlass::layout::ColumnMajor,
229
+ cutlass::half_t,
230
+ cutlass::layout::ColumnMajor,
231
+ ElementOutput,
232
+ cutlass::layout::ColumnMajor,
233
+ ElementAccumulator,
234
+ cutlass::arch::OpClassTensorOp,
235
+ cutlass::arch::Sm75,
236
+ cutlass::gemm::GemmShape<64, 128, 32>,
237
+ cutlass::gemm::GemmShape<32, 64, 32>
238
+ >;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
241
+ }
242
+
243
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x64x32_64x32x32) {
244
+
245
+ using ElementOutput = float;
246
+ using ElementAccumulator = float;
247
+
248
+ using Gemm = cutlass::gemm::device::Gemm<
249
+ cutlass::half_t,
250
+ cutlass::layout::ColumnMajor,
251
+ cutlass::half_t,
252
+ cutlass::layout::ColumnMajor,
253
+ ElementOutput,
254
+ cutlass::layout::ColumnMajor,
255
+ ElementAccumulator,
256
+ cutlass::arch::OpClassTensorOp,
257
+ cutlass::arch::Sm75,
258
+ cutlass::gemm::GemmShape<128, 64, 32>,
259
+ cutlass::gemm::GemmShape<64, 32, 32>,
260
+ cutlass::gemm::GemmShape<16, 8, 8>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput,
263
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator,
265
+ ElementAccumulator
266
+ >,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
268
+ 2
269
+ >;
270
+
271
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
272
+ }
273
+
274
+ TEST(SM75_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x64x32_32x32x32) {
275
+
276
+ using ElementOutput = float;
277
+ using ElementAccumulator = float;
278
+
279
+ using Gemm = cutlass::gemm::device::Gemm<
280
+ cutlass::half_t,
281
+ cutlass::layout::ColumnMajor,
282
+ cutlass::half_t,
283
+ cutlass::layout::ColumnMajor,
284
+ ElementOutput,
285
+ cutlass::layout::ColumnMajor,
286
+ ElementAccumulator,
287
+ cutlass::arch::OpClassTensorOp,
288
+ cutlass::arch::Sm75,
289
+ cutlass::gemm::GemmShape<64, 64, 32>,
290
+ cutlass::gemm::GemmShape<32, 32, 32>,
291
+ cutlass::gemm::GemmShape<16, 8, 8>,
292
+ cutlass::epilogue::thread::LinearCombination<
293
+ ElementOutput,
294
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
295
+ ElementAccumulator,
296
+ ElementAccumulator
297
+ >,
298
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
299
+ 2
300
+ >;
301
+
302
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
303
+ }
304
+
305
+ /////////////////////////////////////////////////////////////////////////////////////////////////
306
+
307
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32n_tensor_op_f32_sm80.cu ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+
49
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x256x64_64x64x64) {
54
+ using ElementOutput = float;
55
+ using ElementAccumulator = float;
56
+
57
+ using Gemm = cutlass::gemm::device::Gemm<
58
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
59
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
63
+ cutlass::epilogue::thread::LinearCombination<
64
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
65
+ ElementAccumulator, ElementAccumulator>,
66
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
67
+
68
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
69
+ }
70
+
71
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 256x128x64_64x64x64) {
72
+ using ElementOutput = float;
73
+ using ElementAccumulator = float;
74
+
75
+ using Gemm = cutlass::gemm::device::Gemm<
76
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
77
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
78
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
79
+ cutlass::gemm::GemmShape<256, 128, 64>,
80
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
81
+ cutlass::epilogue::thread::LinearCombination<
82
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
83
+ ElementAccumulator, ElementAccumulator>,
84
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
87
+ }
88
+
89
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x128x64_64x64x64) {
90
+ using ElementOutput = float;
91
+ using ElementAccumulator = float;
92
+
93
+ using Gemm = cutlass::gemm::device::Gemm<
94
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
95
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
96
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
97
+ cutlass::gemm::GemmShape<128, 128, 64>,
98
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
99
+ cutlass::epilogue::thread::LinearCombination<
100
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
101
+ ElementAccumulator, ElementAccumulator>,
102
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
105
+ }
106
+
107
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 256x64x64_64x64x64) {
108
+ using ElementOutput = float;
109
+ using ElementAccumulator = float;
110
+
111
+ using Gemm = cutlass::gemm::device::Gemm<
112
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
113
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
114
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
115
+ cutlass::gemm::GemmShape<256, 64, 64>,
116
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
117
+ cutlass::epilogue::thread::LinearCombination<
118
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
119
+ ElementAccumulator, ElementAccumulator>,
120
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
121
+
122
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
123
+ }
124
+
125
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x256x64_64x64x64) {
126
+ using ElementOutput = float;
127
+ using ElementAccumulator = float;
128
+
129
+ using Gemm = cutlass::gemm::device::Gemm<
130
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
131
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
132
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
133
+ cutlass::gemm::GemmShape<64, 256, 64>,
134
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
137
+ ElementAccumulator, ElementAccumulator>,
138
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
139
+
140
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
141
+ }
142
+
143
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x128x64_32x64x64) {
144
+ using ElementOutput = float;
145
+ using ElementAccumulator = float;
146
+
147
+ using Gemm = cutlass::gemm::device::Gemm<
148
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
149
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
150
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
151
+ cutlass::gemm::GemmShape<64, 128, 64>,
152
+ cutlass::gemm::GemmShape<32, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
153
+ cutlass::epilogue::thread::LinearCombination<
154
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
155
+ ElementAccumulator, ElementAccumulator>,
156
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
157
+
158
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
159
+ }
160
+
161
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x64x64_64x32x64) {
162
+ using ElementOutput = float;
163
+ using ElementAccumulator = float;
164
+
165
+ using Gemm = cutlass::gemm::device::Gemm<
166
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
167
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
168
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
169
+ cutlass::gemm::GemmShape<128, 64, 64>,
170
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
171
+ cutlass::epilogue::thread::LinearCombination<
172
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
173
+ ElementAccumulator, ElementAccumulator>,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
175
+
176
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
177
+ }
178
+
179
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x64x64_32x32x64) {
180
+ using ElementOutput = float;
181
+ using ElementAccumulator = float;
182
+
183
+ using Gemm = cutlass::gemm::device::Gemm<
184
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
185
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
186
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
187
+ cutlass::gemm::GemmShape<64, 64, 64>,
188
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
189
+ cutlass::epilogue::thread::LinearCombination<
190
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
191
+ ElementAccumulator, ElementAccumulator>,
192
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
193
+
194
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
195
+ }
196
+
197
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x256x32_64x64x32) {
198
+ using ElementOutput = float;
199
+ using ElementAccumulator = float;
200
+
201
+ using Gemm = cutlass::gemm::device::Gemm<
202
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
203
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
204
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
205
+ cutlass::gemm::GemmShape<128, 256, 32>,
206
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
207
+ cutlass::epilogue::thread::LinearCombination<
208
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
209
+ ElementAccumulator, ElementAccumulator>,
210
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
211
+
212
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
213
+ }
214
+
215
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 256x128x32_64x64x32) {
216
+ using ElementOutput = float;
217
+ using ElementAccumulator = float;
218
+
219
+ using Gemm = cutlass::gemm::device::Gemm<
220
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
221
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
222
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
223
+ cutlass::gemm::GemmShape<256, 128, 32>,
224
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
225
+ cutlass::epilogue::thread::LinearCombination<
226
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
227
+ ElementAccumulator, ElementAccumulator>,
228
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
229
+
230
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
231
+ }
232
+
233
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x128x32_64x64x32) {
234
+ using ElementOutput = float;
235
+ using ElementAccumulator = float;
236
+
237
+ using Gemm = cutlass::gemm::device::Gemm<
238
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
239
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
240
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
241
+ cutlass::gemm::GemmShape<128, 128, 32>,
242
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
243
+ cutlass::epilogue::thread::LinearCombination<
244
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
245
+ ElementAccumulator, ElementAccumulator>,
246
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
247
+
248
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
249
+ }
250
+
251
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 256x64x32_64x64x32) {
252
+ using ElementOutput = float;
253
+ using ElementAccumulator = float;
254
+
255
+ using Gemm = cutlass::gemm::device::Gemm<
256
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
257
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
258
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
259
+ cutlass::gemm::GemmShape<256, 64, 32>,
260
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
263
+ ElementAccumulator, ElementAccumulator>,
264
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
265
+
266
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
267
+ }
268
+
269
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x256x32_64x64x32) {
270
+ using ElementOutput = float;
271
+ using ElementAccumulator = float;
272
+
273
+ using Gemm = cutlass::gemm::device::Gemm<
274
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
275
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
276
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
277
+ cutlass::gemm::GemmShape<64, 256, 32>,
278
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
279
+ cutlass::epilogue::thread::LinearCombination<
280
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
281
+ ElementAccumulator, ElementAccumulator>,
282
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
283
+
284
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
285
+ }
286
+
287
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x128x32_32x64x32) {
288
+ using ElementOutput = float;
289
+ using ElementAccumulator = float;
290
+
291
+ using Gemm = cutlass::gemm::device::Gemm<
292
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
293
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
294
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
295
+ cutlass::gemm::GemmShape<64, 128, 32>,
296
+ cutlass::gemm::GemmShape<32, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
297
+ cutlass::epilogue::thread::LinearCombination<
298
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
299
+ ElementAccumulator, ElementAccumulator>,
300
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
301
+
302
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
303
+ }
304
+
305
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 128x64x32_64x32x32) {
306
+ using ElementOutput = float;
307
+ using ElementAccumulator = float;
308
+
309
+ using Gemm = cutlass::gemm::device::Gemm<
310
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
311
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
312
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
313
+ cutlass::gemm::GemmShape<128, 64, 32>,
314
+ cutlass::gemm::GemmShape<64, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
315
+ cutlass::epilogue::thread::LinearCombination<
316
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
317
+ ElementAccumulator, ElementAccumulator>,
318
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
319
+
320
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
321
+ }
322
+
323
+ TEST(SM80_Device_Gemm_f16n_f16n_f32n_tensor_op_f32, 64x64x32_32x32x32) {
324
+ using ElementOutput = float;
325
+ using ElementAccumulator = float;
326
+
327
+ using Gemm = cutlass::gemm::device::Gemm<
328
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
329
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::ColumnMajor,
330
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
331
+ cutlass::gemm::GemmShape<64, 64, 32>,
332
+ cutlass::gemm::GemmShape<32, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
333
+ cutlass::epilogue::thread::LinearCombination<
334
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
335
+ ElementAccumulator, ElementAccumulator>,
336
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
337
+
338
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
339
+ }
340
+
341
+ ////////////////////////////////////////////////////////////////////////////////
342
+
343
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32n_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include "cutlass/arch/wmma.h"
36
+
37
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
38
+ #include <iostream>
39
+
40
+ #include "cutlass/cutlass.h"
41
+ #include "cutlass/gemm/device/gemm.h"
42
+
43
+ #include "../../common/cutlass_unit_test.h"
44
+
45
+ #include "cutlass/util/host_tensor.h"
46
+ #include "cutlass/util/tensor_view_io.h"
47
+ #include "cutlass/util/reference/host/tensor_fill.h"
48
+ #include "cutlass/util/reference/host/tensor_copy.h"
49
+ #include "cutlass/util/reference/host/tensor_compare.h"
50
+ #include "cutlass/util/reference/host/gemm.h"
51
+
52
+ #include "testbed.h"
53
+
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F32 //////////
56
+ /////////////////////////////////////////////////////////////////////////////////////////////////
57
+
58
+ TEST(SM70_Device_Gemm_f16n_f16n_f32n_wmma_tensor_op_f32, 256x128x32_64x64x32_16x16x16) {
59
+
60
+ using ElementOutput = float;
61
+ using ElementAccumulator = float;
62
+
63
+ using Gemm = cutlass::gemm::device::Gemm<
64
+ cutlass::half_t,
65
+ cutlass::layout::ColumnMajor,
66
+ cutlass::half_t,
67
+ cutlass::layout::ColumnMajor,
68
+ ElementOutput,
69
+ cutlass::layout::ColumnMajor,
70
+ ElementAccumulator,
71
+ cutlass::arch::OpClassWmmaTensorOp,
72
+ cutlass::arch::Sm70,
73
+ cutlass::gemm::GemmShape<256, 128, 32>,
74
+ cutlass::gemm::GemmShape<64, 64, 32>,
75
+ cutlass::gemm::GemmShape<16, 16, 16>,
76
+ cutlass::epilogue::thread::LinearCombination<
77
+ ElementOutput,
78
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
79
+ ElementAccumulator,
80
+ ElementAccumulator
81
+ >,
82
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
83
+ 2
84
+ >;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
87
+ }
88
+
89
+
90
+ /////////////////////////////////////////////////////////////////////////////////////////////////
91
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F32=>F32 //////////
92
+ /////////////////////////////////////////////////////////////////////////////////////////////////
93
+ TEST(SM70_Device_Gemm_f16n_f16n_f32n_wmma_tensor_op_f32, 128x128x32_64x64x32_32x8x16) {
94
+
95
+ using ElementOutput = float;
96
+ using ElementAccumulator = float;
97
+
98
+ using Gemm = cutlass::gemm::device::Gemm<
99
+ cutlass::half_t,
100
+ cutlass::layout::ColumnMajor,
101
+ cutlass::half_t,
102
+ cutlass::layout::ColumnMajor,
103
+ ElementOutput,
104
+ cutlass::layout::ColumnMajor,
105
+ ElementAccumulator,
106
+ cutlass::arch::OpClassWmmaTensorOp,
107
+ cutlass::arch::Sm70,
108
+ cutlass::gemm::GemmShape<128, 128, 32>,
109
+ cutlass::gemm::GemmShape<64, 64, 32>,
110
+ cutlass::gemm::GemmShape<32, 8, 16>,
111
+ cutlass::epilogue::thread::LinearCombination<
112
+ ElementOutput,
113
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
114
+ ElementAccumulator,
115
+ ElementAccumulator
116
+ >,
117
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
118
+ 2
119
+ >;
120
+
121
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
122
+ }
123
+
124
+ /////////////////////////////////////////////////////////////////////////////////////////////////
125
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F32=>F32 //////////
126
+ /////////////////////////////////////////////////////////////////////////////////////////////////
127
+ TEST(SM70_Device_Gemm_f16n_f16n_f32n_wmma_tensor_op_f32, 128x128x32_64x64x32_8x32x16) {
128
+
129
+ using ElementOutput = float;
130
+ using ElementAccumulator = float;
131
+
132
+ using Gemm = cutlass::gemm::device::Gemm<
133
+ cutlass::half_t,
134
+ cutlass::layout::ColumnMajor,
135
+ cutlass::half_t,
136
+ cutlass::layout::ColumnMajor,
137
+ ElementOutput,
138
+ cutlass::layout::ColumnMajor,
139
+ ElementAccumulator,
140
+ cutlass::arch::OpClassWmmaTensorOp,
141
+ cutlass::arch::Sm70,
142
+ cutlass::gemm::GemmShape<128, 128, 32>,
143
+ cutlass::gemm::GemmShape<64, 64, 32>,
144
+ cutlass::gemm::GemmShape<8, 32, 16>,
145
+ cutlass::epilogue::thread::LinearCombination<
146
+ ElementOutput,
147
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
148
+ ElementAccumulator,
149
+ ElementAccumulator
150
+ >,
151
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
152
+ 2
153
+ >;
154
+
155
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
156
+ }
157
+ /////////////////////////////////////////////////////////////////////////////////////////////////
158
+
159
+ #endif // CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_tensor_op_f32_sm75.cu ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x256x32_64x64x32) {
56
+
57
+ using ElementOutput = float;
58
+ using ElementAccumulator = float;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm75,
70
+ cutlass::gemm::GemmShape<128, 256, 32>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<16, 8, 8>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x256x32_64x64x32_brief) {
87
+
88
+ using ElementOutput = float;
89
+ using ElementAccumulator = float;
90
+
91
+ using Gemm = cutlass::gemm::device::Gemm<
92
+ cutlass::half_t,
93
+ cutlass::layout::ColumnMajor,
94
+ cutlass::half_t,
95
+ cutlass::layout::ColumnMajor,
96
+ ElementOutput,
97
+ cutlass::layout::RowMajor,
98
+ ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp,
100
+ cutlass::arch::Sm75,
101
+ cutlass::gemm::GemmShape<128, 256, 32>
102
+ >;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
105
+ }
106
+
107
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x128x32_64x64x32) {
108
+
109
+ using ElementOutput = float;
110
+ using ElementAccumulator = float;
111
+
112
+ using Gemm = cutlass::gemm::device::Gemm<
113
+ cutlass::half_t,
114
+ cutlass::layout::ColumnMajor,
115
+ cutlass::half_t,
116
+ cutlass::layout::ColumnMajor,
117
+ ElementOutput,
118
+ cutlass::layout::RowMajor,
119
+ ElementAccumulator,
120
+ cutlass::arch::OpClassTensorOp,
121
+ cutlass::arch::Sm75,
122
+ cutlass::gemm::GemmShape<256, 128, 32>,
123
+ cutlass::gemm::GemmShape<64, 64, 32>,
124
+ cutlass::gemm::GemmShape<16, 8, 8>,
125
+ cutlass::epilogue::thread::LinearCombination<
126
+ ElementOutput,
127
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
128
+ ElementAccumulator,
129
+ ElementAccumulator
130
+ >,
131
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
132
+ 2
133
+ >;
134
+
135
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
136
+ }
137
+
138
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x128x32_64x64x32) {
139
+
140
+ using ElementOutput = float;
141
+ using ElementAccumulator = float;
142
+
143
+ using Gemm = cutlass::gemm::device::Gemm<
144
+ cutlass::half_t,
145
+ cutlass::layout::ColumnMajor,
146
+ cutlass::half_t,
147
+ cutlass::layout::ColumnMajor,
148
+ ElementOutput,
149
+ cutlass::layout::RowMajor,
150
+ ElementAccumulator,
151
+ cutlass::arch::OpClassTensorOp,
152
+ cutlass::arch::Sm75,
153
+ cutlass::gemm::GemmShape<128, 128, 32>,
154
+ cutlass::gemm::GemmShape<64, 64, 32>,
155
+ cutlass::gemm::GemmShape<16, 8, 8>,
156
+ cutlass::epilogue::thread::LinearCombination<
157
+ ElementOutput,
158
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
159
+ ElementAccumulator,
160
+ ElementAccumulator
161
+ >,
162
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
163
+ 2
164
+ >;
165
+
166
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
167
+ }
168
+
169
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x128x32_64x64x32_brief) {
170
+
171
+ using ElementOutput = float;
172
+ using ElementAccumulator = float;
173
+
174
+ using Gemm = cutlass::gemm::device::Gemm<
175
+ cutlass::half_t,
176
+ cutlass::layout::ColumnMajor,
177
+ cutlass::half_t,
178
+ cutlass::layout::ColumnMajor,
179
+ ElementOutput,
180
+ cutlass::layout::RowMajor,
181
+ ElementAccumulator,
182
+ cutlass::arch::OpClassTensorOp,
183
+ cutlass::arch::Sm75,
184
+ cutlass::gemm::GemmShape<128, 128, 32>
185
+ >;
186
+
187
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
188
+ }
189
+
190
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x128x32_32x64x32) {
191
+
192
+ using ElementOutput = float;
193
+ using ElementAccumulator = float;
194
+
195
+ using Gemm = cutlass::gemm::device::Gemm<
196
+ cutlass::half_t,
197
+ cutlass::layout::ColumnMajor,
198
+ cutlass::half_t,
199
+ cutlass::layout::ColumnMajor,
200
+ ElementOutput,
201
+ cutlass::layout::RowMajor,
202
+ ElementAccumulator,
203
+ cutlass::arch::OpClassTensorOp,
204
+ cutlass::arch::Sm75,
205
+ cutlass::gemm::GemmShape<64, 128, 32>,
206
+ cutlass::gemm::GemmShape<32, 64, 32>,
207
+ cutlass::gemm::GemmShape<16, 8, 8>,
208
+ cutlass::epilogue::thread::LinearCombination<
209
+ ElementOutput,
210
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
211
+ ElementAccumulator,
212
+ ElementAccumulator
213
+ >,
214
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
215
+ 2
216
+ >;
217
+
218
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
219
+ }
220
+
221
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x128x32_32x64x32_brief) {
222
+
223
+ using ElementOutput = float;
224
+ using ElementAccumulator = float;
225
+
226
+ using Gemm = cutlass::gemm::device::Gemm<
227
+ cutlass::half_t,
228
+ cutlass::layout::ColumnMajor,
229
+ cutlass::half_t,
230
+ cutlass::layout::ColumnMajor,
231
+ ElementOutput,
232
+ cutlass::layout::RowMajor,
233
+ ElementAccumulator,
234
+ cutlass::arch::OpClassTensorOp,
235
+ cutlass::arch::Sm75,
236
+ cutlass::gemm::GemmShape<64, 128, 32>,
237
+ cutlass::gemm::GemmShape<32, 64, 32>
238
+ >;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
241
+ }
242
+
243
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x64x32_64x32x32) {
244
+
245
+ using ElementOutput = float;
246
+ using ElementAccumulator = float;
247
+
248
+ using Gemm = cutlass::gemm::device::Gemm<
249
+ cutlass::half_t,
250
+ cutlass::layout::ColumnMajor,
251
+ cutlass::half_t,
252
+ cutlass::layout::ColumnMajor,
253
+ ElementOutput,
254
+ cutlass::layout::RowMajor,
255
+ ElementAccumulator,
256
+ cutlass::arch::OpClassTensorOp,
257
+ cutlass::arch::Sm75,
258
+ cutlass::gemm::GemmShape<128, 64, 32>,
259
+ cutlass::gemm::GemmShape<64, 32, 32>,
260
+ cutlass::gemm::GemmShape<16, 8, 8>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput,
263
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator,
265
+ ElementAccumulator
266
+ >,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
268
+ 2
269
+ >;
270
+
271
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
272
+ }
273
+
274
+ TEST(SM75_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x64x32_32x32x32) {
275
+
276
+ using ElementOutput = float;
277
+ using ElementAccumulator = float;
278
+
279
+ using Gemm = cutlass::gemm::device::Gemm<
280
+ cutlass::half_t,
281
+ cutlass::layout::ColumnMajor,
282
+ cutlass::half_t,
283
+ cutlass::layout::ColumnMajor,
284
+ ElementOutput,
285
+ cutlass::layout::RowMajor,
286
+ ElementAccumulator,
287
+ cutlass::arch::OpClassTensorOp,
288
+ cutlass::arch::Sm75,
289
+ cutlass::gemm::GemmShape<64, 64, 32>,
290
+ cutlass::gemm::GemmShape<32, 32, 32>,
291
+ cutlass::gemm::GemmShape<16, 8, 8>,
292
+ cutlass::epilogue::thread::LinearCombination<
293
+ ElementOutput,
294
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
295
+ ElementAccumulator,
296
+ ElementAccumulator
297
+ >,
298
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
299
+ 2
300
+ >;
301
+
302
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
303
+ }
304
+
305
+ /////////////////////////////////////////////////////////////////////////////////////////////////
306
+
307
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_tensor_op_f32_sm80.cu ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+
49
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x256x64_64x64x64, {
54
+ using ElementOutput = float;
55
+ using ElementAccumulator = float;
56
+
57
+ using Gemm = cutlass::gemm::device::Gemm<
58
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
59
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>,
63
+ cutlass::gemm::GemmShape<16, 8, 16>,
64
+ cutlass::epilogue::thread::LinearCombination<
65
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
66
+ ElementAccumulator, ElementAccumulator>,
67
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
68
+
69
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
70
+ } )
71
+
72
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x128x64_64x64x64, {
73
+ using ElementOutput = float;
74
+ using ElementAccumulator = float;
75
+
76
+ using Gemm = cutlass::gemm::device::Gemm<
77
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
78
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
79
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
80
+ cutlass::gemm::GemmShape<256, 128, 64>,
81
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
82
+ cutlass::epilogue::thread::LinearCombination<
83
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
84
+ ElementAccumulator, ElementAccumulator>,
85
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
86
+
87
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
88
+ } )
89
+
90
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x128x64_64x64x64, {
91
+ using ElementOutput = float;
92
+ using ElementAccumulator = float;
93
+
94
+ using Gemm = cutlass::gemm::device::Gemm<
95
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
96
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
97
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
98
+ cutlass::gemm::GemmShape<128, 128, 64>,
99
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
100
+ cutlass::epilogue::thread::LinearCombination<
101
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
102
+ ElementAccumulator, ElementAccumulator>,
103
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
104
+
105
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
106
+ } )
107
+
108
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x64x64_64x64x64, {
109
+ using ElementOutput = float;
110
+ using ElementAccumulator = float;
111
+
112
+ using Gemm = cutlass::gemm::device::Gemm<
113
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
114
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
115
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
116
+ cutlass::gemm::GemmShape<256, 64, 64>,
117
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
118
+ cutlass::epilogue::thread::LinearCombination<
119
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
120
+ ElementAccumulator, ElementAccumulator>,
121
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
122
+
123
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
124
+ } )
125
+
126
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x256x64_64x64x64, {
127
+ using ElementOutput = float;
128
+ using ElementAccumulator = float;
129
+
130
+ using Gemm = cutlass::gemm::device::Gemm<
131
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
132
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
133
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
134
+ cutlass::gemm::GemmShape<64, 256, 64>,
135
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
136
+ cutlass::epilogue::thread::LinearCombination<
137
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
138
+ ElementAccumulator, ElementAccumulator>,
139
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
140
+
141
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
142
+ } )
143
+
144
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x128x64_32x64x64, {
145
+ using ElementOutput = float;
146
+ using ElementAccumulator = float;
147
+
148
+ using Gemm = cutlass::gemm::device::Gemm<
149
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
150
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
151
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
152
+ cutlass::gemm::GemmShape<64, 128, 64>,
153
+ cutlass::gemm::GemmShape<32, 64, 64>,
154
+ cutlass::gemm::GemmShape<16, 8, 16>,
155
+ cutlass::epilogue::thread::LinearCombination<
156
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
157
+ ElementAccumulator, ElementAccumulator>,
158
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
159
+
160
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
161
+ } )
162
+
163
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x64x64_64x32x64, {
164
+ using ElementOutput = float;
165
+ using ElementAccumulator = float;
166
+
167
+ using Gemm = cutlass::gemm::device::Gemm<
168
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
169
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
170
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
171
+ cutlass::gemm::GemmShape<128, 64, 64>,
172
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
173
+ cutlass::epilogue::thread::LinearCombination<
174
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
175
+ ElementAccumulator, ElementAccumulator>,
176
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
179
+ } )
180
+
181
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x64x64_32x32x64, {
182
+ using ElementOutput = float;
183
+ using ElementAccumulator = float;
184
+
185
+ using Gemm = cutlass::gemm::device::Gemm<
186
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
187
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
188
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
189
+ cutlass::gemm::GemmShape<64, 64, 64>,
190
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
191
+ cutlass::epilogue::thread::LinearCombination<
192
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
193
+ ElementAccumulator, ElementAccumulator>,
194
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
195
+
196
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
197
+ } )
198
+
199
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x256x32_64x64x32, {
200
+ using ElementOutput = float;
201
+ using ElementAccumulator = float;
202
+
203
+ using Gemm = cutlass::gemm::device::Gemm<
204
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
205
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
206
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
207
+ cutlass::gemm::GemmShape<128, 256, 32>,
208
+ cutlass::gemm::GemmShape<64, 64, 32>,
209
+ cutlass::gemm::GemmShape<16, 8, 16>,
210
+ cutlass::epilogue::thread::LinearCombination<
211
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
212
+ ElementAccumulator, ElementAccumulator>,
213
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
214
+
215
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
216
+ } )
217
+
218
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x128x32_64x64x32, {
219
+ using ElementOutput = float;
220
+ using ElementAccumulator = float;
221
+
222
+ using Gemm = cutlass::gemm::device::Gemm<
223
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
224
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
225
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
226
+ cutlass::gemm::GemmShape<256, 128, 32>,
227
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
228
+ cutlass::epilogue::thread::LinearCombination<
229
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
230
+ ElementAccumulator, ElementAccumulator>,
231
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
232
+
233
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
234
+ } )
235
+
236
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x128x32_64x64x32, {
237
+ using ElementOutput = float;
238
+ using ElementAccumulator = float;
239
+
240
+ using Gemm = cutlass::gemm::device::Gemm<
241
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
242
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
243
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
244
+ cutlass::gemm::GemmShape<128, 128, 32>,
245
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
246
+ cutlass::epilogue::thread::LinearCombination<
247
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
248
+ ElementAccumulator, ElementAccumulator>,
249
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
250
+
251
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
252
+ } )
253
+
254
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x64x32_64x64x32, {
255
+ using ElementOutput = float;
256
+ using ElementAccumulator = float;
257
+
258
+ using Gemm = cutlass::gemm::device::Gemm<
259
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
260
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
261
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
262
+ cutlass::gemm::GemmShape<256, 64, 32>,
263
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
264
+ cutlass::epilogue::thread::LinearCombination<
265
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
266
+ ElementAccumulator, ElementAccumulator>,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
268
+
269
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
270
+ } )
271
+
272
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x256x32_64x64x32, {
273
+ using ElementOutput = float;
274
+ using ElementAccumulator = float;
275
+
276
+ using Gemm = cutlass::gemm::device::Gemm<
277
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
278
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
279
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
280
+ cutlass::gemm::GemmShape<64, 256, 32>,
281
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
282
+ cutlass::epilogue::thread::LinearCombination<
283
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
284
+ ElementAccumulator, ElementAccumulator>,
285
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
286
+
287
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
288
+ } )
289
+
290
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x128x32_32x64x32, {
291
+ using ElementOutput = float;
292
+ using ElementAccumulator = float;
293
+
294
+ using Gemm = cutlass::gemm::device::Gemm<
295
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
296
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
297
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
298
+ cutlass::gemm::GemmShape<64, 128, 32>,
299
+ cutlass::gemm::GemmShape<32, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
300
+ cutlass::epilogue::thread::LinearCombination<
301
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
302
+ ElementAccumulator, ElementAccumulator>,
303
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
304
+
305
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
306
+ } )
307
+
308
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x64x32_64x32x32, {
309
+ using ElementOutput = float;
310
+ using ElementAccumulator = float;
311
+
312
+ using Gemm = cutlass::gemm::device::Gemm<
313
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
314
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
315
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
316
+ cutlass::gemm::GemmShape<128, 64, 32>,
317
+ cutlass::gemm::GemmShape<64, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
318
+ cutlass::epilogue::thread::LinearCombination<
319
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
320
+ ElementAccumulator, ElementAccumulator>,
321
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
322
+
323
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
324
+ } )
325
+
326
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x64x32_32x32x32, {
327
+ using ElementOutput = float;
328
+ using ElementAccumulator = float;
329
+
330
+ using Gemm = cutlass::gemm::device::Gemm<
331
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
332
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
333
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
334
+ cutlass::gemm::GemmShape<64, 64, 32>,
335
+ cutlass::gemm::GemmShape<32, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
336
+ cutlass::epilogue::thread::LinearCombination<
337
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
338
+ ElementAccumulator, ElementAccumulator>,
339
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
340
+
341
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
342
+ } )
343
+
344
+ ////////////////////////////////////////////////////////////////////////////////
345
+
346
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_tensor_op_f32_sparse_sm80.cu ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_sparse.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed_sparse.h"
48
+
49
+ #if defined(CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x256x64_64x64x64) {
54
+ using ElementOutput = float;
55
+ using ElementAccumulator = float;
56
+
57
+ using Gemm = cutlass::gemm::device::SparseGemm<
58
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
59
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>,
63
+ cutlass::gemm::GemmShape<16, 8, 32>,
64
+ cutlass::epilogue::thread::LinearCombination<
65
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
66
+ ElementAccumulator, ElementAccumulator>,
67
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
68
+
69
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
70
+ }
71
+
72
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x128x64_64x64x64) {
73
+ using ElementOutput = float;
74
+ using ElementAccumulator = float;
75
+
76
+ using Gemm = cutlass::gemm::device::SparseGemm<
77
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
78
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
79
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
80
+ cutlass::gemm::GemmShape<256, 128, 64>,
81
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
82
+ cutlass::epilogue::thread::LinearCombination<
83
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
84
+ ElementAccumulator, ElementAccumulator>,
85
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
86
+
87
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
88
+ }
89
+
90
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x128x64_64x64x64) {
91
+ using ElementOutput = float;
92
+ using ElementAccumulator = float;
93
+
94
+ using Gemm = cutlass::gemm::device::SparseGemm<
95
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
96
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
97
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
98
+ cutlass::gemm::GemmShape<128, 128, 64>,
99
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
100
+ cutlass::epilogue::thread::LinearCombination<
101
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
102
+ ElementAccumulator, ElementAccumulator>,
103
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
104
+
105
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
106
+ }
107
+
108
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x64x64_64x64x64) {
109
+ using ElementOutput = float;
110
+ using ElementAccumulator = float;
111
+
112
+ using Gemm = cutlass::gemm::device::SparseGemm<
113
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
114
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
115
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
116
+ cutlass::gemm::GemmShape<256, 64, 64>,
117
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
118
+ cutlass::epilogue::thread::LinearCombination<
119
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
120
+ ElementAccumulator, ElementAccumulator>,
121
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
122
+
123
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
124
+ }
125
+
126
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x256x64_64x64x64) {
127
+ using ElementOutput = float;
128
+ using ElementAccumulator = float;
129
+
130
+ using Gemm = cutlass::gemm::device::SparseGemm<
131
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
132
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
133
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
134
+ cutlass::gemm::GemmShape<64, 256, 64>,
135
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
136
+ cutlass::epilogue::thread::LinearCombination<
137
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
138
+ ElementAccumulator, ElementAccumulator>,
139
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
140
+
141
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
142
+ }
143
+
144
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x128x64_32x64x64) {
145
+ using ElementOutput = float;
146
+ using ElementAccumulator = float;
147
+
148
+ using Gemm = cutlass::gemm::device::SparseGemm<
149
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
150
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
151
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
152
+ cutlass::gemm::GemmShape<64, 128, 64>,
153
+ cutlass::gemm::GemmShape<32, 64, 64>,
154
+ cutlass::gemm::GemmShape<16, 8, 32>,
155
+ cutlass::epilogue::thread::LinearCombination<
156
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
157
+ ElementAccumulator, ElementAccumulator>,
158
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
159
+
160
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
161
+ }
162
+
163
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x64x64_64x32x64) {
164
+ using ElementOutput = float;
165
+ using ElementAccumulator = float;
166
+
167
+ using Gemm = cutlass::gemm::device::SparseGemm<
168
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
169
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
170
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
171
+ cutlass::gemm::GemmShape<128, 64, 64>,
172
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
173
+ cutlass::epilogue::thread::LinearCombination<
174
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
175
+ ElementAccumulator, ElementAccumulator>,
176
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
179
+ }
180
+
181
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x64x64_32x32x64) {
182
+ using ElementOutput = float;
183
+ using ElementAccumulator = float;
184
+
185
+ using Gemm = cutlass::gemm::device::SparseGemm<
186
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
187
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
188
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
189
+ cutlass::gemm::GemmShape<64, 64, 64>,
190
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
191
+ cutlass::epilogue::thread::LinearCombination<
192
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
193
+ ElementAccumulator, ElementAccumulator>,
194
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
195
+
196
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
197
+ }
198
+
199
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x128x128_64x64x128) {
200
+ using ElementOutput = float;
201
+ using ElementAccumulator = float;
202
+
203
+ using Gemm = cutlass::gemm::device::SparseGemm<
204
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
205
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
206
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
207
+ cutlass::gemm::GemmShape<128, 128, 128>,
208
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
209
+ cutlass::epilogue::thread::LinearCombination<
210
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
211
+ ElementAccumulator, ElementAccumulator>,
212
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
213
+
214
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
215
+ }
216
+
217
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 256x64x128_64x64x128) {
218
+ using ElementOutput = float;
219
+ using ElementAccumulator = float;
220
+
221
+ using Gemm = cutlass::gemm::device::SparseGemm<
222
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
223
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
224
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
225
+ cutlass::gemm::GemmShape<256, 64, 128>,
226
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
227
+ cutlass::epilogue::thread::LinearCombination<
228
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
229
+ ElementAccumulator, ElementAccumulator>,
230
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
231
+
232
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
233
+ }
234
+
235
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 128x64x128_64x32x128) {
236
+ using ElementOutput = float;
237
+ using ElementAccumulator = float;
238
+
239
+ using Gemm = cutlass::gemm::device::SparseGemm<
240
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
241
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
242
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
243
+ cutlass::gemm::GemmShape<128, 64, 128>,
244
+ cutlass::gemm::GemmShape<64, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
245
+ cutlass::epilogue::thread::LinearCombination<
246
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
247
+ ElementAccumulator, ElementAccumulator>,
248
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
249
+
250
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
251
+ }
252
+
253
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16n_f32t_tensor_op_f32, 64x64x128_32x32x128) {
254
+ using ElementOutput = float;
255
+ using ElementAccumulator = float;
256
+
257
+ using Gemm = cutlass::gemm::device::SparseGemm<
258
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
259
+ cutlass::layout::ColumnMajor, ElementOutput, cutlass::layout::RowMajor,
260
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
261
+ cutlass::gemm::GemmShape<64, 64, 128>,
262
+ cutlass::gemm::GemmShape<32, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
263
+ cutlass::epilogue::thread::LinearCombination<
264
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
265
+ ElementAccumulator, ElementAccumulator>,
266
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
267
+
268
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
269
+ }
270
+
271
+ ////////////////////////////////////////////////////////////////////////////////
272
+
273
+ #endif // #if defined(CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_volta_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM70_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_volta_tensor_op_f32, 128x256x32_64x64x32) {
56
+
57
+ using ElementOutput = float;
58
+ using ElementAccumulator = float;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm70,
70
+ cutlass::gemm::GemmShape<128, 256, 32>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<8, 8, 4>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_volta_tensor_op_f32, 256x128x32_64x64x32) {
87
+
88
+ using ElementOutput = float;
89
+ using ElementAccumulator = float;
90
+
91
+ using Gemm = cutlass::gemm::device::Gemm<
92
+ cutlass::half_t,
93
+ cutlass::layout::ColumnMajor,
94
+ cutlass::half_t,
95
+ cutlass::layout::ColumnMajor,
96
+ ElementOutput,
97
+ cutlass::layout::RowMajor,
98
+ ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp,
100
+ cutlass::arch::Sm70,
101
+ cutlass::gemm::GemmShape<256, 128, 32>,
102
+ cutlass::gemm::GemmShape<64, 64, 32>,
103
+ cutlass::gemm::GemmShape<8, 8, 4>,
104
+ cutlass::epilogue::thread::LinearCombination<
105
+ ElementOutput,
106
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
107
+ ElementAccumulator,
108
+ ElementAccumulator
109
+ >,
110
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
111
+ 2
112
+ >;
113
+
114
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
115
+ }
116
+
117
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_volta_tensor_op_f32, 128x128x32_64x64x32) {
118
+
119
+ using ElementOutput = float;
120
+ using ElementAccumulator = float;
121
+
122
+ using Gemm = cutlass::gemm::device::Gemm<
123
+ cutlass::half_t,
124
+ cutlass::layout::ColumnMajor,
125
+ cutlass::half_t,
126
+ cutlass::layout::ColumnMajor,
127
+ ElementOutput,
128
+ cutlass::layout::RowMajor,
129
+ ElementAccumulator,
130
+ cutlass::arch::OpClassTensorOp,
131
+ cutlass::arch::Sm70,
132
+ cutlass::gemm::GemmShape<128, 128, 32>,
133
+ cutlass::gemm::GemmShape<64, 64, 32>,
134
+ cutlass::gemm::GemmShape<8, 8, 4>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput,
137
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
138
+ ElementAccumulator,
139
+ ElementAccumulator
140
+ >,
141
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
142
+ 2
143
+ >;
144
+
145
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
146
+ }
147
+
148
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_volta_tensor_op_f32, 128x64x32_64x32x32) {
149
+
150
+ using ElementOutput = float;
151
+ using ElementAccumulator = float;
152
+
153
+ using Gemm = cutlass::gemm::device::Gemm<
154
+ cutlass::half_t,
155
+ cutlass::layout::ColumnMajor,
156
+ cutlass::half_t,
157
+ cutlass::layout::ColumnMajor,
158
+ ElementOutput,
159
+ cutlass::layout::RowMajor,
160
+ ElementAccumulator,
161
+ cutlass::arch::OpClassTensorOp,
162
+ cutlass::arch::Sm70,
163
+ cutlass::gemm::GemmShape<128, 64, 32>,
164
+ cutlass::gemm::GemmShape<64, 32, 32>,
165
+ cutlass::gemm::GemmShape<8, 8, 4>,
166
+ cutlass::epilogue::thread::LinearCombination<
167
+ ElementOutput,
168
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
169
+ ElementAccumulator,
170
+ ElementAccumulator
171
+ >,
172
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
173
+ 2
174
+ >;
175
+
176
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
177
+ }
178
+
179
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_volta_tensor_op_f32, 64x128x32_32x64x32) {
180
+
181
+ using ElementOutput = float;
182
+ using ElementAccumulator = float;
183
+
184
+ using Gemm = cutlass::gemm::device::Gemm<
185
+ cutlass::half_t,
186
+ cutlass::layout::ColumnMajor,
187
+ cutlass::half_t,
188
+ cutlass::layout::ColumnMajor,
189
+ ElementOutput,
190
+ cutlass::layout::RowMajor,
191
+ ElementAccumulator,
192
+ cutlass::arch::OpClassTensorOp,
193
+ cutlass::arch::Sm70,
194
+ cutlass::gemm::GemmShape<64, 128, 32>,
195
+ cutlass::gemm::GemmShape<32, 64, 32>,
196
+ cutlass::gemm::GemmShape<8, 8, 4>,
197
+ cutlass::epilogue::thread::LinearCombination<
198
+ ElementOutput,
199
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
200
+ ElementAccumulator,
201
+ ElementAccumulator
202
+ >,
203
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
204
+ 2
205
+ >;
206
+
207
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
208
+ }
209
+
210
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_volta_tensor_op_f32, 64x64x32_64x64x32) {
211
+
212
+ using ElementOutput = float;
213
+ using ElementAccumulator = float;
214
+
215
+ using Gemm = cutlass::gemm::device::Gemm<
216
+ cutlass::half_t,
217
+ cutlass::layout::ColumnMajor,
218
+ cutlass::half_t,
219
+ cutlass::layout::ColumnMajor,
220
+ ElementOutput,
221
+ cutlass::layout::RowMajor,
222
+ ElementAccumulator,
223
+ cutlass::arch::OpClassTensorOp,
224
+ cutlass::arch::Sm70,
225
+ cutlass::gemm::GemmShape<64, 64, 32>,
226
+ cutlass::gemm::GemmShape<64, 64, 32>,
227
+ cutlass::gemm::GemmShape<8, 8, 4>,
228
+ cutlass::epilogue::thread::LinearCombination<
229
+ ElementOutput,
230
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
231
+ ElementAccumulator,
232
+ ElementAccumulator
233
+ >,
234
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
235
+ 2
236
+ >;
237
+
238
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
239
+ }
240
+
241
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_volta_tensor_op_f32, 64x64x32_32x32x32) {
242
+
243
+ using ElementOutput = float;
244
+ using ElementAccumulator = float;
245
+
246
+ using Gemm = cutlass::gemm::device::Gemm<
247
+ cutlass::half_t,
248
+ cutlass::layout::ColumnMajor,
249
+ cutlass::half_t,
250
+ cutlass::layout::ColumnMajor,
251
+ ElementOutput,
252
+ cutlass::layout::RowMajor,
253
+ ElementAccumulator,
254
+ cutlass::arch::OpClassTensorOp,
255
+ cutlass::arch::Sm70,
256
+ cutlass::gemm::GemmShape<64, 64, 32>,
257
+ cutlass::gemm::GemmShape<32, 32, 32>,
258
+ cutlass::gemm::GemmShape<8, 8, 4>,
259
+ cutlass::epilogue::thread::LinearCombination<
260
+ ElementOutput,
261
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
262
+ ElementAccumulator,
263
+ ElementAccumulator
264
+ >,
265
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
266
+ 2
267
+ >;
268
+
269
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
270
+ }
271
+
272
+ /////////////////////////////////////////////////////////////////////////////////////////////////
273
+
274
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16n_f32t_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include "cutlass/arch/wmma.h"
36
+
37
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
38
+ #include <iostream>
39
+
40
+ #include "cutlass/cutlass.h"
41
+ #include "cutlass/gemm/device/gemm.h"
42
+
43
+ #include "../../common/cutlass_unit_test.h"
44
+
45
+ #include "cutlass/util/host_tensor.h"
46
+ #include "cutlass/util/tensor_view_io.h"
47
+ #include "cutlass/util/reference/host/tensor_fill.h"
48
+ #include "cutlass/util/reference/host/tensor_copy.h"
49
+ #include "cutlass/util/reference/host/tensor_compare.h"
50
+ #include "cutlass/util/reference/host/gemm.h"
51
+
52
+ #include "testbed.h"
53
+
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F32 //////////
56
+ /////////////////////////////////////////////////////////////////////////////////////////////////
57
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 64x64x32_64x64x32_16x16x16) {
58
+
59
+ using ElementOutput = float;
60
+ using ElementAccumulator = float;
61
+
62
+ using Gemm = cutlass::gemm::device::Gemm<
63
+ cutlass::half_t,
64
+ cutlass::layout::RowMajor,
65
+ cutlass::half_t,
66
+ cutlass::layout::RowMajor,
67
+ ElementOutput,
68
+ cutlass::layout::RowMajor,
69
+ ElementAccumulator,
70
+ cutlass::arch::OpClassWmmaTensorOp,
71
+ cutlass::arch::Sm70,
72
+ cutlass::gemm::GemmShape<64, 64, 32>,
73
+ cutlass::gemm::GemmShape<64, 64, 32>,
74
+ cutlass::gemm::GemmShape<16, 16, 16>,
75
+ cutlass::epilogue::thread::LinearCombination<
76
+ ElementOutput,
77
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
78
+ ElementAccumulator,
79
+ ElementAccumulator
80
+ >,
81
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
82
+ 2
83
+ >;
84
+
85
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
86
+ }
87
+
88
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 128x128x32_64x64x32_16x16x16) {
89
+
90
+ using ElementOutput = float;
91
+ using ElementAccumulator = float;
92
+
93
+ using Gemm = cutlass::gemm::device::Gemm<
94
+ cutlass::half_t,
95
+ cutlass::layout::RowMajor,
96
+ cutlass::half_t,
97
+ cutlass::layout::RowMajor,
98
+ ElementOutput,
99
+ cutlass::layout::RowMajor,
100
+ ElementAccumulator,
101
+ cutlass::arch::OpClassWmmaTensorOp,
102
+ cutlass::arch::Sm70,
103
+ cutlass::gemm::GemmShape<128, 128, 32>,
104
+ cutlass::gemm::GemmShape<64, 64, 32>,
105
+ cutlass::gemm::GemmShape<16, 16, 16>,
106
+ cutlass::epilogue::thread::LinearCombination<
107
+ ElementOutput,
108
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
109
+ ElementAccumulator,
110
+ ElementAccumulator
111
+ >,
112
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
113
+ 2
114
+ >;
115
+
116
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
117
+ }
118
+
119
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 128x256x32_64x64x32_16x16x16) {
120
+
121
+ using ElementOutput = float;
122
+ using ElementAccumulator = float;
123
+
124
+ using Gemm = cutlass::gemm::device::Gemm<
125
+ cutlass::half_t,
126
+ cutlass::layout::RowMajor,
127
+ cutlass::half_t,
128
+ cutlass::layout::RowMajor,
129
+ ElementOutput,
130
+ cutlass::layout::RowMajor,
131
+ ElementAccumulator,
132
+ cutlass::arch::OpClassWmmaTensorOp,
133
+ cutlass::arch::Sm70,
134
+ cutlass::gemm::GemmShape<128, 256, 32>,
135
+ cutlass::gemm::GemmShape<64, 64, 32>,
136
+ cutlass::gemm::GemmShape<16, 16, 16>,
137
+ cutlass::epilogue::thread::LinearCombination<
138
+ ElementOutput,
139
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
140
+ ElementAccumulator,
141
+ ElementAccumulator
142
+ >,
143
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
144
+ 2
145
+ >;
146
+
147
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
148
+ }
149
+
150
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 256x128x32_64x64x32_16x16x16) {
151
+
152
+ using ElementOutput = float;
153
+ using ElementAccumulator = float;
154
+
155
+ using Gemm = cutlass::gemm::device::Gemm<
156
+ cutlass::half_t,
157
+ cutlass::layout::RowMajor,
158
+ cutlass::half_t,
159
+ cutlass::layout::RowMajor,
160
+ ElementOutput,
161
+ cutlass::layout::RowMajor,
162
+ ElementAccumulator,
163
+ cutlass::arch::OpClassWmmaTensorOp,
164
+ cutlass::arch::Sm70,
165
+ cutlass::gemm::GemmShape<256, 128, 32>,
166
+ cutlass::gemm::GemmShape<64, 64, 32>,
167
+ cutlass::gemm::GemmShape<16, 16, 16>,
168
+ cutlass::epilogue::thread::LinearCombination<
169
+ ElementOutput,
170
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
171
+ ElementAccumulator,
172
+ ElementAccumulator
173
+ >,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
175
+ 2
176
+ >;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
179
+ }
180
+
181
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 128x64x32_64x32x32_16x16x16) {
182
+
183
+ using ElementOutput = float;
184
+ using ElementAccumulator = float;
185
+
186
+ using Gemm = cutlass::gemm::device::Gemm<
187
+ cutlass::half_t,
188
+ cutlass::layout::RowMajor,
189
+ cutlass::half_t,
190
+ cutlass::layout::RowMajor,
191
+ ElementOutput,
192
+ cutlass::layout::RowMajor,
193
+ ElementAccumulator,
194
+ cutlass::arch::OpClassWmmaTensorOp,
195
+ cutlass::arch::Sm70,
196
+ cutlass::gemm::GemmShape<128, 64, 32>,
197
+ cutlass::gemm::GemmShape<64, 32, 32>,
198
+ cutlass::gemm::GemmShape<16, 16, 16>,
199
+ cutlass::epilogue::thread::LinearCombination<
200
+ ElementOutput,
201
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
202
+ ElementAccumulator,
203
+ ElementAccumulator
204
+ >,
205
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
206
+ 2
207
+ >;
208
+
209
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
210
+ }
211
+
212
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 64x128x32_64x32x32_16x16x16) {
213
+
214
+ using ElementOutput = float;
215
+ using ElementAccumulator = float;
216
+
217
+ using Gemm = cutlass::gemm::device::Gemm<
218
+ cutlass::half_t,
219
+ cutlass::layout::RowMajor,
220
+ cutlass::half_t,
221
+ cutlass::layout::RowMajor,
222
+ ElementOutput,
223
+ cutlass::layout::RowMajor,
224
+ ElementAccumulator,
225
+ cutlass::arch::OpClassWmmaTensorOp,
226
+ cutlass::arch::Sm70,
227
+ cutlass::gemm::GemmShape<64, 128, 32>,
228
+ cutlass::gemm::GemmShape<64, 32, 32>,
229
+ cutlass::gemm::GemmShape<16, 16, 16>,
230
+ cutlass::epilogue::thread::LinearCombination<
231
+ ElementOutput,
232
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
233
+ ElementAccumulator,
234
+ ElementAccumulator
235
+ >,
236
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
237
+ 2
238
+ >;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
241
+ }
242
+
243
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 64x64x32_32x32x32_16x16x16) {
244
+
245
+ using ElementOutput = float;
246
+ using ElementAccumulator = float;
247
+
248
+ using Gemm = cutlass::gemm::device::Gemm<
249
+ cutlass::half_t,
250
+ cutlass::layout::RowMajor,
251
+ cutlass::half_t,
252
+ cutlass::layout::RowMajor,
253
+ ElementOutput,
254
+ cutlass::layout::RowMajor,
255
+ ElementAccumulator,
256
+ cutlass::arch::OpClassWmmaTensorOp,
257
+ cutlass::arch::Sm70,
258
+ cutlass::gemm::GemmShape<64, 64, 32>,
259
+ cutlass::gemm::GemmShape<32, 32, 32>,
260
+ cutlass::gemm::GemmShape<16, 16, 16>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput,
263
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator,
265
+ ElementAccumulator
266
+ >,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
268
+ 2
269
+ >;
270
+
271
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
272
+ }
273
+
274
+
275
+ /////////////////////////////////////////////////////////////////////////////////////////////////
276
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F32=>F32 //////////
277
+ /////////////////////////////////////////////////////////////////////////////////////////////////
278
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 128x128x32_64x64x32_32x8x16) {
279
+
280
+ using ElementOutput = float;
281
+ using ElementAccumulator = float;
282
+
283
+ using Gemm = cutlass::gemm::device::Gemm<
284
+ cutlass::half_t,
285
+ cutlass::layout::RowMajor,
286
+ cutlass::half_t,
287
+ cutlass::layout::RowMajor,
288
+ ElementOutput,
289
+ cutlass::layout::RowMajor,
290
+ ElementAccumulator,
291
+ cutlass::arch::OpClassWmmaTensorOp,
292
+ cutlass::arch::Sm70,
293
+ cutlass::gemm::GemmShape<128, 128, 32>,
294
+ cutlass::gemm::GemmShape<64, 64, 32>,
295
+ cutlass::gemm::GemmShape<32, 8, 16>,
296
+ cutlass::epilogue::thread::LinearCombination<
297
+ ElementOutput,
298
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
299
+ ElementAccumulator,
300
+ ElementAccumulator
301
+ >,
302
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
303
+ 2
304
+ >;
305
+
306
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
307
+ }
308
+
309
+ /////////////////////////////////////////////////////////////////////////////////////////////////
310
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F32=>F32 //////////
311
+ /////////////////////////////////////////////////////////////////////////////////////////////////
312
+ TEST(SM70_Device_Gemm_f16n_f16n_f32t_wmma_tensor_op_f32, 128x128x32_64x64x32_8x32x16) {
313
+
314
+ using ElementOutput = float;
315
+ using ElementAccumulator = float;
316
+
317
+ using Gemm = cutlass::gemm::device::Gemm<
318
+ cutlass::half_t,
319
+ cutlass::layout::RowMajor,
320
+ cutlass::half_t,
321
+ cutlass::layout::RowMajor,
322
+ ElementOutput,
323
+ cutlass::layout::RowMajor,
324
+ ElementAccumulator,
325
+ cutlass::arch::OpClassWmmaTensorOp,
326
+ cutlass::arch::Sm70,
327
+ cutlass::gemm::GemmShape<128, 128, 32>,
328
+ cutlass::gemm::GemmShape<64, 64, 32>,
329
+ cutlass::gemm::GemmShape<8, 32, 16>,
330
+ cutlass::epilogue::thread::LinearCombination<
331
+ ElementOutput,
332
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
333
+ ElementAccumulator,
334
+ ElementAccumulator
335
+ >,
336
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
337
+ 2
338
+ >;
339
+
340
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
341
+ }
342
+ /////////////////////////////////////////////////////////////////////////////////////////////////
343
+
344
+ #endif // CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16n_wmma_tensor_op_f16_sm70.cu ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F16=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+
57
+ TEST(SM70_Device_Gemm_f16n_f16t_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_16x16x16) {
58
+ // single cta, two warps horizontally two waprs vertically
59
+ using ElementOutput = cutlass::half_t;
60
+ using ElementAccumulator = cutlass::half_t;
61
+
62
+ using Gemm = cutlass::gemm::device::Gemm<
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ cutlass::half_t,
66
+ cutlass::layout::RowMajor,
67
+ ElementOutput,
68
+ cutlass::layout::ColumnMajor,
69
+ ElementAccumulator,
70
+ cutlass::arch::OpClassWmmaTensorOp,
71
+ cutlass::arch::Sm70,
72
+ cutlass::gemm::GemmShape<128, 128, 32>,
73
+ cutlass::gemm::GemmShape<64, 64, 32>,
74
+ cutlass::gemm::GemmShape<16, 16, 16>,
75
+ cutlass::epilogue::thread::LinearCombination<
76
+ ElementOutput,
77
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
78
+ ElementAccumulator,
79
+ ElementAccumulator
80
+ >,
81
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
82
+ 2
83
+ >;
84
+
85
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
86
+ }
87
+
88
+
89
+ /////////////////////////////////////////////////////////////////////////////////////////////////
90
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F16=>F16 //////////
91
+ /////////////////////////////////////////////////////////////////////////////////////////////////
92
+ TEST(SM70_Device_Gemm_f16n_f16t_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_32x8x16) {
93
+
94
+ using ElementOutput = cutlass::half_t;
95
+ using ElementAccumulator = cutlass::half_t;
96
+
97
+ using Gemm = cutlass::gemm::device::Gemm<
98
+ cutlass::half_t,
99
+ cutlass::layout::ColumnMajor,
100
+ cutlass::half_t,
101
+ cutlass::layout::RowMajor,
102
+ ElementOutput,
103
+ cutlass::layout::ColumnMajor,
104
+ ElementAccumulator,
105
+ cutlass::arch::OpClassWmmaTensorOp,
106
+ cutlass::arch::Sm70,
107
+ cutlass::gemm::GemmShape<128, 128, 32>,
108
+ cutlass::gemm::GemmShape<64, 64, 32>,
109
+ cutlass::gemm::GemmShape<32, 8, 16>,
110
+ cutlass::epilogue::thread::LinearCombination<
111
+ ElementOutput,
112
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
113
+ ElementAccumulator,
114
+ ElementAccumulator
115
+ >,
116
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
117
+ 2
118
+ >;
119
+
120
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
121
+ }
122
+
123
+ /////////////////////////////////////////////////////////////////////////////////////////////////
124
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F16=>F16 //////////
125
+ /////////////////////////////////////////////////////////////////////////////////////////////////
126
+ TEST(SM70_Device_Gemm_f16n_f16t_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_8x32x16) {
127
+
128
+ using ElementOutput = cutlass::half_t;
129
+ using ElementAccumulator = cutlass::half_t;
130
+
131
+ using Gemm = cutlass::gemm::device::Gemm<
132
+ cutlass::half_t,
133
+ cutlass::layout::ColumnMajor,
134
+ cutlass::half_t,
135
+ cutlass::layout::RowMajor,
136
+ ElementOutput,
137
+ cutlass::layout::ColumnMajor,
138
+ ElementAccumulator,
139
+ cutlass::arch::OpClassWmmaTensorOp,
140
+ cutlass::arch::Sm70,
141
+ cutlass::gemm::GemmShape<128, 128, 32>,
142
+ cutlass::gemm::GemmShape<64, 64, 32>,
143
+ cutlass::gemm::GemmShape<8, 32, 16>,
144
+ cutlass::epilogue::thread::LinearCombination<
145
+ ElementOutput,
146
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
147
+ ElementAccumulator,
148
+ ElementAccumulator
149
+ >,
150
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
151
+ 2
152
+ >;
153
+
154
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
155
+ }
156
+
157
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_slicedk_sm75.cu ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM75_Device_Gemm_f16n_f16t_f16t_tensor_op_f16_sliced_k, 64x64x64_64x32x32) {
56
+
57
+ using ElementOutput = cutlass::half_t;
58
+ using ElementAccumulator = cutlass::half_t;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::RowMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm75,
70
+ cutlass::gemm::GemmShape<64, 64, 64>,
71
+ cutlass::gemm::GemmShape<64, 32, 32>,
72
+ cutlass::gemm::GemmShape<16, 8, 8>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 64 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ /////////////////////////////////////////////////////////////////////////////////////////////////
87
+
88
+ #endif // if (CUTLASS_ARCH_MMA_SM75_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_slicedk_sm80.cu ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16_sliced_k, 128x64x64_64x64x32) {
56
+
57
+ using ElementOutput = cutlass::half_t;
58
+ using ElementAccumulator = cutlass::half_t;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::RowMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm80,
70
+ cutlass::gemm::GemmShape<128, 64, 64>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<16, 8, 16>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 64 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 3
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ /////////////////////////////////////////////////////////////////////////////////////////////////
87
+
88
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_sm75.cu ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM75_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x256x32_64x64x32) {
56
+
57
+ using ElementOutput = cutlass::half_t;
58
+ using ElementAccumulator = cutlass::half_t;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::RowMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm75,
70
+ cutlass::gemm::GemmShape<128, 256, 32>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<16, 8, 8>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ TEST(SM75_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x128x32_64x64x32) {
87
+
88
+ using ElementOutput = cutlass::half_t;
89
+ using ElementAccumulator = cutlass::half_t;
90
+
91
+ using Gemm = cutlass::gemm::device::Gemm<
92
+ cutlass::half_t,
93
+ cutlass::layout::ColumnMajor,
94
+ cutlass::half_t,
95
+ cutlass::layout::RowMajor,
96
+ ElementOutput,
97
+ cutlass::layout::RowMajor,
98
+ ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp,
100
+ cutlass::arch::Sm75,
101
+ cutlass::gemm::GemmShape<256, 128, 32>,
102
+ cutlass::gemm::GemmShape<64, 64, 32>,
103
+ cutlass::gemm::GemmShape<16, 8, 8>,
104
+ cutlass::epilogue::thread::LinearCombination<
105
+ ElementOutput,
106
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
107
+ ElementAccumulator,
108
+ ElementAccumulator
109
+ >,
110
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
111
+ 2
112
+ >;
113
+
114
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
115
+ }
116
+
117
+ TEST(SM75_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x128x32_64x64x32) {
118
+
119
+ using ElementOutput = cutlass::half_t;
120
+ using ElementAccumulator = cutlass::half_t;
121
+
122
+ using Gemm = cutlass::gemm::device::Gemm<
123
+ cutlass::half_t,
124
+ cutlass::layout::ColumnMajor,
125
+ cutlass::half_t,
126
+ cutlass::layout::RowMajor,
127
+ ElementOutput,
128
+ cutlass::layout::RowMajor,
129
+ ElementAccumulator,
130
+ cutlass::arch::OpClassTensorOp,
131
+ cutlass::arch::Sm75,
132
+ cutlass::gemm::GemmShape<128, 128, 32>,
133
+ cutlass::gemm::GemmShape<64, 64, 32>,
134
+ cutlass::gemm::GemmShape<16, 8, 8>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput,
137
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
138
+ ElementAccumulator,
139
+ ElementAccumulator
140
+ >,
141
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
142
+ 2
143
+ >;
144
+
145
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
146
+ }
147
+
148
+ TEST(SM75_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x128x32_32x64x32) {
149
+
150
+ using ElementOutput = cutlass::half_t;
151
+ using ElementAccumulator = cutlass::half_t;
152
+
153
+ using Gemm = cutlass::gemm::device::Gemm<
154
+ cutlass::half_t,
155
+ cutlass::layout::ColumnMajor,
156
+ cutlass::half_t,
157
+ cutlass::layout::RowMajor,
158
+ ElementOutput,
159
+ cutlass::layout::RowMajor,
160
+ ElementAccumulator,
161
+ cutlass::arch::OpClassTensorOp,
162
+ cutlass::arch::Sm75,
163
+ cutlass::gemm::GemmShape<64, 128, 32>,
164
+ cutlass::gemm::GemmShape<32, 64, 32>,
165
+ cutlass::gemm::GemmShape<16, 8, 8>,
166
+ cutlass::epilogue::thread::LinearCombination<
167
+ ElementOutput,
168
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
169
+ ElementAccumulator,
170
+ ElementAccumulator
171
+ >,
172
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
173
+ 2
174
+ >;
175
+
176
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
177
+ }
178
+
179
+ TEST(SM75_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x64x32_64x32x32) {
180
+
181
+ using ElementOutput = cutlass::half_t;
182
+ using ElementAccumulator = cutlass::half_t;
183
+
184
+ using Gemm = cutlass::gemm::device::Gemm<
185
+ cutlass::half_t,
186
+ cutlass::layout::ColumnMajor,
187
+ cutlass::half_t,
188
+ cutlass::layout::RowMajor,
189
+ ElementOutput,
190
+ cutlass::layout::RowMajor,
191
+ ElementAccumulator,
192
+ cutlass::arch::OpClassTensorOp,
193
+ cutlass::arch::Sm75,
194
+ cutlass::gemm::GemmShape<128, 64, 32>,
195
+ cutlass::gemm::GemmShape<64, 32, 32>,
196
+ cutlass::gemm::GemmShape<16, 8, 8>,
197
+ cutlass::epilogue::thread::LinearCombination<
198
+ ElementOutput,
199
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
200
+ ElementAccumulator,
201
+ ElementAccumulator
202
+ >,
203
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
204
+ 2
205
+ >;
206
+
207
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
208
+ }
209
+
210
+ TEST(SM75_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x64x32_32x32x32) {
211
+
212
+ using ElementOutput = cutlass::half_t;
213
+ using ElementAccumulator = cutlass::half_t;
214
+
215
+ using Gemm = cutlass::gemm::device::Gemm<
216
+ cutlass::half_t,
217
+ cutlass::layout::ColumnMajor,
218
+ cutlass::half_t,
219
+ cutlass::layout::RowMajor,
220
+ ElementOutput,
221
+ cutlass::layout::RowMajor,
222
+ ElementAccumulator,
223
+ cutlass::arch::OpClassTensorOp,
224
+ cutlass::arch::Sm75,
225
+ cutlass::gemm::GemmShape<64, 64, 32>,
226
+ cutlass::gemm::GemmShape<32, 32, 32>,
227
+ cutlass::gemm::GemmShape<16, 8, 8>,
228
+ cutlass::epilogue::thread::LinearCombination<
229
+ ElementOutput,
230
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
231
+ ElementAccumulator,
232
+ ElementAccumulator
233
+ >,
234
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
235
+ 2
236
+ >;
237
+
238
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
239
+ }
240
+
241
+ /////////////////////////////////////////////////////////////////////////////////////////////////
242
+
243
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_sm80.cu ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+
49
+ #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x256x64_64x64x64) {
54
+ using ElementOutput = cutlass::half_t;
55
+ using ElementAccumulator = cutlass::half_t;
56
+
57
+ using Gemm = cutlass::gemm::device::Gemm<
58
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
59
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
63
+ cutlass::epilogue::thread::LinearCombination<
64
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
65
+ ElementAccumulator, ElementAccumulator>,
66
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
67
+
68
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
69
+ }
70
+
71
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x128x64_64x64x64) {
72
+ using ElementOutput = cutlass::half_t;
73
+ using ElementAccumulator = cutlass::half_t;
74
+
75
+ using Gemm = cutlass::gemm::device::Gemm<
76
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
77
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
78
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
79
+ cutlass::gemm::GemmShape<256, 128, 64>,
80
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
81
+ cutlass::epilogue::thread::LinearCombination<
82
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
83
+ ElementAccumulator, ElementAccumulator>,
84
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
87
+ }
88
+
89
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x128x64_64x64x64) {
90
+ using ElementOutput = cutlass::half_t;
91
+ using ElementAccumulator = cutlass::half_t;
92
+
93
+ using Gemm = cutlass::gemm::device::Gemm<
94
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
95
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
96
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
97
+ cutlass::gemm::GemmShape<128, 128, 64>,
98
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
99
+ cutlass::epilogue::thread::LinearCombination<
100
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
101
+ ElementAccumulator, ElementAccumulator>,
102
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
105
+ }
106
+
107
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x64x64_64x64x64) {
108
+ using ElementOutput = cutlass::half_t;
109
+ using ElementAccumulator = cutlass::half_t;
110
+
111
+ using Gemm = cutlass::gemm::device::Gemm<
112
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
113
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
114
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
115
+ cutlass::gemm::GemmShape<256, 64, 64>,
116
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
117
+ cutlass::epilogue::thread::LinearCombination<
118
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
119
+ ElementAccumulator, ElementAccumulator>,
120
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
121
+
122
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
123
+ }
124
+
125
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x256x64_64x64x64) {
126
+ using ElementOutput = cutlass::half_t;
127
+ using ElementAccumulator = cutlass::half_t;
128
+
129
+ using Gemm = cutlass::gemm::device::Gemm<
130
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
131
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
132
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
133
+ cutlass::gemm::GemmShape<64, 256, 64> ,
134
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
137
+ ElementAccumulator, ElementAccumulator>,
138
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
139
+
140
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
141
+ }
142
+
143
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x128x64_32x64x64) {
144
+ using ElementOutput = cutlass::half_t;
145
+ using ElementAccumulator = cutlass::half_t;
146
+
147
+ using Gemm = cutlass::gemm::device::Gemm<
148
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
149
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
150
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
151
+ cutlass::gemm::GemmShape<64, 128, 64>,
152
+ cutlass::gemm::GemmShape<32, 64, 64>,
153
+ cutlass::gemm::GemmShape<16, 8, 16>,
154
+ cutlass::epilogue::thread::LinearCombination<
155
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
156
+ ElementAccumulator, ElementAccumulator>,
157
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
158
+
159
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
160
+ }
161
+
162
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x64x64_64x32x64) {
163
+ using ElementOutput = cutlass::half_t;
164
+ using ElementAccumulator = cutlass::half_t;
165
+
166
+ using Gemm = cutlass::gemm::device::Gemm<
167
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
168
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
169
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
170
+ cutlass::gemm::GemmShape<128, 64, 64>,
171
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
172
+ cutlass::epilogue::thread::LinearCombination<
173
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
174
+ ElementAccumulator, ElementAccumulator>,
175
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
176
+
177
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
178
+ }
179
+
180
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x64x64_32x32x64) {
181
+ using ElementOutput = cutlass::half_t;
182
+ using ElementAccumulator = cutlass::half_t;
183
+
184
+ using Gemm = cutlass::gemm::device::Gemm<
185
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
186
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
187
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
188
+ cutlass::gemm::GemmShape<64, 64, 64>,
189
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
190
+ cutlass::epilogue::thread::LinearCombination<
191
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
192
+ ElementAccumulator, ElementAccumulator>,
193
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
194
+
195
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
196
+ }
197
+
198
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x256x32_64x64x32) {
199
+ using ElementOutput = cutlass::half_t;
200
+ using ElementAccumulator = cutlass::half_t;
201
+
202
+ using Gemm = cutlass::gemm::device::Gemm<
203
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
204
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
205
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
206
+ cutlass::gemm::GemmShape<128, 256, 32>,
207
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
208
+ cutlass::epilogue::thread::LinearCombination<
209
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
210
+ ElementAccumulator, ElementAccumulator>,
211
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
212
+
213
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
214
+ }
215
+
216
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x128x32_64x64x32) {
217
+ using ElementOutput = cutlass::half_t;
218
+ using ElementAccumulator = cutlass::half_t;
219
+
220
+ using Gemm = cutlass::gemm::device::Gemm<
221
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
222
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
223
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
224
+ cutlass::gemm::GemmShape<256, 128, 32>,
225
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
226
+ cutlass::epilogue::thread::LinearCombination<
227
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
228
+ ElementAccumulator, ElementAccumulator>,
229
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
230
+
231
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
232
+ }
233
+
234
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x128x32_64x64x32) {
235
+ using ElementOutput = cutlass::half_t;
236
+ using ElementAccumulator = cutlass::half_t;
237
+
238
+ using Gemm = cutlass::gemm::device::Gemm<
239
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
240
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
241
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
242
+ cutlass::gemm::GemmShape<128, 128, 32>,
243
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
244
+ cutlass::epilogue::thread::LinearCombination<
245
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
246
+ ElementAccumulator, ElementAccumulator>,
247
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
248
+
249
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
250
+ }
251
+
252
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x64x32_64x64x32) {
253
+ using ElementOutput = cutlass::half_t;
254
+ using ElementAccumulator = cutlass::half_t;
255
+
256
+ using Gemm = cutlass::gemm::device::Gemm<
257
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
258
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
259
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
260
+ cutlass::gemm::GemmShape<256, 64, 32>,
261
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
262
+ cutlass::epilogue::thread::LinearCombination<
263
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator, ElementAccumulator>,
265
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
266
+
267
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
268
+ }
269
+
270
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x256x32_64x64x32) {
271
+ using ElementOutput = cutlass::half_t;
272
+ using ElementAccumulator = cutlass::half_t;
273
+
274
+ using Gemm = cutlass::gemm::device::Gemm<
275
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
276
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
277
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
278
+ cutlass::gemm::GemmShape<64, 256, 32>,
279
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
280
+ cutlass::epilogue::thread::LinearCombination<
281
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
282
+ ElementAccumulator, ElementAccumulator>,
283
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
284
+
285
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
286
+ }
287
+
288
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x128x32_32x64x32) {
289
+ using ElementOutput = cutlass::half_t;
290
+ using ElementAccumulator = cutlass::half_t;
291
+
292
+ using Gemm = cutlass::gemm::device::Gemm<
293
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
294
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
295
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
296
+ cutlass::gemm::GemmShape<64, 128, 32>,
297
+ cutlass::gemm::GemmShape<32, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
298
+ cutlass::epilogue::thread::LinearCombination<
299
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
300
+ ElementAccumulator, ElementAccumulator>,
301
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
302
+
303
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
304
+ }
305
+
306
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x64x32_64x32x32) {
307
+ using ElementOutput = cutlass::half_t;
308
+ using ElementAccumulator = cutlass::half_t;
309
+
310
+ using Gemm = cutlass::gemm::device::Gemm<
311
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
312
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
313
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
314
+ cutlass::gemm::GemmShape<128, 64, 32>,
315
+ cutlass::gemm::GemmShape<64, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
316
+ cutlass::epilogue::thread::LinearCombination<
317
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
318
+ ElementAccumulator, ElementAccumulator>,
319
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
320
+
321
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
322
+ }
323
+
324
+ TEST(SM80_Device_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x64x32_32x32x32) {
325
+ using ElementOutput = cutlass::half_t;
326
+ using ElementAccumulator = cutlass::half_t;
327
+
328
+ using Gemm = cutlass::gemm::device::Gemm<
329
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
330
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
331
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
332
+ cutlass::gemm::GemmShape<64, 64, 32>,
333
+ cutlass::gemm::GemmShape<32, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
334
+ cutlass::epilogue::thread::LinearCombination<
335
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
336
+ ElementAccumulator, ElementAccumulator>,
337
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
338
+
339
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
340
+ }
341
+
342
+ ////////////////////////////////////////////////////////////////////////////////
343
+
344
+ #endif // #if defined(CUTLASS_ARCH_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_tensor_op_f16_sparse_sm80.cu ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_sparse.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed_sparse.h"
48
+
49
+ #if defined(CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x256x64_64x64x64) {
54
+ using ElementOutput = cutlass::half_t;
55
+ using ElementAccumulator = cutlass::half_t;
56
+
57
+ using Gemm = cutlass::gemm::device::SparseGemm<
58
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
59
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
63
+ cutlass::epilogue::thread::LinearCombination<
64
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
65
+ ElementAccumulator, ElementAccumulator>,
66
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
67
+
68
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
69
+ }
70
+
71
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x128x64_64x64x64) {
72
+ using ElementOutput = cutlass::half_t;
73
+ using ElementAccumulator = cutlass::half_t;
74
+
75
+ using Gemm = cutlass::gemm::device::SparseGemm<
76
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
77
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
78
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
79
+ cutlass::gemm::GemmShape<256, 128, 64>,
80
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
81
+ cutlass::epilogue::thread::LinearCombination<
82
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
83
+ ElementAccumulator, ElementAccumulator>,
84
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
87
+ }
88
+
89
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x128x64_64x64x64) {
90
+ using ElementOutput = cutlass::half_t;
91
+ using ElementAccumulator = cutlass::half_t;
92
+
93
+ using Gemm = cutlass::gemm::device::SparseGemm<
94
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
95
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
96
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
97
+ cutlass::gemm::GemmShape<128, 128, 64>,
98
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
99
+ cutlass::epilogue::thread::LinearCombination<
100
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
101
+ ElementAccumulator, ElementAccumulator>,
102
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
105
+ }
106
+
107
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x64x64_64x64x64) {
108
+ using ElementOutput = cutlass::half_t;
109
+ using ElementAccumulator = cutlass::half_t;
110
+
111
+ using Gemm = cutlass::gemm::device::SparseGemm<
112
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
113
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
114
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
115
+ cutlass::gemm::GemmShape<256, 64, 64>,
116
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
117
+ cutlass::epilogue::thread::LinearCombination<
118
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
119
+ ElementAccumulator, ElementAccumulator>,
120
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
121
+
122
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
123
+ }
124
+
125
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x256x64_64x64x64) {
126
+ using ElementOutput = cutlass::half_t;
127
+ using ElementAccumulator = cutlass::half_t;
128
+
129
+ using Gemm = cutlass::gemm::device::SparseGemm<
130
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
131
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
132
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
133
+ cutlass::gemm::GemmShape<64, 256, 64> ,
134
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
137
+ ElementAccumulator, ElementAccumulator>,
138
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
139
+
140
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
141
+ }
142
+
143
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x128x64_32x64x64) {
144
+ using ElementOutput = cutlass::half_t;
145
+ using ElementAccumulator = cutlass::half_t;
146
+
147
+ using Gemm = cutlass::gemm::device::SparseGemm<
148
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
149
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
150
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
151
+ cutlass::gemm::GemmShape<64, 128, 64>,
152
+ cutlass::gemm::GemmShape<32, 64, 64>,
153
+ cutlass::gemm::GemmShape<16, 8, 32>,
154
+ cutlass::epilogue::thread::LinearCombination<
155
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
156
+ ElementAccumulator, ElementAccumulator>,
157
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
158
+
159
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
160
+ }
161
+
162
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x64x64_64x32x64) {
163
+ using ElementOutput = cutlass::half_t;
164
+ using ElementAccumulator = cutlass::half_t;
165
+
166
+ using Gemm = cutlass::gemm::device::SparseGemm<
167
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
168
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
169
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
170
+ cutlass::gemm::GemmShape<128, 64, 64>,
171
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
172
+ cutlass::epilogue::thread::LinearCombination<
173
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
174
+ ElementAccumulator, ElementAccumulator>,
175
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
176
+
177
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
178
+ }
179
+
180
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x64x64_32x32x64) {
181
+ using ElementOutput = cutlass::half_t;
182
+ using ElementAccumulator = cutlass::half_t;
183
+
184
+ using Gemm = cutlass::gemm::device::SparseGemm<
185
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
186
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
187
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
188
+ cutlass::gemm::GemmShape<64, 64, 64>,
189
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
190
+ cutlass::epilogue::thread::LinearCombination<
191
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
192
+ ElementAccumulator, ElementAccumulator>,
193
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
194
+
195
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
196
+ }
197
+
198
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x128x128_64x64x128) {
199
+ using ElementOutput = cutlass::half_t;
200
+ using ElementAccumulator = cutlass::half_t;
201
+
202
+ using Gemm = cutlass::gemm::device::SparseGemm<
203
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
204
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
205
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
206
+ cutlass::gemm::GemmShape<128, 128, 128>,
207
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
208
+ cutlass::epilogue::thread::LinearCombination<
209
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
210
+ ElementAccumulator, ElementAccumulator>,
211
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
212
+
213
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
214
+ }
215
+
216
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 256x64x128_64x64x128) {
217
+ using ElementOutput = cutlass::half_t;
218
+ using ElementAccumulator = cutlass::half_t;
219
+
220
+ using Gemm = cutlass::gemm::device::SparseGemm<
221
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
222
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
223
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
224
+ cutlass::gemm::GemmShape<256, 64, 128>,
225
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
226
+ cutlass::epilogue::thread::LinearCombination<
227
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
228
+ ElementAccumulator, ElementAccumulator>,
229
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
230
+
231
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
232
+ }
233
+
234
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 128x64x128_64x32x128) {
235
+ using ElementOutput = cutlass::half_t;
236
+ using ElementAccumulator = cutlass::half_t;
237
+
238
+ using Gemm = cutlass::gemm::device::SparseGemm<
239
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
240
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
241
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
242
+ cutlass::gemm::GemmShape<128, 64, 128>,
243
+ cutlass::gemm::GemmShape<64, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
244
+ cutlass::epilogue::thread::LinearCombination<
245
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
246
+ ElementAccumulator, ElementAccumulator>,
247
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
248
+
249
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
250
+ }
251
+
252
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f16t_tensor_op_f16, 64x64x128_32x32x128) {
253
+ using ElementOutput = cutlass::half_t;
254
+ using ElementAccumulator = cutlass::half_t;
255
+
256
+ using Gemm = cutlass::gemm::device::SparseGemm<
257
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
258
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
259
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
260
+ cutlass::gemm::GemmShape<64, 64, 128>,
261
+ cutlass::gemm::GemmShape<32, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
262
+ cutlass::epilogue::thread::LinearCombination<
263
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator, ElementAccumulator>,
265
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
266
+
267
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
268
+ }
269
+ ////////////////////////////////////////////////////////////////////////////////
270
+
271
+ #endif // #if defined(CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_volta_tensor_op_f16_sm70.cu ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "testbed.h"
43
+
44
+ #if defined(CUTLASS_ARCH_MMA_SM70_SUPPORTED)
45
+
46
+ /////////////////////////////////////////////////////////////////////////////////////////////////
47
+
48
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_volta_tensor_op_f16, 128x256x32_64x64x32) {
49
+
50
+ using ElementOutput = cutlass::half_t;
51
+ using ElementAccumulator = cutlass::half_t;
52
+
53
+ using Gemm = cutlass::gemm::device::Gemm<
54
+ cutlass::half_t,
55
+ cutlass::layout::ColumnMajor,
56
+ cutlass::half_t,
57
+ cutlass::layout::RowMajor,
58
+ ElementOutput,
59
+ cutlass::layout::RowMajor,
60
+ ElementAccumulator,
61
+ cutlass::arch::OpClassTensorOp,
62
+ cutlass::arch::Sm70,
63
+ cutlass::gemm::GemmShape<128, 256, 32>,
64
+ cutlass::gemm::GemmShape<64, 64, 32>,
65
+ cutlass::gemm::GemmShape<8, 8, 4>,
66
+ cutlass::epilogue::thread::LinearCombination<
67
+ ElementOutput,
68
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
69
+ ElementAccumulator,
70
+ ElementAccumulator
71
+ >,
72
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
73
+ 2
74
+ >;
75
+
76
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
77
+ }
78
+
79
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_volta_tensor_op_f16, 256x128x32_64x64x32) {
80
+
81
+ using ElementOutput = cutlass::half_t;
82
+ using ElementAccumulator = cutlass::half_t;
83
+
84
+ using Gemm = cutlass::gemm::device::Gemm<
85
+ cutlass::half_t,
86
+ cutlass::layout::ColumnMajor,
87
+ cutlass::half_t,
88
+ cutlass::layout::RowMajor,
89
+ ElementOutput,
90
+ cutlass::layout::RowMajor,
91
+ ElementAccumulator,
92
+ cutlass::arch::OpClassTensorOp,
93
+ cutlass::arch::Sm70,
94
+ cutlass::gemm::GemmShape<256, 128, 32>,
95
+ cutlass::gemm::GemmShape<64, 64, 32>,
96
+ cutlass::gemm::GemmShape<8, 8, 4>,
97
+ cutlass::epilogue::thread::LinearCombination<
98
+ ElementOutput,
99
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
100
+ ElementAccumulator,
101
+ ElementAccumulator
102
+ >,
103
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
104
+ 2
105
+ >;
106
+
107
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
108
+ }
109
+
110
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_volta_tensor_op_f16, 128x128x32_64x64x32) {
111
+
112
+ using ElementOutput = cutlass::half_t;
113
+ using ElementAccumulator = cutlass::half_t;
114
+
115
+ using Gemm = cutlass::gemm::device::Gemm<
116
+ cutlass::half_t,
117
+ cutlass::layout::ColumnMajor,
118
+ cutlass::half_t,
119
+ cutlass::layout::RowMajor,
120
+ ElementOutput,
121
+ cutlass::layout::RowMajor,
122
+ ElementAccumulator,
123
+ cutlass::arch::OpClassTensorOp,
124
+ cutlass::arch::Sm70,
125
+ cutlass::gemm::GemmShape<128, 128, 32>,
126
+ cutlass::gemm::GemmShape<64, 64, 32>,
127
+ cutlass::gemm::GemmShape<8, 8, 4>,
128
+ cutlass::epilogue::thread::LinearCombination<
129
+ ElementOutput,
130
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
131
+ ElementAccumulator,
132
+ ElementAccumulator
133
+ >,
134
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
135
+ 2
136
+ >;
137
+
138
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
139
+ }
140
+
141
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_volta_tensor_op_f16, 128x64x32_64x32x32) {
142
+
143
+ using ElementOutput = cutlass::half_t;
144
+ using ElementAccumulator = cutlass::half_t;
145
+
146
+ using Gemm = cutlass::gemm::device::Gemm<
147
+ cutlass::half_t,
148
+ cutlass::layout::ColumnMajor,
149
+ cutlass::half_t,
150
+ cutlass::layout::RowMajor,
151
+ ElementOutput,
152
+ cutlass::layout::RowMajor,
153
+ ElementAccumulator,
154
+ cutlass::arch::OpClassTensorOp,
155
+ cutlass::arch::Sm70,
156
+ cutlass::gemm::GemmShape<128, 64, 32>,
157
+ cutlass::gemm::GemmShape<64, 32, 32>,
158
+ cutlass::gemm::GemmShape<8, 8, 4>,
159
+ cutlass::epilogue::thread::LinearCombination<
160
+ ElementOutput,
161
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
162
+ ElementAccumulator,
163
+ ElementAccumulator
164
+ >,
165
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
166
+ 2
167
+ >;
168
+
169
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
170
+ }
171
+
172
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_volta_tensor_op_f16, 64x128x32_32x64x32) {
173
+
174
+ using ElementOutput = cutlass::half_t;
175
+ using ElementAccumulator = cutlass::half_t;
176
+
177
+ using Gemm = cutlass::gemm::device::Gemm<
178
+ cutlass::half_t,
179
+ cutlass::layout::ColumnMajor,
180
+ cutlass::half_t,
181
+ cutlass::layout::RowMajor,
182
+ ElementOutput,
183
+ cutlass::layout::RowMajor,
184
+ ElementAccumulator,
185
+ cutlass::arch::OpClassTensorOp,
186
+ cutlass::arch::Sm70,
187
+ cutlass::gemm::GemmShape<64, 128, 32>,
188
+ cutlass::gemm::GemmShape<32, 64, 32>,
189
+ cutlass::gemm::GemmShape<8, 8, 4>,
190
+ cutlass::epilogue::thread::LinearCombination<
191
+ ElementOutput,
192
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
193
+ ElementAccumulator,
194
+ ElementAccumulator
195
+ >,
196
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
197
+ 2
198
+ >;
199
+
200
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
201
+ }
202
+
203
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_volta_tensor_op_f16, 64x64x32_64x64x32) {
204
+
205
+ using ElementOutput = cutlass::half_t;
206
+ using ElementAccumulator = cutlass::half_t;
207
+
208
+ using Gemm = cutlass::gemm::device::Gemm<
209
+ cutlass::half_t,
210
+ cutlass::layout::ColumnMajor,
211
+ cutlass::half_t,
212
+ cutlass::layout::RowMajor,
213
+ ElementOutput,
214
+ cutlass::layout::RowMajor,
215
+ ElementAccumulator,
216
+ cutlass::arch::OpClassTensorOp,
217
+ cutlass::arch::Sm70,
218
+ cutlass::gemm::GemmShape<64, 64, 32>,
219
+ cutlass::gemm::GemmShape<64, 64, 32>,
220
+ cutlass::gemm::GemmShape<8, 8, 4>,
221
+ cutlass::epilogue::thread::LinearCombination<
222
+ ElementOutput,
223
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
224
+ ElementAccumulator,
225
+ ElementAccumulator
226
+ >,
227
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
228
+ 2
229
+ >;
230
+
231
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
232
+ }
233
+
234
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_volta_tensor_op_f16, 64x64x32_32x32x32) {
235
+
236
+ using ElementOutput = cutlass::half_t;
237
+ using ElementAccumulator = cutlass::half_t;
238
+
239
+ using Gemm = cutlass::gemm::device::Gemm<
240
+ cutlass::half_t,
241
+ cutlass::layout::ColumnMajor,
242
+ cutlass::half_t,
243
+ cutlass::layout::RowMajor,
244
+ ElementOutput,
245
+ cutlass::layout::RowMajor,
246
+ ElementAccumulator,
247
+ cutlass::arch::OpClassTensorOp,
248
+ cutlass::arch::Sm70,
249
+ cutlass::gemm::GemmShape<64, 64, 32>,
250
+ cutlass::gemm::GemmShape<32, 32, 32>,
251
+ cutlass::gemm::GemmShape<8, 8, 4>,
252
+ cutlass::epilogue::thread::LinearCombination<
253
+ ElementOutput,
254
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
255
+ ElementAccumulator,
256
+ ElementAccumulator
257
+ >,
258
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
259
+ 2
260
+ >;
261
+
262
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
263
+ }
264
+
265
+ /////////////////////////////////////////////////////////////////////////////////////////////////
266
+
267
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f16t_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+ TEST(SM70_Device_Gemm_f16n_f16t_f16t_wmma_tensor_op_f32, 64x64x32_64x64x32_16x16x16) {
57
+
58
+ using ElementOutput = cutlass::half_t;
59
+ using ElementAccumulator = float;
60
+
61
+ using Gemm = cutlass::gemm::device::Gemm<
62
+ cutlass::half_t,
63
+ cutlass::layout::ColumnMajor,
64
+ cutlass::half_t,
65
+ cutlass::layout::RowMajor,
66
+ ElementOutput,
67
+ cutlass::layout::RowMajor,
68
+ ElementAccumulator,
69
+ cutlass::arch::OpClassWmmaTensorOp,
70
+ cutlass::arch::Sm70,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<64, 64, 32>,
73
+ cutlass::gemm::GemmShape<16, 16, 16>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ ElementOutput,
76
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
77
+ ElementAccumulator,
78
+ ElementAccumulator
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 2
82
+ >;
83
+
84
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
85
+ }
86
+
87
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32n_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include "cutlass/arch/wmma.h"
36
+
37
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
38
+ #include <iostream>
39
+
40
+ #include "cutlass/cutlass.h"
41
+ #include "cutlass/gemm/device/gemm.h"
42
+
43
+ #include "../../common/cutlass_unit_test.h"
44
+
45
+ #include "cutlass/util/host_tensor.h"
46
+ #include "cutlass/util/tensor_view_io.h"
47
+ #include "cutlass/util/reference/host/tensor_fill.h"
48
+ #include "cutlass/util/reference/host/tensor_copy.h"
49
+ #include "cutlass/util/reference/host/tensor_compare.h"
50
+ #include "cutlass/util/reference/host/gemm.h"
51
+
52
+ #include "testbed.h"
53
+
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F32 //////////
56
+ /////////////////////////////////////////////////////////////////////////////////////////////////
57
+
58
+ TEST(SM70_Device_Gemm_f16n_f16t_f32n_wmma_tensor_op_f32, 128x128x32_64x64x32_16x16x16) {
59
+
60
+ using ElementOutput = float;
61
+ using ElementAccumulator = float;
62
+
63
+ using Gemm = cutlass::gemm::device::Gemm<
64
+ cutlass::half_t,
65
+ cutlass::layout::ColumnMajor,
66
+ cutlass::half_t,
67
+ cutlass::layout::RowMajor,
68
+ ElementOutput,
69
+ cutlass::layout::ColumnMajor,
70
+ ElementAccumulator,
71
+ cutlass::arch::OpClassWmmaTensorOp,
72
+ cutlass::arch::Sm70,
73
+ cutlass::gemm::GemmShape<128, 128, 32>,
74
+ cutlass::gemm::GemmShape<64, 64, 32>,
75
+ cutlass::gemm::GemmShape<16, 16, 16>,
76
+ cutlass::epilogue::thread::LinearCombination<
77
+ ElementOutput,
78
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
79
+ ElementAccumulator,
80
+ ElementAccumulator
81
+ >,
82
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
83
+ 2
84
+ >;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
87
+ }
88
+
89
+
90
+ /////////////////////////////////////////////////////////////////////////////////////////////////
91
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F32=>F32 //////////
92
+ /////////////////////////////////////////////////////////////////////////////////////////////////
93
+ TEST(SM70_Device_Gemm_f16n_f16t_f32n_wmma_tensor_op_f32, 128x128x32_64x64x32_32x8x16) {
94
+
95
+ using ElementOutput = float;
96
+ using ElementAccumulator = float;
97
+
98
+ using Gemm = cutlass::gemm::device::Gemm<
99
+ cutlass::half_t,
100
+ cutlass::layout::ColumnMajor,
101
+ cutlass::half_t,
102
+ cutlass::layout::RowMajor,
103
+ ElementOutput,
104
+ cutlass::layout::ColumnMajor,
105
+ ElementAccumulator,
106
+ cutlass::arch::OpClassWmmaTensorOp,
107
+ cutlass::arch::Sm70,
108
+ cutlass::gemm::GemmShape<128, 128, 32>,
109
+ cutlass::gemm::GemmShape<64, 64, 32>,
110
+ cutlass::gemm::GemmShape<32, 8, 16>,
111
+ cutlass::epilogue::thread::LinearCombination<
112
+ ElementOutput,
113
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
114
+ ElementAccumulator,
115
+ ElementAccumulator
116
+ >,
117
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
118
+ 2
119
+ >;
120
+
121
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
122
+ }
123
+
124
+ /////////////////////////////////////////////////////////////////////////////////////////////////
125
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F32=>F32 //////////
126
+ /////////////////////////////////////////////////////////////////////////////////////////////////
127
+ TEST(SM70_Device_Gemm_f16n_f16t_f32n_wmma_tensor_op_f32, 128x128x32_64x64x32_8x32x16) {
128
+
129
+ using ElementOutput = float;
130
+ using ElementAccumulator = float;
131
+
132
+ using Gemm = cutlass::gemm::device::Gemm<
133
+ cutlass::half_t,
134
+ cutlass::layout::ColumnMajor,
135
+ cutlass::half_t,
136
+ cutlass::layout::RowMajor,
137
+ ElementOutput,
138
+ cutlass::layout::ColumnMajor,
139
+ ElementAccumulator,
140
+ cutlass::arch::OpClassWmmaTensorOp,
141
+ cutlass::arch::Sm70,
142
+ cutlass::gemm::GemmShape<128, 128, 32>,
143
+ cutlass::gemm::GemmShape<64, 64, 32>,
144
+ cutlass::gemm::GemmShape<8, 32, 16>,
145
+ cutlass::epilogue::thread::LinearCombination<
146
+ ElementOutput,
147
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
148
+ ElementAccumulator,
149
+ ElementAccumulator
150
+ >,
151
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
152
+ 2
153
+ >;
154
+
155
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
156
+ }
157
+ /////////////////////////////////////////////////////////////////////////////////////////////////
158
+
159
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_tensor_op_f32_sm75.cu ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "cutlass/util/host_tensor.h"
43
+ #include "cutlass/util/tensor_view_io.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/reference/host/tensor_copy.h"
46
+ #include "cutlass/util/reference/host/tensor_compare.h"
47
+ #include "cutlass/util/reference/host/gemm.h"
48
+
49
+ #include "testbed.h"
50
+
51
+ #if defined(CUTLASS_ARCH_MMA_SM75_SUPPORTED)
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+
55
+ TEST(SM75_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x256x32_64x64x32) {
56
+
57
+ using ElementOutput = float;
58
+ using ElementAccumulator = float;
59
+
60
+ using Gemm = cutlass::gemm::device::Gemm<
61
+ cutlass::half_t,
62
+ cutlass::layout::ColumnMajor,
63
+ cutlass::half_t,
64
+ cutlass::layout::RowMajor,
65
+ ElementOutput,
66
+ cutlass::layout::RowMajor,
67
+ ElementAccumulator,
68
+ cutlass::arch::OpClassTensorOp,
69
+ cutlass::arch::Sm75,
70
+ cutlass::gemm::GemmShape<128, 256, 32>,
71
+ cutlass::gemm::GemmShape<64, 64, 32>,
72
+ cutlass::gemm::GemmShape<16, 8, 8>,
73
+ cutlass::epilogue::thread::LinearCombination<
74
+ ElementOutput,
75
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
76
+ ElementAccumulator,
77
+ ElementAccumulator
78
+ >,
79
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
80
+ 2
81
+ >;
82
+
83
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
84
+ }
85
+
86
+ TEST(SM75_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x128x32_64x64x32) {
87
+
88
+ using ElementOutput = float;
89
+ using ElementAccumulator = float;
90
+
91
+ using Gemm = cutlass::gemm::device::Gemm<
92
+ cutlass::half_t,
93
+ cutlass::layout::ColumnMajor,
94
+ cutlass::half_t,
95
+ cutlass::layout::RowMajor,
96
+ ElementOutput,
97
+ cutlass::layout::RowMajor,
98
+ ElementAccumulator,
99
+ cutlass::arch::OpClassTensorOp,
100
+ cutlass::arch::Sm75,
101
+ cutlass::gemm::GemmShape<256, 128, 32>,
102
+ cutlass::gemm::GemmShape<64, 64, 32>,
103
+ cutlass::gemm::GemmShape<16, 8, 8>,
104
+ cutlass::epilogue::thread::LinearCombination<
105
+ ElementOutput,
106
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
107
+ ElementAccumulator,
108
+ ElementAccumulator
109
+ >,
110
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
111
+ 2
112
+ >;
113
+
114
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
115
+ }
116
+
117
+ TEST(SM75_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x128x32_64x64x32) {
118
+
119
+ using ElementOutput = float;
120
+ using ElementAccumulator = float;
121
+
122
+ using Gemm = cutlass::gemm::device::Gemm<
123
+ cutlass::half_t,
124
+ cutlass::layout::ColumnMajor,
125
+ cutlass::half_t,
126
+ cutlass::layout::RowMajor,
127
+ ElementOutput,
128
+ cutlass::layout::RowMajor,
129
+ ElementAccumulator,
130
+ cutlass::arch::OpClassTensorOp,
131
+ cutlass::arch::Sm75,
132
+ cutlass::gemm::GemmShape<128, 128, 32>,
133
+ cutlass::gemm::GemmShape<64, 64, 32>,
134
+ cutlass::gemm::GemmShape<16, 8, 8>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput,
137
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
138
+ ElementAccumulator,
139
+ ElementAccumulator
140
+ >,
141
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
142
+ 2
143
+ >;
144
+
145
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
146
+ }
147
+
148
+ TEST(SM75_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x128x32_32x64x32) {
149
+
150
+ using ElementOutput = float;
151
+ using ElementAccumulator = float;
152
+
153
+ using Gemm = cutlass::gemm::device::Gemm<
154
+ cutlass::half_t,
155
+ cutlass::layout::ColumnMajor,
156
+ cutlass::half_t,
157
+ cutlass::layout::RowMajor,
158
+ ElementOutput,
159
+ cutlass::layout::RowMajor,
160
+ ElementAccumulator,
161
+ cutlass::arch::OpClassTensorOp,
162
+ cutlass::arch::Sm75,
163
+ cutlass::gemm::GemmShape<64, 128, 32>,
164
+ cutlass::gemm::GemmShape<32, 64, 32>,
165
+ cutlass::gemm::GemmShape<16, 8, 8>,
166
+ cutlass::epilogue::thread::LinearCombination<
167
+ ElementOutput,
168
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
169
+ ElementAccumulator,
170
+ ElementAccumulator
171
+ >,
172
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
173
+ 2
174
+ >;
175
+
176
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
177
+ }
178
+
179
+ TEST(SM75_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x64x32_64x32x32) {
180
+
181
+ using ElementOutput = float;
182
+ using ElementAccumulator = float;
183
+
184
+ using Gemm = cutlass::gemm::device::Gemm<
185
+ cutlass::half_t,
186
+ cutlass::layout::ColumnMajor,
187
+ cutlass::half_t,
188
+ cutlass::layout::RowMajor,
189
+ ElementOutput,
190
+ cutlass::layout::RowMajor,
191
+ ElementAccumulator,
192
+ cutlass::arch::OpClassTensorOp,
193
+ cutlass::arch::Sm75,
194
+ cutlass::gemm::GemmShape<128, 64, 32>,
195
+ cutlass::gemm::GemmShape<64, 32, 32>,
196
+ cutlass::gemm::GemmShape<16, 8, 8>,
197
+ cutlass::epilogue::thread::LinearCombination<
198
+ ElementOutput,
199
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
200
+ ElementAccumulator,
201
+ ElementAccumulator
202
+ >,
203
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
204
+ 2
205
+ >;
206
+
207
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
208
+ }
209
+
210
+ TEST(SM75_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x64x32_32x32x32) {
211
+
212
+ using ElementOutput = float;
213
+ using ElementAccumulator = float;
214
+
215
+ using Gemm = cutlass::gemm::device::Gemm<
216
+ cutlass::half_t,
217
+ cutlass::layout::ColumnMajor,
218
+ cutlass::half_t,
219
+ cutlass::layout::RowMajor,
220
+ ElementOutput,
221
+ cutlass::layout::RowMajor,
222
+ ElementAccumulator,
223
+ cutlass::arch::OpClassTensorOp,
224
+ cutlass::arch::Sm75,
225
+ cutlass::gemm::GemmShape<64, 64, 32>,
226
+ cutlass::gemm::GemmShape<32, 32, 32>,
227
+ cutlass::gemm::GemmShape<16, 8, 8>,
228
+ cutlass::epilogue::thread::LinearCombination<
229
+ ElementOutput,
230
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
231
+ ElementAccumulator,
232
+ ElementAccumulator
233
+ >,
234
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
235
+ 2
236
+ >;
237
+
238
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
239
+ }
240
+
241
+ /////////////////////////////////////////////////////////////////////////////////////////////////
242
+
243
+ #endif
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_tensor_op_f32_sm80.cu ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed.h"
48
+ #include "testbed_universal.h"
49
+
50
+ #if (CUTLASS_ARCH_MMA_SM80_SUPPORTED)
51
+
52
+ ////////////////////////////////////////////////////////////////////////////////
53
+
54
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x256x64_64x64x64, {
55
+ using ElementOutput = float;
56
+ using ElementAccumulator = float;
57
+
58
+ using Gemm = cutlass::gemm::device::Gemm<
59
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
60
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
61
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
62
+ cutlass::gemm::GemmShape<128, 256, 64>,
63
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
64
+ cutlass::epilogue::thread::LinearCombination<
65
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
66
+ ElementAccumulator, ElementAccumulator>,
67
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
68
+
69
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
70
+ } )
71
+
72
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x128x64_64x64x64, {
73
+ using ElementOutput = float;
74
+ using ElementAccumulator = float;
75
+
76
+ using Gemm = cutlass::gemm::device::Gemm<
77
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
78
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
79
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
80
+ cutlass::gemm::GemmShape<256, 128, 64>,
81
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
82
+ cutlass::epilogue::thread::LinearCombination<
83
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
84
+ ElementAccumulator, ElementAccumulator>,
85
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
86
+
87
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
88
+ } )
89
+
90
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x128x64_64x64x64, {
91
+ using ElementOutput = float;
92
+ using ElementAccumulator = float;
93
+
94
+ using Gemm = cutlass::gemm::device::Gemm<
95
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
96
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
97
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
98
+ cutlass::gemm::GemmShape<128, 128, 64>,
99
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
100
+ cutlass::epilogue::thread::LinearCombination<
101
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
102
+ ElementAccumulator, ElementAccumulator>,
103
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
104
+
105
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
106
+ } )
107
+
108
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x128x64_64x64x64_sk, {
109
+ using ElementOutput = float;
110
+ using ElementAccumulator = float;
111
+
112
+ using Gemm = cutlass::gemm::device::GemmUniversal<
113
+ cutlass::half_t, cutlass::layout::ColumnMajor,
114
+ cutlass::half_t, cutlass::layout::RowMajor,
115
+ ElementOutput, cutlass::layout::RowMajor,
116
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
117
+ cutlass::gemm::GemmShape<128, 128, 64>,
118
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
119
+ cutlass::epilogue::thread::LinearCombination<
120
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
121
+ ElementAccumulator, ElementAccumulator>,
122
+ cutlass::gemm::threadblock::ThreadblockSwizzleStreamK, 3>;
123
+
124
+ EXPECT_TRUE(test::gemm::device::TestAllGemmUniversal<Gemm>());
125
+ } )
126
+
127
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32n_tensor_op_f32, 128x128x64_64x64x64_sk, {
128
+ using ElementOutput = float;
129
+ using ElementAccumulator = float;
130
+
131
+ using Gemm = cutlass::gemm::device::GemmUniversal<
132
+ cutlass::half_t, cutlass::layout::ColumnMajor,
133
+ cutlass::half_t, cutlass::layout::RowMajor,
134
+ ElementOutput, cutlass::layout::ColumnMajor,
135
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
136
+ cutlass::gemm::GemmShape<128, 128, 64>,
137
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
138
+ cutlass::epilogue::thread::LinearCombination<
139
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
140
+ ElementAccumulator, ElementAccumulator>,
141
+ cutlass::gemm::threadblock::ThreadblockSwizzleStreamK, 3>;
142
+
143
+ EXPECT_TRUE(test::gemm::device::TestAllGemmUniversal<Gemm>());
144
+ } )
145
+
146
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x64x64_64x64x64, {
147
+ using ElementOutput = float;
148
+ using ElementAccumulator = float;
149
+
150
+ using Gemm = cutlass::gemm::device::Gemm<
151
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
152
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
153
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
154
+ cutlass::gemm::GemmShape<256, 64, 64>,
155
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
156
+ cutlass::epilogue::thread::LinearCombination<
157
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
158
+ ElementAccumulator, ElementAccumulator>,
159
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
160
+
161
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
162
+ } )
163
+
164
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x256x64_64x64x64, {
165
+ using ElementOutput = float;
166
+ using ElementAccumulator = float;
167
+
168
+ using Gemm = cutlass::gemm::device::Gemm<
169
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
170
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
171
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
172
+ cutlass::gemm::GemmShape<64, 256, 64>,
173
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
174
+ cutlass::epilogue::thread::LinearCombination<
175
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
176
+ ElementAccumulator, ElementAccumulator>,
177
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
178
+
179
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
180
+ } )
181
+
182
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x128x64_32x64x64, {
183
+ using ElementOutput = float;
184
+ using ElementAccumulator = float;
185
+
186
+ using Gemm = cutlass::gemm::device::Gemm<
187
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
188
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
189
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
190
+ cutlass::gemm::GemmShape<64, 128, 64>,
191
+ cutlass::gemm::GemmShape<32, 64, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
192
+ cutlass::epilogue::thread::LinearCombination<
193
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
194
+ ElementAccumulator, ElementAccumulator>,
195
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
196
+
197
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
198
+ } )
199
+
200
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x64x64_64x32x64, {
201
+ using ElementOutput = float;
202
+ using ElementAccumulator = float;
203
+
204
+ using Gemm = cutlass::gemm::device::Gemm<
205
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
206
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
207
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
208
+ cutlass::gemm::GemmShape<128, 64, 64>,
209
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
210
+ cutlass::epilogue::thread::LinearCombination<
211
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
212
+ ElementAccumulator, ElementAccumulator>,
213
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
214
+
215
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
216
+ } )
217
+
218
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x64x64_32x32x64, {
219
+ using ElementOutput = float;
220
+ using ElementAccumulator = float;
221
+
222
+ using Gemm = cutlass::gemm::device::Gemm<
223
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
224
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
225
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
226
+ cutlass::gemm::GemmShape<64, 64, 64>,
227
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 16>,
228
+ cutlass::epilogue::thread::LinearCombination<
229
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
230
+ ElementAccumulator, ElementAccumulator>,
231
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
232
+
233
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
234
+ } )
235
+
236
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x256x32_64x64x32, {
237
+ using ElementOutput = float;
238
+ using ElementAccumulator = float;
239
+
240
+ using Gemm = cutlass::gemm::device::Gemm<
241
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
242
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
243
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
244
+ cutlass::gemm::GemmShape<128, 256, 32>,
245
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
246
+ cutlass::epilogue::thread::LinearCombination<
247
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
248
+ ElementAccumulator, ElementAccumulator>,
249
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
250
+
251
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
252
+ } )
253
+
254
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x128x32_64x64x32, {
255
+ using ElementOutput = float;
256
+ using ElementAccumulator = float;
257
+
258
+ using Gemm = cutlass::gemm::device::Gemm<
259
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
260
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
261
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
262
+ cutlass::gemm::GemmShape<256, 128, 32>,
263
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
264
+ cutlass::epilogue::thread::LinearCombination<
265
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
266
+ ElementAccumulator, ElementAccumulator>,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
268
+
269
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
270
+ } )
271
+
272
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x128x32_64x64x32, {
273
+ using ElementOutput = float;
274
+ using ElementAccumulator = float;
275
+
276
+ using Gemm = cutlass::gemm::device::Gemm<
277
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
278
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
279
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
280
+ cutlass::gemm::GemmShape<128, 128, 32>,
281
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
282
+ cutlass::epilogue::thread::LinearCombination<
283
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
284
+ ElementAccumulator, ElementAccumulator>,
285
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
286
+
287
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
288
+ } )
289
+
290
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x64x32_64x64x32, {
291
+ using ElementOutput = float;
292
+ using ElementAccumulator = float;
293
+
294
+ using Gemm = cutlass::gemm::device::Gemm<
295
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
296
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
297
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
298
+ cutlass::gemm::GemmShape<256, 64, 32>,
299
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
300
+ cutlass::epilogue::thread::LinearCombination<
301
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
302
+ ElementAccumulator, ElementAccumulator>,
303
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
304
+
305
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
306
+ } )
307
+
308
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x256x32_64x64x32, {
309
+ using ElementOutput = float;
310
+ using ElementAccumulator = float;
311
+
312
+ using Gemm = cutlass::gemm::device::Gemm<
313
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
314
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
315
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
316
+ cutlass::gemm::GemmShape<64, 256, 32>,
317
+ cutlass::gemm::GemmShape<64, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
318
+ cutlass::epilogue::thread::LinearCombination<
319
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
320
+ ElementAccumulator, ElementAccumulator>,
321
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
322
+
323
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
324
+ } )
325
+
326
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x128x32_32x64x32, {
327
+ using ElementOutput = float;
328
+ using ElementAccumulator = float;
329
+
330
+ using Gemm = cutlass::gemm::device::Gemm<
331
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
332
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
333
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
334
+ cutlass::gemm::GemmShape<64, 128, 32>,
335
+ cutlass::gemm::GemmShape<32, 64, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
336
+ cutlass::epilogue::thread::LinearCombination<
337
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
338
+ ElementAccumulator, ElementAccumulator>,
339
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
340
+
341
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
342
+ } )
343
+
344
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x64x32_64x32x32, {
345
+ using ElementOutput = float;
346
+ using ElementAccumulator = float;
347
+
348
+ using Gemm = cutlass::gemm::device::Gemm<
349
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
350
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
351
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
352
+ cutlass::gemm::GemmShape<128, 64, 32>,
353
+ cutlass::gemm::GemmShape<64, 32, 32>,
354
+ cutlass::gemm::GemmShape<16, 8, 16>,
355
+ cutlass::epilogue::thread::LinearCombination<
356
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
357
+ ElementAccumulator, ElementAccumulator>,
358
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
359
+
360
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
361
+ } )
362
+
363
+ CUTLASS_TEST_L1(SM80_Device_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x64x32_32x32x32, {
364
+ using ElementOutput = float;
365
+ using ElementAccumulator = float;
366
+
367
+ using Gemm = cutlass::gemm::device::Gemm<
368
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
369
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
370
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
371
+ cutlass::gemm::GemmShape<64, 64, 32>,
372
+ cutlass::gemm::GemmShape<32, 32, 32>, cutlass::gemm::GemmShape<16, 8, 16>,
373
+ cutlass::epilogue::thread::LinearCombination<
374
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
375
+ ElementAccumulator, ElementAccumulator>,
376
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
377
+
378
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
379
+ } )
380
+
381
+ ////////////////////////////////////////////////////////////////////////////////
382
+
383
+ #endif // CUTLASS_ARCH_MMA_SM80_SUPPORTED
384
+
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_tensor_op_f32_sparse_sm80.cu ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "../../common/cutlass_unit_test.h"
38
+ #include "cutlass/cutlass.h"
39
+ #include "cutlass/gemm/device/gemm_sparse.h"
40
+ #include "cutlass/util/host_tensor.h"
41
+ #include "cutlass/util/reference/host/gemm.h"
42
+ #include "cutlass/util/reference/host/tensor_compare.h"
43
+ #include "cutlass/util/reference/host/tensor_copy.h"
44
+ #include "cutlass/util/reference/host/tensor_fill.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+
47
+ #include "testbed_sparse.h"
48
+
49
+ #if (CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED)
50
+
51
+ ////////////////////////////////////////////////////////////////////////////////
52
+
53
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x256x64_64x64x64) {
54
+ using ElementOutput = float;
55
+ using ElementAccumulator = float;
56
+
57
+ using Gemm = cutlass::gemm::device::SparseGemm<
58
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
59
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
60
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
61
+ cutlass::gemm::GemmShape<128, 256, 64>,
62
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
63
+ cutlass::epilogue::thread::LinearCombination<
64
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
65
+ ElementAccumulator, ElementAccumulator>,
66
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
67
+
68
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
69
+ }
70
+
71
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x128x64_64x64x64) {
72
+ using ElementOutput = float;
73
+ using ElementAccumulator = float;
74
+
75
+ using Gemm = cutlass::gemm::device::SparseGemm<
76
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
77
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
78
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
79
+ cutlass::gemm::GemmShape<256, 128, 64>,
80
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
81
+ cutlass::epilogue::thread::LinearCombination<
82
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
83
+ ElementAccumulator, ElementAccumulator>,
84
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
85
+
86
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
87
+ }
88
+
89
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x128x64_64x64x64) {
90
+ using ElementOutput = float;
91
+ using ElementAccumulator = float;
92
+
93
+ using Gemm = cutlass::gemm::device::SparseGemm<
94
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
95
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
96
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
97
+ cutlass::gemm::GemmShape<128, 128, 64>,
98
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
99
+ cutlass::epilogue::thread::LinearCombination<
100
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
101
+ ElementAccumulator, ElementAccumulator>,
102
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
103
+
104
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
105
+ }
106
+
107
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x64x64_64x64x64) {
108
+ using ElementOutput = float;
109
+ using ElementAccumulator = float;
110
+
111
+ using Gemm = cutlass::gemm::device::SparseGemm<
112
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
113
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
114
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
115
+ cutlass::gemm::GemmShape<256, 64, 64>,
116
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
117
+ cutlass::epilogue::thread::LinearCombination<
118
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
119
+ ElementAccumulator, ElementAccumulator>,
120
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
121
+
122
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
123
+ }
124
+
125
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x256x64_64x64x64) {
126
+ using ElementOutput = float;
127
+ using ElementAccumulator = float;
128
+
129
+ using Gemm = cutlass::gemm::device::SparseGemm<
130
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
131
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
132
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
133
+ cutlass::gemm::GemmShape<64, 256, 64>,
134
+ cutlass::gemm::GemmShape<64, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
135
+ cutlass::epilogue::thread::LinearCombination<
136
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
137
+ ElementAccumulator, ElementAccumulator>,
138
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
139
+
140
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
141
+ }
142
+
143
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x128x64_32x64x64) {
144
+ using ElementOutput = float;
145
+ using ElementAccumulator = float;
146
+
147
+ using Gemm = cutlass::gemm::device::SparseGemm<
148
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
149
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
150
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
151
+ cutlass::gemm::GemmShape<64, 128, 64>,
152
+ cutlass::gemm::GemmShape<32, 64, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
153
+ cutlass::epilogue::thread::LinearCombination<
154
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
155
+ ElementAccumulator, ElementAccumulator>,
156
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
157
+
158
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
159
+ }
160
+
161
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x64x64_64x32x64) {
162
+ using ElementOutput = float;
163
+ using ElementAccumulator = float;
164
+
165
+ using Gemm = cutlass::gemm::device::SparseGemm<
166
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
167
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
168
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
169
+ cutlass::gemm::GemmShape<128, 64, 64>,
170
+ cutlass::gemm::GemmShape<64, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
171
+ cutlass::epilogue::thread::LinearCombination<
172
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
173
+ ElementAccumulator, ElementAccumulator>,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
175
+
176
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
177
+ }
178
+
179
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x64x64_32x32x64) {
180
+ using ElementOutput = float;
181
+ using ElementAccumulator = float;
182
+
183
+ using Gemm = cutlass::gemm::device::SparseGemm<
184
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
185
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
186
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
187
+ cutlass::gemm::GemmShape<64, 64, 64>,
188
+ cutlass::gemm::GemmShape<32, 32, 64>, cutlass::gemm::GemmShape<16, 8, 32>,
189
+ cutlass::epilogue::thread::LinearCombination<
190
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
191
+ ElementAccumulator, ElementAccumulator>,
192
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 10>;
193
+
194
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
195
+ }
196
+
197
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x128x128_64x64x128) {
198
+ using ElementOutput = float;
199
+ using ElementAccumulator = float;
200
+
201
+ using Gemm = cutlass::gemm::device::SparseGemm<
202
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
203
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
204
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
205
+ cutlass::gemm::GemmShape<128, 128, 128>,
206
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
207
+ cutlass::epilogue::thread::LinearCombination<
208
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
209
+ ElementAccumulator, ElementAccumulator>,
210
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
211
+
212
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
213
+ }
214
+
215
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 256x64x128_64x64x128) {
216
+ using ElementOutput = float;
217
+ using ElementAccumulator = float;
218
+
219
+ using Gemm = cutlass::gemm::device::SparseGemm<
220
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
221
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
222
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
223
+ cutlass::gemm::GemmShape<256, 64, 128>,
224
+ cutlass::gemm::GemmShape<64, 64, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
225
+ cutlass::epilogue::thread::LinearCombination<
226
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
227
+ ElementAccumulator, ElementAccumulator>,
228
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 3>;
229
+
230
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
231
+ }
232
+
233
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 128x64x128_64x32x128) {
234
+ using ElementOutput = float;
235
+ using ElementAccumulator = float;
236
+
237
+ using Gemm = cutlass::gemm::device::SparseGemm<
238
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
239
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
240
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
241
+ cutlass::gemm::GemmShape<128, 64, 128>,
242
+ cutlass::gemm::GemmShape<64, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
243
+ cutlass::epilogue::thread::LinearCombination<
244
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
245
+ ElementAccumulator, ElementAccumulator>,
246
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 4>;
247
+
248
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
249
+ }
250
+
251
+ TEST(SM80_Device_Sparse_Gemm_f16n_f16t_f32t_tensor_op_f32, 64x64x128_32x32x128) {
252
+ using ElementOutput = float;
253
+ using ElementAccumulator = float;
254
+
255
+ using Gemm = cutlass::gemm::device::SparseGemm<
256
+ cutlass::half_t, cutlass::layout::ColumnMajor, cutlass::half_t,
257
+ cutlass::layout::RowMajor, ElementOutput, cutlass::layout::RowMajor,
258
+ ElementAccumulator, cutlass::arch::OpClassTensorOp, cutlass::arch::Sm80,
259
+ cutlass::gemm::GemmShape<64, 64, 128>,
260
+ cutlass::gemm::GemmShape<32, 32, 128>, cutlass::gemm::GemmShape<16, 8, 32>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput, 128 / cutlass::sizeof_bits<ElementOutput>::value,
263
+ ElementAccumulator, ElementAccumulator>,
264
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>, 6>;
265
+
266
+ EXPECT_TRUE(test::gemm::device::TestAllSparseGemm<Gemm>());
267
+ }
268
+
269
+ ////////////////////////////////////////////////////////////////////////////////
270
+
271
+ #endif // CUTLASS_ARCH_SPARSE_MMA_SM80_SUPPORTED
272
+
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_volta_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include <iostream>
36
+
37
+ #include "cutlass/cutlass.h"
38
+ #include "cutlass/gemm/device/gemm.h"
39
+
40
+ #include "../../common/cutlass_unit_test.h"
41
+
42
+ #include "testbed.h"
43
+
44
+ #if defined(CUTLASS_ARCH_MMA_SM70_SUPPORTED)
45
+
46
+ /////////////////////////////////////////////////////////////////////////////////////////////////
47
+
48
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_volta_tensor_op_f32, 128x256x32_64x64x32) {
49
+
50
+ using ElementOutput = float;
51
+ using ElementAccumulator = float;
52
+
53
+ using Gemm = cutlass::gemm::device::Gemm<
54
+ cutlass::half_t,
55
+ cutlass::layout::ColumnMajor,
56
+ cutlass::half_t,
57
+ cutlass::layout::RowMajor,
58
+ ElementOutput,
59
+ cutlass::layout::RowMajor,
60
+ ElementAccumulator,
61
+ cutlass::arch::OpClassTensorOp,
62
+ cutlass::arch::Sm70,
63
+ cutlass::gemm::GemmShape<128, 256, 32>,
64
+ cutlass::gemm::GemmShape<64, 64, 32>,
65
+ cutlass::gemm::GemmShape<8, 8, 4>,
66
+ cutlass::epilogue::thread::LinearCombination<
67
+ ElementOutput,
68
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
69
+ ElementAccumulator,
70
+ ElementAccumulator
71
+ >,
72
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
73
+ 2
74
+ >;
75
+
76
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
77
+ }
78
+
79
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_volta_tensor_op_f32, 256x128x32_64x64x32) {
80
+
81
+ using ElementOutput = float;
82
+ using ElementAccumulator = float;
83
+
84
+ using Gemm = cutlass::gemm::device::Gemm<
85
+ cutlass::half_t,
86
+ cutlass::layout::ColumnMajor,
87
+ cutlass::half_t,
88
+ cutlass::layout::RowMajor,
89
+ ElementOutput,
90
+ cutlass::layout::RowMajor,
91
+ ElementAccumulator,
92
+ cutlass::arch::OpClassTensorOp,
93
+ cutlass::arch::Sm70,
94
+ cutlass::gemm::GemmShape<256, 128, 32>,
95
+ cutlass::gemm::GemmShape<64, 64, 32>,
96
+ cutlass::gemm::GemmShape<8, 8, 4>,
97
+ cutlass::epilogue::thread::LinearCombination<
98
+ ElementOutput,
99
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
100
+ ElementAccumulator,
101
+ ElementAccumulator
102
+ >,
103
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
104
+ 2
105
+ >;
106
+
107
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
108
+ }
109
+
110
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_volta_tensor_op_f32, 128x128x32_64x64x32) {
111
+
112
+ using ElementOutput = float;
113
+ using ElementAccumulator = float;
114
+
115
+ using Gemm = cutlass::gemm::device::Gemm<
116
+ cutlass::half_t,
117
+ cutlass::layout::ColumnMajor,
118
+ cutlass::half_t,
119
+ cutlass::layout::RowMajor,
120
+ ElementOutput,
121
+ cutlass::layout::RowMajor,
122
+ ElementAccumulator,
123
+ cutlass::arch::OpClassTensorOp,
124
+ cutlass::arch::Sm70,
125
+ cutlass::gemm::GemmShape<128, 128, 32>,
126
+ cutlass::gemm::GemmShape<64, 64, 32>,
127
+ cutlass::gemm::GemmShape<8, 8, 4>,
128
+ cutlass::epilogue::thread::LinearCombination<
129
+ ElementOutput,
130
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
131
+ ElementAccumulator,
132
+ ElementAccumulator
133
+ >,
134
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
135
+ 2
136
+ >;
137
+
138
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
139
+ }
140
+
141
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_volta_tensor_op_f32, 128x64x32_64x32x32) {
142
+
143
+ using ElementOutput = float;
144
+ using ElementAccumulator = float;
145
+
146
+ using Gemm = cutlass::gemm::device::Gemm<
147
+ cutlass::half_t,
148
+ cutlass::layout::ColumnMajor,
149
+ cutlass::half_t,
150
+ cutlass::layout::RowMajor,
151
+ ElementOutput,
152
+ cutlass::layout::RowMajor,
153
+ ElementAccumulator,
154
+ cutlass::arch::OpClassTensorOp,
155
+ cutlass::arch::Sm70,
156
+ cutlass::gemm::GemmShape<128, 64, 32>,
157
+ cutlass::gemm::GemmShape<64, 32, 32>,
158
+ cutlass::gemm::GemmShape<8, 8, 4>,
159
+ cutlass::epilogue::thread::LinearCombination<
160
+ ElementOutput,
161
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
162
+ ElementAccumulator,
163
+ ElementAccumulator
164
+ >,
165
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
166
+ 2
167
+ >;
168
+
169
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
170
+ }
171
+
172
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_volta_tensor_op_f32, 64x128x32_32x64x32) {
173
+
174
+ using ElementOutput = float;
175
+ using ElementAccumulator = float;
176
+
177
+ using Gemm = cutlass::gemm::device::Gemm<
178
+ cutlass::half_t,
179
+ cutlass::layout::ColumnMajor,
180
+ cutlass::half_t,
181
+ cutlass::layout::RowMajor,
182
+ ElementOutput,
183
+ cutlass::layout::RowMajor,
184
+ ElementAccumulator,
185
+ cutlass::arch::OpClassTensorOp,
186
+ cutlass::arch::Sm70,
187
+ cutlass::gemm::GemmShape<64, 128, 32>,
188
+ cutlass::gemm::GemmShape<32, 64, 32>,
189
+ cutlass::gemm::GemmShape<8, 8, 4>,
190
+ cutlass::epilogue::thread::LinearCombination<
191
+ ElementOutput,
192
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
193
+ ElementAccumulator,
194
+ ElementAccumulator
195
+ >,
196
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
197
+ 2
198
+ >;
199
+
200
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
201
+ }
202
+
203
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_volta_tensor_op_f32, 64x64x32_64x64x32) {
204
+
205
+ using ElementOutput = float;
206
+ using ElementAccumulator = float;
207
+
208
+ using Gemm = cutlass::gemm::device::Gemm<
209
+ cutlass::half_t,
210
+ cutlass::layout::ColumnMajor,
211
+ cutlass::half_t,
212
+ cutlass::layout::RowMajor,
213
+ ElementOutput,
214
+ cutlass::layout::RowMajor,
215
+ ElementAccumulator,
216
+ cutlass::arch::OpClassTensorOp,
217
+ cutlass::arch::Sm70,
218
+ cutlass::gemm::GemmShape<64, 64, 32>,
219
+ cutlass::gemm::GemmShape<64, 64, 32>,
220
+ cutlass::gemm::GemmShape<8, 8, 4>,
221
+ cutlass::epilogue::thread::LinearCombination<
222
+ ElementOutput,
223
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
224
+ ElementAccumulator,
225
+ ElementAccumulator
226
+ >,
227
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
228
+ 2
229
+ >;
230
+
231
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
232
+ }
233
+
234
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_volta_tensor_op_f32, 64x64x32_32x32x32) {
235
+
236
+ using ElementOutput = float;
237
+ using ElementAccumulator = float;
238
+
239
+ using Gemm = cutlass::gemm::device::Gemm<
240
+ cutlass::half_t,
241
+ cutlass::layout::ColumnMajor,
242
+ cutlass::half_t,
243
+ cutlass::layout::RowMajor,
244
+ ElementOutput,
245
+ cutlass::layout::RowMajor,
246
+ ElementAccumulator,
247
+ cutlass::arch::OpClassTensorOp,
248
+ cutlass::arch::Sm70,
249
+ cutlass::gemm::GemmShape<64, 64, 32>,
250
+ cutlass::gemm::GemmShape<32, 32, 32>,
251
+ cutlass::gemm::GemmShape<8, 8, 4>,
252
+ cutlass::epilogue::thread::LinearCombination<
253
+ ElementOutput,
254
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
255
+ ElementAccumulator,
256
+ ElementAccumulator
257
+ >,
258
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
259
+ 2
260
+ >;
261
+
262
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
263
+ }
264
+
265
+ /////////////////////////////////////////////////////////////////////////////////////////////////
266
+
267
+ #endif // if (CUTLASS_ENABLE_TENSOR_CORE_MMA)
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16n_f16t_f32t_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+
35
+ #include "cutlass/arch/wmma.h"
36
+
37
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
38
+ #include <iostream>
39
+
40
+ #include "cutlass/cutlass.h"
41
+ #include "cutlass/gemm/device/gemm.h"
42
+
43
+ #include "../../common/cutlass_unit_test.h"
44
+
45
+ #include "cutlass/util/host_tensor.h"
46
+ #include "cutlass/util/tensor_view_io.h"
47
+ #include "cutlass/util/reference/host/tensor_fill.h"
48
+ #include "cutlass/util/reference/host/tensor_copy.h"
49
+ #include "cutlass/util/reference/host/tensor_compare.h"
50
+ #include "cutlass/util/reference/host/gemm.h"
51
+
52
+ #include "testbed.h"
53
+
54
+ /////////////////////////////////////////////////////////////////////////////////////////////////
55
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F32 //////////
56
+ /////////////////////////////////////////////////////////////////////////////////////////////////
57
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 64x64x32_64x64x32_16x16x16) {
58
+
59
+ using ElementOutput = float;
60
+ using ElementAccumulator = float;
61
+
62
+ using Gemm = cutlass::gemm::device::Gemm<
63
+ cutlass::half_t,
64
+ cutlass::layout::ColumnMajor,
65
+ cutlass::half_t,
66
+ cutlass::layout::RowMajor,
67
+ ElementOutput,
68
+ cutlass::layout::RowMajor,
69
+ ElementAccumulator,
70
+ cutlass::arch::OpClassWmmaTensorOp,
71
+ cutlass::arch::Sm70,
72
+ cutlass::gemm::GemmShape<64, 64, 32>,
73
+ cutlass::gemm::GemmShape<64, 64, 32>,
74
+ cutlass::gemm::GemmShape<16, 16, 16>,
75
+ cutlass::epilogue::thread::LinearCombination<
76
+ ElementOutput,
77
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
78
+ ElementAccumulator,
79
+ ElementAccumulator
80
+ >,
81
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
82
+ 2
83
+ >;
84
+
85
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
86
+ }
87
+
88
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 128x128x32_64x64x32_16x16x16) {
89
+
90
+ using ElementOutput = float;
91
+ using ElementAccumulator = float;
92
+
93
+ using Gemm = cutlass::gemm::device::Gemm<
94
+ cutlass::half_t,
95
+ cutlass::layout::ColumnMajor,
96
+ cutlass::half_t,
97
+ cutlass::layout::RowMajor,
98
+ ElementOutput,
99
+ cutlass::layout::RowMajor,
100
+ ElementAccumulator,
101
+ cutlass::arch::OpClassWmmaTensorOp,
102
+ cutlass::arch::Sm70,
103
+ cutlass::gemm::GemmShape<128, 128, 32>,
104
+ cutlass::gemm::GemmShape<64, 64, 32>,
105
+ cutlass::gemm::GemmShape<16, 16, 16>,
106
+ cutlass::epilogue::thread::LinearCombination<
107
+ ElementOutput,
108
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
109
+ ElementAccumulator,
110
+ ElementAccumulator
111
+ >,
112
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
113
+ 2
114
+ >;
115
+
116
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
117
+ }
118
+
119
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 128x256x32_64x64x32_16x16x16) {
120
+
121
+ using ElementOutput = float;
122
+ using ElementAccumulator = float;
123
+
124
+ using Gemm = cutlass::gemm::device::Gemm<
125
+ cutlass::half_t,
126
+ cutlass::layout::ColumnMajor,
127
+ cutlass::half_t,
128
+ cutlass::layout::RowMajor,
129
+ ElementOutput,
130
+ cutlass::layout::RowMajor,
131
+ ElementAccumulator,
132
+ cutlass::arch::OpClassWmmaTensorOp,
133
+ cutlass::arch::Sm70,
134
+ cutlass::gemm::GemmShape<128, 256, 32>,
135
+ cutlass::gemm::GemmShape<64, 64, 32>,
136
+ cutlass::gemm::GemmShape<16, 16, 16>,
137
+ cutlass::epilogue::thread::LinearCombination<
138
+ ElementOutput,
139
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
140
+ ElementAccumulator,
141
+ ElementAccumulator
142
+ >,
143
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
144
+ 2
145
+ >;
146
+
147
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
148
+ }
149
+
150
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 256x128x32_64x64x32_16x16x16) {
151
+
152
+ using ElementOutput = float;
153
+ using ElementAccumulator = float;
154
+
155
+ using Gemm = cutlass::gemm::device::Gemm<
156
+ cutlass::half_t,
157
+ cutlass::layout::ColumnMajor,
158
+ cutlass::half_t,
159
+ cutlass::layout::RowMajor,
160
+ ElementOutput,
161
+ cutlass::layout::RowMajor,
162
+ ElementAccumulator,
163
+ cutlass::arch::OpClassWmmaTensorOp,
164
+ cutlass::arch::Sm70,
165
+ cutlass::gemm::GemmShape<256, 128, 32>,
166
+ cutlass::gemm::GemmShape<64, 64, 32>,
167
+ cutlass::gemm::GemmShape<16, 16, 16>,
168
+ cutlass::epilogue::thread::LinearCombination<
169
+ ElementOutput,
170
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
171
+ ElementAccumulator,
172
+ ElementAccumulator
173
+ >,
174
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
175
+ 2
176
+ >;
177
+
178
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
179
+ }
180
+
181
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 128x64x32_64x32x32_16x16x16) {
182
+
183
+ using ElementOutput = float;
184
+ using ElementAccumulator = float;
185
+
186
+ using Gemm = cutlass::gemm::device::Gemm<
187
+ cutlass::half_t,
188
+ cutlass::layout::ColumnMajor,
189
+ cutlass::half_t,
190
+ cutlass::layout::RowMajor,
191
+ ElementOutput,
192
+ cutlass::layout::RowMajor,
193
+ ElementAccumulator,
194
+ cutlass::arch::OpClassWmmaTensorOp,
195
+ cutlass::arch::Sm70,
196
+ cutlass::gemm::GemmShape<128, 64, 32>,
197
+ cutlass::gemm::GemmShape<64, 32, 32>,
198
+ cutlass::gemm::GemmShape<16, 16, 16>,
199
+ cutlass::epilogue::thread::LinearCombination<
200
+ ElementOutput,
201
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
202
+ ElementAccumulator,
203
+ ElementAccumulator
204
+ >,
205
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
206
+ 2
207
+ >;
208
+
209
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
210
+ }
211
+
212
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 64x128x32_64x32x32_16x16x16) {
213
+
214
+ using ElementOutput = float;
215
+ using ElementAccumulator = float;
216
+
217
+ using Gemm = cutlass::gemm::device::Gemm<
218
+ cutlass::half_t,
219
+ cutlass::layout::ColumnMajor,
220
+ cutlass::half_t,
221
+ cutlass::layout::RowMajor,
222
+ ElementOutput,
223
+ cutlass::layout::RowMajor,
224
+ ElementAccumulator,
225
+ cutlass::arch::OpClassWmmaTensorOp,
226
+ cutlass::arch::Sm70,
227
+ cutlass::gemm::GemmShape<64, 128, 32>,
228
+ cutlass::gemm::GemmShape<64, 32, 32>,
229
+ cutlass::gemm::GemmShape<16, 16, 16>,
230
+ cutlass::epilogue::thread::LinearCombination<
231
+ ElementOutput,
232
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
233
+ ElementAccumulator,
234
+ ElementAccumulator
235
+ >,
236
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
237
+ 2
238
+ >;
239
+
240
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
241
+ }
242
+
243
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 64x64x32_32x32x32_16x16x16) {
244
+
245
+ using ElementOutput = float;
246
+ using ElementAccumulator = float;
247
+
248
+ using Gemm = cutlass::gemm::device::Gemm<
249
+ cutlass::half_t,
250
+ cutlass::layout::ColumnMajor,
251
+ cutlass::half_t,
252
+ cutlass::layout::RowMajor,
253
+ ElementOutput,
254
+ cutlass::layout::RowMajor,
255
+ ElementAccumulator,
256
+ cutlass::arch::OpClassWmmaTensorOp,
257
+ cutlass::arch::Sm70,
258
+ cutlass::gemm::GemmShape<64, 64, 32>,
259
+ cutlass::gemm::GemmShape<32, 32, 32>,
260
+ cutlass::gemm::GemmShape<16, 16, 16>,
261
+ cutlass::epilogue::thread::LinearCombination<
262
+ ElementOutput,
263
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
264
+ ElementAccumulator,
265
+ ElementAccumulator
266
+ >,
267
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
268
+ 2
269
+ >;
270
+
271
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
272
+ }
273
+
274
+
275
+ /////////////////////////////////////////////////////////////////////////////////////////////////
276
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F32=>F32 //////////
277
+ /////////////////////////////////////////////////////////////////////////////////////////////////
278
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 128x128x32_64x64x32_32x8x16) {
279
+
280
+ using ElementOutput = float;
281
+ using ElementAccumulator = float;
282
+
283
+ using Gemm = cutlass::gemm::device::Gemm<
284
+ cutlass::half_t,
285
+ cutlass::layout::ColumnMajor,
286
+ cutlass::half_t,
287
+ cutlass::layout::RowMajor,
288
+ ElementOutput,
289
+ cutlass::layout::RowMajor,
290
+ ElementAccumulator,
291
+ cutlass::arch::OpClassWmmaTensorOp,
292
+ cutlass::arch::Sm70,
293
+ cutlass::gemm::GemmShape<128, 128, 32>,
294
+ cutlass::gemm::GemmShape<64, 64, 32>,
295
+ cutlass::gemm::GemmShape<32, 8, 16>,
296
+ cutlass::epilogue::thread::LinearCombination<
297
+ ElementOutput,
298
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
299
+ ElementAccumulator,
300
+ ElementAccumulator
301
+ >,
302
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
303
+ 2
304
+ >;
305
+
306
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
307
+ }
308
+
309
+ /////////////////////////////////////////////////////////////////////////////////////////////////
310
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F32=>F32 //////////
311
+ /////////////////////////////////////////////////////////////////////////////////////////////////
312
+ TEST(SM70_Device_Gemm_f16n_f16t_f32t_wmma_tensor_op_f32, 128x128x32_64x64x32_8x32x16) {
313
+
314
+ using ElementOutput = float;
315
+ using ElementAccumulator = float;
316
+
317
+ using Gemm = cutlass::gemm::device::Gemm<
318
+ cutlass::half_t,
319
+ cutlass::layout::ColumnMajor,
320
+ cutlass::half_t,
321
+ cutlass::layout::RowMajor,
322
+ ElementOutput,
323
+ cutlass::layout::RowMajor,
324
+ ElementAccumulator,
325
+ cutlass::arch::OpClassWmmaTensorOp,
326
+ cutlass::arch::Sm70,
327
+ cutlass::gemm::GemmShape<128, 128, 32>,
328
+ cutlass::gemm::GemmShape<64, 64, 32>,
329
+ cutlass::gemm::GemmShape<8, 32, 16>,
330
+ cutlass::epilogue::thread::LinearCombination<
331
+ ElementOutput,
332
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
333
+ ElementAccumulator,
334
+ ElementAccumulator
335
+ >,
336
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
337
+ 2
338
+ >;
339
+
340
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
341
+ }
342
+ /////////////////////////////////////////////////////////////////////////////////////////////////
343
+
344
+ #endif // CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16t_f16n_f16n_wmma_tensor_op_f16_sm70.cu ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F16=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+
57
+ TEST(SM70_Device_Gemm_f16t_f16n_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_16x16x16) {
58
+ // single cta, two warps horizontally two waprs vertically
59
+ using ElementOutput = cutlass::half_t;
60
+ using ElementAccumulator = cutlass::half_t;
61
+
62
+ using Gemm = cutlass::gemm::device::Gemm<
63
+ cutlass::half_t,
64
+ cutlass::layout::RowMajor,
65
+ cutlass::half_t,
66
+ cutlass::layout::ColumnMajor,
67
+ ElementOutput,
68
+ cutlass::layout::ColumnMajor,
69
+ ElementAccumulator,
70
+ cutlass::arch::OpClassWmmaTensorOp,
71
+ cutlass::arch::Sm70,
72
+ cutlass::gemm::GemmShape<128, 128, 32>,
73
+ cutlass::gemm::GemmShape<64, 64, 32>,
74
+ cutlass::gemm::GemmShape<16, 16, 16>,
75
+ cutlass::epilogue::thread::LinearCombination<
76
+ ElementOutput,
77
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
78
+ ElementAccumulator,
79
+ ElementAccumulator
80
+ >,
81
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
82
+ 2
83
+ >;
84
+
85
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
86
+ }
87
+
88
+
89
+ /////////////////////////////////////////////////////////////////////////////////////////////////
90
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F16=>F16 //////////
91
+ /////////////////////////////////////////////////////////////////////////////////////////////////
92
+ TEST(SM70_Device_Gemm_f16t_f16n_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_32x8x16) {
93
+
94
+ using ElementOutput = cutlass::half_t;
95
+ using ElementAccumulator = cutlass::half_t;
96
+
97
+ using Gemm = cutlass::gemm::device::Gemm<
98
+ cutlass::half_t,
99
+ cutlass::layout::RowMajor,
100
+ cutlass::half_t,
101
+ cutlass::layout::ColumnMajor,
102
+ ElementOutput,
103
+ cutlass::layout::ColumnMajor,
104
+ ElementAccumulator,
105
+ cutlass::arch::OpClassWmmaTensorOp,
106
+ cutlass::arch::Sm70,
107
+ cutlass::gemm::GemmShape<128, 128, 32>,
108
+ cutlass::gemm::GemmShape<64, 64, 32>,
109
+ cutlass::gemm::GemmShape<32, 8, 16>,
110
+ cutlass::epilogue::thread::LinearCombination<
111
+ ElementOutput,
112
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
113
+ ElementAccumulator,
114
+ ElementAccumulator
115
+ >,
116
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
117
+ 2
118
+ >;
119
+
120
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
121
+ }
122
+
123
+ /////////////////////////////////////////////////////////////////////////////////////////////////
124
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F16=>F16 //////////
125
+ /////////////////////////////////////////////////////////////////////////////////////////////////
126
+ TEST(SM70_Device_Gemm_f16t_f16n_f16n_wmma_tensor_op_f16, 128x128x32_64x64x32_8x32x16) {
127
+
128
+ using ElementOutput = cutlass::half_t;
129
+ using ElementAccumulator = cutlass::half_t;
130
+
131
+ using Gemm = cutlass::gemm::device::Gemm<
132
+ cutlass::half_t,
133
+ cutlass::layout::RowMajor,
134
+ cutlass::half_t,
135
+ cutlass::layout::ColumnMajor,
136
+ ElementOutput,
137
+ cutlass::layout::ColumnMajor,
138
+ ElementAccumulator,
139
+ cutlass::arch::OpClassWmmaTensorOp,
140
+ cutlass::arch::Sm70,
141
+ cutlass::gemm::GemmShape<128, 128, 32>,
142
+ cutlass::gemm::GemmShape<64, 64, 32>,
143
+ cutlass::gemm::GemmShape<8, 32, 16>,
144
+ cutlass::epilogue::thread::LinearCombination<
145
+ ElementOutput,
146
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
147
+ ElementAccumulator,
148
+ ElementAccumulator
149
+ >,
150
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
151
+ 2
152
+ >;
153
+
154
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
155
+ }
156
+
157
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED
venv/lib/python3.10/site-packages/bitblas/3rdparty/cutlass/test/unit/gemm/device/gemm_f16t_f16n_f16n_wmma_tensor_op_f32_sm70.cu ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***************************************************************************************************
2
+ * Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ *
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ *
15
+ * 3. Neither the name of the copyright holder nor the names of its
16
+ * contributors may be used to endorse or promote products derived from
17
+ * this software without specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ *
30
+ **************************************************************************************************/
31
+ /*! \file
32
+ \brief Tests for device-wide GEMM interface
33
+ */
34
+ #include "cutlass/arch/wmma.h"
35
+
36
+ #ifdef CUTLASS_ARCH_WMMA_SM70_ENABLED
37
+ #include <iostream>
38
+
39
+ #include "cutlass/cutlass.h"
40
+ #include "cutlass/gemm/device/gemm.h"
41
+
42
+ #include "../../common/cutlass_unit_test.h"
43
+
44
+ #include "cutlass/util/host_tensor.h"
45
+ #include "cutlass/util/tensor_view_io.h"
46
+ #include "cutlass/util/reference/host/tensor_fill.h"
47
+ #include "cutlass/util/reference/host/tensor_copy.h"
48
+ #include "cutlass/util/reference/host/tensor_compare.h"
49
+ #include "cutlass/util/reference/host/gemm.h"
50
+
51
+ #include "testbed.h"
52
+
53
+ /////////////////////////////////////////////////////////////////////////////////////////////////
54
+ ///////// WMMA Instruction Shape = 16x16x16, DataType/Instruction = F16*F16+F32=>F16 //////////
55
+ /////////////////////////////////////////////////////////////////////////////////////////////////
56
+ TEST(SM70_Device_Gemm_f16t_f16n_f16n_wmma_tensor_op_f32, 128x128x32_64x64x16_16x16x16) {
57
+ // single cta, two warps horizontally two waprs vertically
58
+ using ElementOutput = cutlass::half_t;
59
+ using ElementAccumulator = float;
60
+
61
+ using Gemm = cutlass::gemm::device::Gemm<
62
+ cutlass::half_t,
63
+ cutlass::layout::RowMajor,
64
+ cutlass::half_t,
65
+ cutlass::layout::ColumnMajor,
66
+ ElementOutput,
67
+ cutlass::layout::ColumnMajor,
68
+ ElementAccumulator,
69
+ cutlass::arch::OpClassWmmaTensorOp,
70
+ cutlass::arch::Sm70,
71
+ cutlass::gemm::GemmShape<128, 128, 32>,
72
+ cutlass::gemm::GemmShape<64, 64, 32>,
73
+ cutlass::gemm::GemmShape<16, 16, 16>,
74
+ cutlass::epilogue::thread::LinearCombination<
75
+ ElementOutput,
76
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
77
+ ElementAccumulator,
78
+ ElementAccumulator
79
+ >,
80
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
81
+ 2
82
+ >;
83
+
84
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
85
+ }
86
+
87
+
88
+ /////////////////////////////////////////////////////////////////////////////////////////////////
89
+ ///////// WMMA Instruction Shape = 32x8x16, DataType/Instruction = F16*F16+F16=>F16 //////////
90
+ /////////////////////////////////////////////////////////////////////////////////////////////////
91
+ TEST(SM70_Device_Gemm_f16t_f16n_f16n_wmma_tensor_op_f32, 64x64x32_64x64x16_32x8x16) {
92
+
93
+ using ElementOutput = cutlass::half_t;
94
+ using ElementAccumulator = float;
95
+
96
+ using Gemm = cutlass::gemm::device::Gemm<
97
+ cutlass::half_t,
98
+ cutlass::layout::RowMajor,
99
+ cutlass::half_t,
100
+ cutlass::layout::ColumnMajor,
101
+ ElementOutput,
102
+ cutlass::layout::ColumnMajor,
103
+ ElementAccumulator,
104
+ cutlass::arch::OpClassWmmaTensorOp,
105
+ cutlass::arch::Sm70,
106
+ cutlass::gemm::GemmShape<64, 64, 32>,
107
+ cutlass::gemm::GemmShape<64, 64, 32>,
108
+ cutlass::gemm::GemmShape<32, 8, 16>,
109
+ cutlass::epilogue::thread::LinearCombination<
110
+ ElementOutput,
111
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
112
+ ElementAccumulator,
113
+ ElementAccumulator
114
+ >,
115
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
116
+ 2
117
+ >;
118
+
119
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
120
+ }
121
+
122
+ /////////////////////////////////////////////////////////////////////////////////////////////////
123
+ ///////// WMMA Instruction Shape = 8x32x16, DataType/Instruction = F16*F16+F16=>F16 //////////
124
+ /////////////////////////////////////////////////////////////////////////////////////////////////
125
+ TEST(SM70_Device_Gemm_f16t_f16n_f16n_wmma_tensor_op_f32, 64x64x32_64x64x16_8x32x16) {
126
+
127
+ using ElementOutput = cutlass::half_t;
128
+ using ElementAccumulator = float;
129
+
130
+ using Gemm = cutlass::gemm::device::Gemm<
131
+ cutlass::half_t,
132
+ cutlass::layout::RowMajor,
133
+ cutlass::half_t,
134
+ cutlass::layout::ColumnMajor,
135
+ ElementOutput,
136
+ cutlass::layout::ColumnMajor,
137
+ ElementAccumulator,
138
+ cutlass::arch::OpClassWmmaTensorOp,
139
+ cutlass::arch::Sm70,
140
+ cutlass::gemm::GemmShape<64, 64, 32>,
141
+ cutlass::gemm::GemmShape<64, 64, 32>,
142
+ cutlass::gemm::GemmShape<8, 32, 16>,
143
+ cutlass::epilogue::thread::LinearCombination<
144
+ ElementOutput,
145
+ 128 / cutlass::sizeof_bits<ElementOutput>::value,
146
+ ElementAccumulator,
147
+ ElementAccumulator
148
+ >,
149
+ cutlass::gemm::threadblock::GemmIdentityThreadblockSwizzle<>,
150
+ 2
151
+ >;
152
+
153
+ EXPECT_TRUE(test::gemm::device::TestAllGemm<Gemm>());
154
+ }
155
+ #endif //CUTLASS_ARCH_WMMA_SM70_ENABLED