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

Method run_op

src/gpu/cl/kernels/ClGemmMatrixMultiplyNativeKernel.cpp:383–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383void ClGemmMatrixMultiplyNativeKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue)
384{
385 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
386 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICLKernel::window(), window);
387
388 const auto src0 =
389 utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_0));
390 const auto src1 =
391 utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_1));
392 const auto src2 =
393 utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_2));
394 auto dst = utils::cast::polymorphic_downcast<ICLTensor *>(tensors.get_tensor(TensorType::ACL_DST));
395
396 ARM_COMPUTE_ERROR_ON_NULLPTR(src0, src1, dst);
397 ARM_COMPUTE_ERROR_ON(_add_bias && src2 == nullptr);
398
399 if (src1->info()->num_dimensions() < 3)
400 {
401 // The stride_z for matrix B must be zero if we do not slice
402 ARM_COMPUTE_ERROR_ON(src1->info()->strides_in_bytes()[3] != 0);
403 }
404
405 Window slice = window.first_slice_window_3D();
406 Window slice_matrix_b = slice;
407
408 slice_matrix_b.set(Window::DimX, Window::Dimension(0, 1, 1));
409 slice_matrix_b.set(Window::DimY, Window::Dimension(0, 1, 1));
410
411 if (_reinterpret_input_as_3d)
412 {
413 // Pass bottom paddings to the kernel if the input has to be reinterpreted as 3D tensor
414 unsigned int idx0;
415 if (_add_bias)
416 {
417 idx0 = 4 * num_arguments_per_2D_tensor() + 7;
418 }
419 else
420 {
421 idx0 = 3 * num_arguments_per_2D_tensor() + 6;
422 }
423 const unsigned int total_cross_plane_pad = src0->info()->padding().top + src0->info()->padding().bottom;
424 _kernel.setArg<cl_uint>(idx0, static_cast<unsigned int>(total_cross_plane_pad));
425 }
426
427 if (_reinterpret_output_as_3d)
428 {
429 // Pass bottom paddings to the kernel if the dst has to be reinterpreted as 3D tensor
430 unsigned int idx0;
431 if (_add_bias)
432 {
433 idx0 = 4 * num_arguments_per_2D_tensor() + 7 + (_reinterpret_input_as_3d ? 1 : 0);
434 }
435 else
436 {
437 idx0 = 3 * num_arguments_per_2D_tensor() + 6 + (_reinterpret_input_as_3d ? 1 : 0);
438 }
439 const unsigned int total_cross_plane_pad = dst->info()->padding().top + dst->info()->padding().bottom;
440 _kernel.setArg<cl_uint>(idx0, static_cast<unsigned int>(total_cross_plane_pad));

Callers

nothing calls this directly

Calls 9

get_const_tensorMethod · 0.80
first_slice_window_3DMethod · 0.80
slide_window_slice_3DMethod · 0.80
DimensionClass · 0.50
get_tensorMethod · 0.45
num_dimensionsMethod · 0.45
infoMethod · 0.45
setMethod · 0.45
paddingMethod · 0.45

Tested by

no test coverage detected