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

Method run_op

src/gpu/cl/kernels/ClWeightsReshapeKernel.cpp:141–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void ClWeightsReshapeKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue)
142{
143 ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
144 ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(ICLKernel::window(), window);
145
146 auto src = utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC));
147 auto biases = utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_BIAS));
148 auto dst = utils::cast::polymorphic_downcast<ICLTensor *>(tensors.get_tensor(TensorType::ACL_DST));
149
150 Window out_window;
151 out_window.use_tensor_dimensions(dst->info()->tensor_shape());
152
153 Window in_slice = window.first_slice_window_3D();
154 Window out_slice = out_window.first_slice_window_2D();
155
156 Window biases_window;
157 Window biases_slice;
158
159 unsigned int idx = num_arguments_per_3D_tensor() + num_arguments_per_2D_tensor();
160 idx += (biases != nullptr) ? num_arguments_per_1D_tensor() : 0;
161 _kernel.setArg<cl_uint>(idx++, src->info()->dimension(0));
162 _kernel.setArg<cl_uint>(idx++, src->info()->dimension(1));
163 _kernel.setArg<cl_uint>(idx++, src->info()->dimension(2));
164 _kernel.setArg<cl_uint>(idx++, src->info()->dimension(3));
165 _kernel.setArg<cl_uint>(idx++, dst->info()->strides_in_bytes().z());
166
167 if (biases != nullptr)
168 {
169 biases_window.use_tensor_dimensions(biases->info()->tensor_shape());
170 biases_slice = biases_window.first_slice_window_1D();
171 }
172
173 do
174 {
175 // Set arguments
176 unsigned idx = 0;
177 add_3D_tensor_argument(idx, src, in_slice);
178 add_2D_tensor_argument(idx, dst, out_slice);
179 if (biases != nullptr)
180 {
181 add_1D_tensor_argument(idx, biases, biases_slice);
182 ARM_COMPUTE_UNUSED(biases_window.slide_window_slice_1D(biases_slice));
183 }
184
185 // Run kernel
186 enqueue(queue, *this, in_slice, lws_hint());
187 } while (window.slide_window_slice_4D(in_slice) && out_window.slide_window_slice_2D(out_slice));
188}
189} // namespace kernels
190} // namespace opencl
191} // namespace arm_compute

Callers

nothing calls this directly

Calls 11

get_const_tensorMethod · 0.80
first_slice_window_3DMethod · 0.80
first_slice_window_2DMethod · 0.80
first_slice_window_1DMethod · 0.80
slide_window_slice_1DMethod · 0.80
slide_window_slice_4DMethod · 0.80
slide_window_slice_2DMethod · 0.80
get_tensorMethod · 0.45
infoMethod · 0.45
dimensionMethod · 0.45
zMethod · 0.45

Tested by

no test coverage detected