]> git.sesse.net Git - ffmpeg/commit
dnn_backend_native_layer_conv2d.c:Add mutithread function
authorXu Jun <xujunzz@sjtu.edu.cn>
Sun, 6 Sep 2020 12:28:53 +0000 (20:28 +0800)
committerGuo, Yejun <yejun.guo@intel.com>
Wed, 9 Sep 2020 06:24:36 +0000 (14:24 +0800)
commit3c7cad69f233252e5178f7732baa0da950d74bbd
tree139b5e492fbb0af4699d24e4c15acaaba30f11c0
parent235e01f5a0b6218590eff2377574046c684143e8
dnn_backend_native_layer_conv2d.c:Add mutithread function

Use pthread to multithread dnn_execute_layer_conv2d.
Can be tested with command "./ffmpeg_g -i input.png -vf \
format=yuvj420p,dnn_processing=dnn_backend=native:model= \
espcn.model:input=x:output=y:options=conv2d_threads=23 \
 -y sr_native.jpg -benchmark"

before patch: utime=11.238s stime=0.005s rtime=11.248s
after patch:  utime=20.817s stime=0.047s rtime=1.051s
on my 3900X 12c24t @4.2GHz

About the increase of utime, it's because that CPU HyperThreading
technology makes logical cores twice of physical cores while cpu's
counting performance improves less than double. And utime sums
all cpu's logical cores' runtime. As a result, using threads num
near cpu's logical core's number will double utime, while reduce
rtime less than half for HyperThreading CPUs.

Signed-off-by: Xu Jun <xujunzz@sjtu.edu.cn>
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
libavfilter/dnn/dnn_backend_native_layer_conv2d.c
tests/dnn/dnn-layer-conv2d-test.c