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_JIT_BRGEMM_CONV_BWD_HPP |
18 | #define CPU_X64_JIT_BRGEMM_CONV_BWD_HPP |
19 | |
20 | #include "common/c_types_map.hpp" |
21 | #include "common/dnnl_thread.hpp" |
22 | #include "common/memory_tracking.hpp" |
23 | #include "common/primitive.hpp" |
24 | #include "common/utils.hpp" |
25 | |
26 | #include "cpu/cpu_convolution_pd.hpp" |
27 | |
28 | #include "cpu/x64/jit_brgemm_1x1_conv.hpp" |
29 | #include "cpu/x64/jit_brgemm_conv.hpp" |
30 | |
31 | namespace dnnl { |
32 | namespace impl { |
33 | namespace cpu { |
34 | namespace x64 { |
35 | |
36 | template <cpu_isa_t isa> |
37 | struct brgemm_convolution_bwd_t : public primitive_t { |
38 | |
39 | struct pd_t : public cpu_convolution_bwd_data_pd_t { |
40 | pd_t(const convolution_desc_t *adesc, const primitive_attr_t *attr, |
41 | const typename pd_t::hint_class *hint_fwd_pd) |
42 | : cpu_convolution_bwd_data_pd_t(adesc, attr, hint_fwd_pd) {} |
43 | |
44 | ~pd_t() = default; |
45 | |
46 | DECLARE_COMMON_PD_T(fwd_pd_->name(), brgemm_convolution_bwd_t); |
47 | |
48 | status_t init(engine_t *engine); |
49 | |
50 | std::shared_ptr<primitive_desc_t> fwd_pd_; |
51 | }; |
52 | |
53 | brgemm_convolution_bwd_t(const pd_t *apd) : primitive_t(apd) {}; |
54 | |
55 | ~brgemm_convolution_bwd_t() = default; |
56 | |
57 | status_t init(engine_t *engine) override; |
58 | |
59 | status_t execute(const exec_ctx_t &ctx) const override; |
60 | |
61 | private: |
62 | const pd_t *pd() const { |
63 | return static_cast<const pd_t *>(primitive_t::pd().get()); |
64 | } |
65 | std::shared_ptr<primitive_t> fwd_p_; |
66 | }; |
67 | |
68 | } // namespace x64 |
69 | } // namespace cpu |
70 | } // namespace impl |
71 | } // namespace dnnl |
72 | |
73 | #endif |
74 | |
75 | // vim: et ts=4 sw=4 cindent cino+=l0,\:4,N-s |
76 | |