XeTLA v0.3.6
IntelĀ® Xe Templates for Linear Algebra - API Definition Document
 
Loading...
Searching...
No Matches
math_mma.hpp
Go to the documentation of this file.
1/*******************************************************************************
2* Copyright (c) 2022-2023 Intel Corporation
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*******************************************************************************/
16
19
20#pragma once
21
23
24#pragma clang diagnostic push
25#pragma clang diagnostic ignored "-Wunused-parameter"
26
27namespace gpu::xetla {
28namespace detail {
29
34template <typename dtype>
37}
38
39template <>
42}
43
44template <>
47}
48
49template <>
52}
53
54template <>
57}
58
59template <>
62}
63
64template <>
67}
68
72template <gpu::xetla::argument_type arg_type>
73constexpr __ESIMD_NS::xmx::dpas_argument_type get_argument_type() {
74 static_assert(arg_type == gpu::xetla::argument_type::U1
85 "Unsupported argument type");
86 switch (arg_type) {
88 return __ESIMD_NS::xmx::dpas_argument_type::u1;
90 return __ESIMD_NS::xmx::dpas_argument_type::s1;
92 return __ESIMD_NS::xmx::dpas_argument_type::u2;
94 return __ESIMD_NS::xmx::dpas_argument_type::s2;
96 return __ESIMD_NS::xmx::dpas_argument_type::u4;
98 return __ESIMD_NS::xmx::dpas_argument_type::s4;
100 return __ESIMD_NS::xmx::dpas_argument_type::u8;
102 return __ESIMD_NS::xmx::dpas_argument_type::s8;
104 return __ESIMD_NS::xmx::dpas_argument_type::bf16;
106 return __ESIMD_NS::xmx::dpas_argument_type::fp16;
108 return __ESIMD_NS::xmx::dpas_argument_type::tf32;
109 default:;
110 }
111}
112
113} // namespace detail
114
117
138
140template <argument_type src1_precision, argument_type src2_precision,
141 int systolic_depth, int repeat_count, typename T, typename T1,
142 typename T2, int N, int N1, int N2,
143 typename Sat = xetla_saturation_off_tag>
145 xetla_vector<T1, N1> src1, xetla_vector<T2, N2> src2, Sat sat = {}) {
146 return __ESIMD_NS::xmx::dpas<systolic_depth, repeat_count, T, T, T1, T2,
147 detail::get_argument_type<src1_precision>(),
148 detail::get_argument_type<src2_precision>()>(src0, src1, src2);
149}
150
152
153} // namespace gpu::xetla
154#pragma clang diagnostic pop
C++ API.
#define __XETLA_API
Definition common.hpp:43
__ESIMD_NS::simd< native_type_t< Ty >, N > xetla_vector
wrapper for xetla_vector.
Definition base_types.hpp:149
__XETLA_API xetla_vector< T, N > xetla_mma(xetla_vector< T, N > src0, xetla_vector< T1, N1 > src1, xetla_vector< T2, N2 > src2, Sat sat={})
description of xetla mma perform matrix multiply add operation
Definition math_mma.hpp:144
constexpr gpu::xetla::argument_type mma_argument_type< uint8_t >()
Definition math_mma.hpp:55
constexpr gpu::xetla::argument_type mma_argument_type< int8_t >()
Definition math_mma.hpp:50
constexpr gpu::xetla::argument_type mma_argument_type< tf32 >()
Definition math_mma.hpp:40
constexpr gpu::xetla::argument_type mma_argument_type< fp16 >()
Definition math_mma.hpp:65
constexpr gpu::xetla::argument_type mma_argument_type< float >()
Definition math_mma.hpp:45
constexpr gpu::xetla::argument_type mma_argument_type()
convert normal data type to dpas argument type
Definition math_mma.hpp:35
constexpr gpu::xetla::argument_type mma_argument_type< bf16 >()
Definition math_mma.hpp:60
constexpr __ESIMD_NS::xmx::dpas_argument_type get_argument_type()
lookup table for dpas argument type
Definition math_mma.hpp:73
Definition arch_config.hpp:24
argument_type
xetla dpas argument typ
Definition common.hpp:184