1 | /******************************************************************************* |
2 | * Copyright 2022 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 | |
17 | #ifndef CPU_X64_BRGEMM_BRGEMM_UTILS_HPP |
18 | #define CPU_X64_BRGEMM_BRGEMM_UTILS_HPP |
19 | |
20 | #include "cpu/x64/brgemm/brgemm.hpp" |
21 | |
22 | #include "cpu/x64/cpu_isa_traits.hpp" |
23 | |
24 | #include "common/c_types_map.hpp" |
25 | |
26 | namespace dnnl { |
27 | namespace impl { |
28 | namespace cpu { |
29 | namespace x64 { |
30 | |
31 | namespace brgemm_utils { |
32 | |
33 | bool can_dispatch_uker(const brgemm_t *brg); |
34 | |
35 | void maybe_try_bf32(brgemm_t *brg); |
36 | |
37 | status_t brgemm_blocking(brgemm_t *brg); |
38 | |
39 | status_t brdgmm_blocking(brgemm_t *brg); |
40 | |
41 | /* The purpose of this function is to enable initialization of brgemm values |
42 | * and then call additional functions like blocking heuristics without |
43 | * having to depend on BRGeMM's API. An additional feature is that this |
44 | * function can be modified depending on needs without requiring changes |
45 | * at the API level. */ |
46 | void init_brgemm_conf(brgemm_t *brg, cpu_isa_t isa, brgemm_batch_kind_t type, |
47 | impl::data_type_t dt_a, impl::data_type_t dt_b, brgemm_layout_t layout, |
48 | float alpha, float beta, dim_t LDA, dim_t LDB, dim_t LDC, dim_t M, |
49 | dim_t N, dim_t K, const brgemm_strides_t *strides = nullptr, |
50 | bool is_bf32 = false); |
51 | |
52 | /* The purpose of this function is to enable initialization of brgemm values |
53 | * and then call additional functions like blocking heuristics without |
54 | * having to depend on BRDGeMM's API. An additional feature is that this |
55 | * function can be modified depending on needs without requiring changes |
56 | * at the API level. */ |
57 | void init_brdgmm_conf(brgemm_t *brg, cpu_isa_t isa, brgemm_batch_kind_t type, |
58 | impl::data_type_t dt_a, impl::data_type_t dt_b, brgemm_layout_t layout, |
59 | float alpha, float beta, dim_t LDA, dim_t LDC, dim_t M, dim_t N, |
60 | const brgemm_strides_t *strides = nullptr); |
61 | |
62 | } // namespace brgemm_utils |
63 | |
64 | } // namespace x64 |
65 | } // namespace cpu |
66 | } // namespace impl |
67 | } // namespace dnnl |
68 | |
69 | #endif // CPU_X64_BRGEMM_BRGEMM_UTILS_HPP |
70 | |
71 | //vim: et ts=4 sw=4 cindent cino+=l0,\:4,N-s |
72 | |