1414# KIND, either express or implied. See the License for the
1515# specific language governing permissions and limitations
1616# under the License.
17+ # pylint: disable=invalid-name
18+ """Intrinsics for x86 tensorization."""
1719from .. import TensorIntrin
1820from tvm .script import tir as T
1921
2022
23+ # TODO(masahi): Parametrize the TVMScript description of dot product by
24+ # shape and dtype, and share the common description with x86.
25+
2126@T .prim_func
2227def dot_product_4x4_i8i8i32_desc (
2328 A : T .Buffer ((4 ,), "int8" , offset_factor = 1 ),
2429 B : T .Buffer ((4 , 4 ), "int8" , offset_factor = 1 ),
2530 C : T .Buffer ((4 ,), "int32" , offset_factor = 1 ),
2631) -> None :
32+ """
33+ A description for 4x4 dot product.
34+ """
2735 with T .block ("root" ):
2836 T .reads (C [0 :4 ], A [0 :4 ], B [0 :4 , 0 :4 ])
2937 T .writes (C [0 :4 ])
@@ -42,6 +50,9 @@ def dot_product_4x4_i8i8i32_neon(
4250 B : T .Buffer ((4 , 4 ), "int8" , offset_factor = 1 ),
4351 C : T .Buffer ((4 ,), "int32" , offset_factor = 1 ),
4452) -> None :
53+ """
54+ A implementation for 4x4 dot product, applicable for any ARM CPUs supporting NEON.
55+ """
4556 with T .block ("root" ):
4657 T .reads (C [0 :4 ], A [0 :4 ], B [0 :4 , 0 :4 ])
4758 T .writes (C [0 :4 ])
@@ -103,6 +114,9 @@ def dot_product_4x4_i8i8i32_sdot(
103114 B : T .Buffer ((4 , 4 ), "int8" , offset_factor = 1 ),
104115 C : T .Buffer ((4 ,), "int32" , offset_factor = 1 ),
105116) -> None :
117+ """
118+ A implementation for 4x4 dot product, applicable for ARM CPUs supporting sdot.
119+ """
106120 with T .block ("root" ):
107121 T .reads (C [0 :4 ], A [0 :4 ], B [0 :4 , 0 :4 ])
108122 T .writes (C [0 :4 ])
0 commit comments