MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / run_op

Method run_op

src/gpu/cl/kernels/ClMatMulNativeKernel.cpp:247–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247void ClMatMulNativeKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue)
248{
249 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
250 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
251
252 const ICLTensor *lhs =
253 utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_0));
254 const ICLTensor *rhs =
255 utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_1));
256 const ICLTensor *bias = utils::cast::polymorphic_downcast<const ICLTensor *>(
257 tensors.get_const_tensor(TensorType::ACL_SRC_2)); // nullptr if bias is not present
258 ICLTensor *dst = utils::cast::polymorphic_downcast<ICLTensor *>(tensors.get_tensor(TensorType::ACL_DST));
259 ARM_COMPUTE_ERROR_ON_NULLPTR(lhs, rhs, dst);
260 ARM_COMPUTE_LOG_PARAMS(lhs, rhs, bias, dst);
261
262 unsigned int idx = 0;
263 Window window_collapsed = window.collapse(ICLKernel::window(), Window::DimZ);
264
265 add_3d_tensor_nhw_argument(idx, lhs);
266
267 cl::Image2D rhs_cl_image;
268 if (_export_rhs_to_cl_image)
269 {
270 const size_t image_w = rhs->info()->dimension(0) / 4;
271 const size_t image_h = rhs->info()->tensor_shape().total_size() / rhs->info()->dimension(0);
272 const TensorShape shape2d(image_w, image_h);
273 const size_t image_row_pitch = rhs->info()->strides_in_bytes()[1];
274
275 // Export cl_buffer to cl_image
276 rhs_cl_image = create_image2d_from_buffer(CLKernelLibrary::get().context(), rhs->cl_buffer(), shape2d,
277 rhs->info()->data_type(), image_row_pitch, CLImage2DType::ReadOnly);
278 _kernel.setArg(idx++, rhs_cl_image);
279 }
280
281 add_3d_tensor_nhw_argument(idx, rhs);
282 if (bias != nullptr)
283 {
284 add_3d_tensor_nhw_argument(idx, bias);
285 }
286 add_3d_tensor_nhw_argument(idx, dst);
287
288 enqueue(queue, *this, window_collapsed, lws_hint());
289}
290
291} // namespace kernels
292} // namespace opencl

Callers

nothing calls this directly

Calls 10

get_const_tensorMethod · 0.80
contextMethod · 0.80
setArgMethod · 0.80
get_tensorMethod · 0.45
collapseMethod · 0.45
dimensionMethod · 0.45
infoMethod · 0.45
total_sizeMethod · 0.45
data_typeMethod · 0.45

Tested by

no test coverage detected