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_SCALE_UTILS_HPP |
18 | #define CPU_SCALE_UTILS_HPP |
19 | |
20 | #include "common/c_types_map.hpp" |
21 | #include "common/memory_tracking.hpp" |
22 | #include "common/primitive_attr.hpp" |
23 | |
24 | namespace dnnl { |
25 | namespace impl { |
26 | namespace cpu { |
27 | |
28 | void book_precomputed_scales(memory_tracking::registrar_t &scratchpad, |
29 | const arg_scales_t &attr_scales, size_t oc); |
30 | |
31 | // By default returns the original wei_scales buffer as a dequantization scale. |
32 | // If both src_scales and wei_scales are set, returns a scratchpad memory that |
33 | // contains src_scale * wei_scale as a dequantization scale. |
34 | const float *precompute_scales(const memory_tracking::grantor_t &scratchpad, |
35 | const float *src_scales, const float *wei_scales, dim_t oc, |
36 | const primitive_attr_t *attr); |
37 | |
38 | } // namespace cpu |
39 | } // namespace impl |
40 | } // namespace dnnl |
41 | |
42 | #endif // CPU_SCALE_UTILS_HPP |
43 | |