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 GPU_JIT_REORDER_GEN_REORDER_HPP |
18 | #define GPU_JIT_REORDER_GEN_REORDER_HPP |
19 | |
20 | #include <memory> |
21 | |
22 | #include "common/c_types_map.hpp" |
23 | #include "gpu/compute/compute.hpp" |
24 | #include "gpu/gpu_primitive.hpp" |
25 | #include "gpu/gpu_reorder_pd.hpp" |
26 | |
27 | namespace dnnl { |
28 | namespace impl { |
29 | namespace gpu { |
30 | namespace jit { |
31 | |
32 | struct reorder_config_t; |
33 | class kernel_info_t; |
34 | |
35 | class gen_reorder_t : public gpu_primitive_t { |
36 | public: |
37 | struct pd_t : public gpu_reorder_pd_t { |
38 | using gpu_reorder_pd_t::gpu_reorder_pd_t; |
39 | |
40 | DECLARE_COMMON_PD_T("jit:ir" , gen_reorder_t); |
41 | |
42 | status_t init(engine_t *, engine_t *, engine_t *); |
43 | status_t init_kernel_info(); |
44 | |
45 | std::shared_ptr<reorder_config_t> cfg; |
46 | std::shared_ptr<kernel_info_t> kernel_info; |
47 | |
48 | private: |
49 | DECLARE_GPU_REORDER_CREATE(); |
50 | }; |
51 | |
52 | using gpu_primitive_t::gpu_primitive_t; |
53 | |
54 | status_t init(engine_t *engine) override; |
55 | status_t execute(const exec_ctx_t &ctx) const override; |
56 | |
57 | private: |
58 | const pd_t *pd() const { return (const pd_t *)primitive_t::pd().get(); } |
59 | |
60 | compute::kernel_t kernel_; |
61 | }; |
62 | |
63 | } // namespace jit |
64 | } // namespace gpu |
65 | } // namespace impl |
66 | } // namespace dnnl |
67 | |
68 | #endif |
69 | |