File tree 8 files changed +22
-29
lines changed
8 files changed +22
-29
lines changed Original file line number Diff line number Diff line change @@ -47,15 +47,12 @@ class engine_t : public cpu::cpu_engine_t {
47
47
return cpu::sycl::stream_t::create_stream (stream, this , stream_impl);
48
48
}
49
49
50
- const ::sycl::device &device () const { return impl ()->device (); }
51
- const ::sycl::context &context () const { return impl ()->context (); }
52
-
53
- xpu::sycl::backend_t backend () const { return impl ()->backend (); }
54
-
55
50
bool mayiuse_system_memory_allocators () const override {
56
51
return impl ()->mayiuse_system_memory_allocators ();
57
52
}
58
53
54
+ DECLARE_COMMON_SYCL_ENGINE_FUNCTIONS ();
55
+
59
56
protected:
60
57
const xpu::sycl::engine_impl_t *impl () const {
61
58
return (const xpu::sycl::engine_impl_t *)impl::engine_t::impl ();
Original file line number Diff line number Diff line change @@ -55,11 +55,6 @@ class engine_t : public gpu::engine_t {
55
55
void activate_stream_miopen (HIPstream hip_stream);
56
56
void activate_stream_rocblas (HIPstream hip_stream);
57
57
58
- const ::sycl::device &device () const { return impl ()->device (); }
59
- const ::sycl::context &context () const { return impl ()->context (); }
60
-
61
- xpu::sycl::backend_t backend () const { return impl ()->backend (); }
62
-
63
58
hipCtx_t get_underlying_context () const ;
64
59
hipDevice_t get_underlying_device () const ;
65
60
miopenHandle_t *get_miopen_handle ();
@@ -70,6 +65,8 @@ class engine_t : public gpu::engine_t {
70
65
return impl ()->mayiuse_system_memory_allocators ();
71
66
}
72
67
68
+ DECLARE_COMMON_SYCL_ENGINE_FUNCTIONS ();
69
+
73
70
protected:
74
71
const xpu::sycl::engine_impl_t *impl () const {
75
72
return (const xpu::sycl::engine_impl_t *)impl::engine_t::impl ();
Original file line number Diff line number Diff line change @@ -43,15 +43,12 @@ class engine_t : public gpu::engine_t {
43
43
status_t create_stream (
44
44
impl::stream_t **stream, impl::stream_impl_t *stream_impl) override ;
45
45
46
- const ::sycl::device &device () const { return impl ()->device (); }
47
- const ::sycl::context &context () const { return impl ()->context (); }
48
-
49
- xpu::sycl::backend_t backend () const { return impl ()->backend (); }
50
-
51
46
bool mayiuse_system_memory_allocators () const override {
52
47
return impl ()->mayiuse_system_memory_allocators ();
53
48
}
54
49
50
+ DECLARE_COMMON_SYCL_ENGINE_FUNCTIONS ();
51
+
55
52
protected:
56
53
const xpu::sycl::engine_impl_t *impl () const {
57
54
return (const xpu::sycl::engine_impl_t *)impl::engine_t::impl ();
Original file line number Diff line number Diff line change @@ -93,10 +93,6 @@ class ocl_gpu_engine_t : public compute::compute_engine_t {
93
93
return gpu_impl_list_t::get_implementation_list (desc);
94
94
}
95
95
96
- cl_device_id device () const { return impl ()->device (); }
97
- cl_context context () const { return impl ()->context (); }
98
- cl_platform_id platform () const { return impl ()->platform (); }
99
-
100
96
gpu_utils::device_id_t device_id () const override {
101
97
return std::make_tuple (0 , reinterpret_cast <uint64_t >(device ()), 0 );
102
98
}
@@ -111,6 +107,8 @@ class ocl_gpu_engine_t : public compute::compute_engine_t {
111
107
return device_info_->get_cache_blob (size, cache_blob);
112
108
}
113
109
110
+ DECLARE_COMMON_OCL_ENGINE_FUNCTIONS ();
111
+
114
112
protected:
115
113
const xpu::ocl::engine_impl_t *impl () const {
116
114
return (const xpu::ocl::engine_impl_t *)engine_t::impl ();
Original file line number Diff line number Diff line change @@ -159,11 +159,6 @@ class engine_t : public gpu::intel::compute::compute_engine_t {
159
159
return status::success;
160
160
}
161
161
162
- const ::sycl::device &device () const { return impl ()->device (); }
163
- const ::sycl::context &context () const { return impl ()->context (); }
164
-
165
- xpu::sycl::backend_t backend () const { return impl ()->backend (); }
166
-
167
162
cl_device_id ocl_device () const {
168
163
if (backend () != xpu::sycl::backend_t ::opencl) {
169
164
assert (!" not expected" );
@@ -188,6 +183,8 @@ class engine_t : public gpu::intel::compute::compute_engine_t {
188
183
return gpu::intel::sycl::device_id (device ());
189
184
}
190
185
186
+ DECLARE_COMMON_SYCL_ENGINE_FUNCTIONS ();
187
+
191
188
protected:
192
189
const xpu::sycl::engine_impl_t *impl () const {
193
190
return (const xpu::sycl::engine_impl_t *)impl::engine_t::impl ();
Original file line number Diff line number Diff line change @@ -49,11 +49,6 @@ class engine_t : public gpu::engine_t {
49
49
void activate_stream_cudnn (CUstream cuda_stream);
50
50
void activate_stream_cublas (CUstream cuda_stream);
51
51
52
- const ::sycl::device &device () const { return impl ()->device (); }
53
- const ::sycl::context &context () const { return impl ()->context (); }
54
-
55
- xpu::sycl::backend_t backend () const { return impl ()->backend (); }
56
-
57
52
CUcontext get_underlying_context () const ;
58
53
CUdevice get_underlying_device () const ;
59
54
cudnnHandle_t *get_cudnn_handle ();
@@ -63,6 +58,8 @@ class engine_t : public gpu::engine_t {
63
58
return impl ()->mayiuse_system_memory_allocators ();
64
59
}
65
60
61
+ DECLARE_COMMON_SYCL_ENGINE_FUNCTIONS ();
62
+
66
63
protected:
67
64
const xpu::sycl::engine_impl_t *impl () const {
68
65
return (const xpu::sycl::engine_impl_t *)impl::engine_t::impl ();
Original file line number Diff line number Diff line change @@ -144,6 +144,11 @@ class engine_impl_t : public impl::engine_impl_t {
144
144
bool is_user_context_;
145
145
};
146
146
147
+ #define DECLARE_COMMON_OCL_ENGINE_FUNCTIONS () \
148
+ cl_device_id device () const { return impl ()->device (); } \
149
+ cl_context context () const { return impl ()->context (); } \
150
+ cl_platform_id platform () const { return impl ()->platform (); }
151
+
147
152
} // namespace ocl
148
153
} // namespace xpu
149
154
} // namespace impl
Original file line number Diff line number Diff line change @@ -113,6 +113,11 @@ class engine_impl_t : public impl::engine_impl_t {
113
113
backend_t backend_;
114
114
};
115
115
116
+ #define DECLARE_COMMON_SYCL_ENGINE_FUNCTIONS () \
117
+ const ::sycl::device &device () const { return impl ()->device (); } \
118
+ const ::sycl::context &context () const { return impl ()->context (); } \
119
+ xpu::sycl::backend_t backend () const { return impl ()->backend (); }
120
+
116
121
} // namespace sycl
117
122
} // namespace xpu
118
123
} // namespace impl
You can’t perform that action at this time.
0 commit comments