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 KERNEL_EVALUATOR_HPP |
18 | #define KERNEL_EVALUATOR_HPP |
19 | |
20 | #include "kernel_catalog.hpp" |
21 | |
22 | #include "gen_gemm_kernel_generator.hpp" |
23 | |
24 | namespace dnnl { |
25 | namespace impl { |
26 | namespace gpu { |
27 | namespace jit { |
28 | |
29 | struct SizeParams { |
30 | int64_t batch; |
31 | int64_t m, n, k; |
32 | }; |
33 | |
34 | struct EvaluateParams { |
35 | SizeParams sizes; |
36 | double beta; |
37 | int euCount; |
38 | int tileCount = 1; |
39 | bool effective = false; |
40 | }; |
41 | |
42 | struct DerivedEvaluateParams : public EvaluateParams { |
43 | int64_t wgCountM, wgCountN, wgCountK; |
44 | int64_t mPad, nPad; |
45 | double threadCount; |
46 | int threadsPerEU; |
47 | int hwThreadCapacity; |
48 | int hwMinThreadsToFill; |
49 | int partialWaveCount; |
50 | }; |
51 | |
52 | struct EvaluateAuxOutput { |
53 | int64_t k0 = 0; |
54 | }; |
55 | |
56 | DerivedEvaluateParams getDerivedParams( |
57 | const kcatalog::Entry &e, const EvaluateParams &p); |
58 | double evaluate(const kcatalog::Entry &e, const EvaluateParams &p, |
59 | EvaluateAuxOutput &aux); |
60 | double evaluate(const kcatalog::Entry &e, const DerivedEvaluateParams &p, |
61 | EvaluateAuxOutput &aux); |
62 | |
63 | } // namespace jit |
64 | } // namespace gpu |
65 | } // namespace impl |
66 | } // namespace dnnl |
67 | |
68 | #endif /* header guard */ |
69 | |