ARM-software / ComputeLibrary

The Compute Library is a set of computer vision and machine learning functions optimised for both Arm CPUs and GPUs using SIMD technologies.
MIT License
2.75k stars 767 forks source link

Differences between run() and run_op() #1055

Closed allnes closed 1 year ago

allnes commented 1 year ago

Hello!

I try to use custom scheduler. And some samples of you repo use functions run() and run_op() from ICPPKernel class.

Please describe what differences between run() and run_op()? (exclude prototypes functions)

thank you!

morgolock commented 1 year ago

Hi @allnes

They both do the same but the interface is slightly different. The method run() is used in all our old functions in the runtime, see https://github.com/ARM-software/ComputeLibrary/tree/main/src/runtime/NEON/functions . The run() method is legacy code.

The method run_op() was introduced when we redesigned the library interface and is used by all the new cpu/gpu kernels, see https://github.com/ARM-software/ComputeLibrary/tree/main/src/cpu/kernels. This new method takes a TensorPack as an additional parameter which is a better practice than keeping pointer in the kernel to the various tensors used during the computation.

The scheduler calls to these methods to execute a kernel on window: https://github.com/ARM-software/ComputeLibrary/blob/main/src/runtime/IScheduler.cpp#L117

I'd recommend using the method run_op() rather than run().

Hope this helps.

allnes commented 1 year ago

Hi @allnes

They both do the same but the interface is slightly different. The method run() is used in all our old functions in the runtime, see https://github.com/ARM-software/ComputeLibrary/tree/main/src/runtime/NEON/functions . The run() method is legacy code.

The method run_op() was introduced when we redesigned the library interface and is used by all the new cpu/gpu kernels, see https://github.com/ARM-software/ComputeLibrary/tree/main/src/cpu/kernels. This new method takes a TensorPack as an additional parameter which is a better practice than keeping pointer in the kernel to the various tensors used during the computation.

The scheduler calls to these methods to execute a kernel on window: https://github.com/ARM-software/ComputeLibrary/blob/main/src/runtime/IScheduler.cpp#L117

I'd recommend using the method run_op() rather than run().

Hope this helps.

Thank you for answer!