[FFmpeg-devel] [PATCH v5 2/2] dnn_backend_native_layer_conv2d.c:Add mutithread function

Guo, Yejun yejun.guo at intel.com
Tue Sep 8 04:33:09 EEST 2020



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> xujunzz at sjtu.edu.cn
> Sent: 2020年9月6日 20:29
> To: ffmpeg-devel at ffmpeg.org
> Cc: xujunzz at sjtu.edu.cn
> Subject: [FFmpeg-devel] [PATCH v5 2/2]
> dnn_backend_native_layer_conv2d.c:Add mutithread function
> 
> From: Xu Jun <xujunzz at sjtu.edu.cn>
> 
> 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 at sjtu.edu.cn>
> ---
> v2: add check for HAVE_PTHREAD_CANCEL and modify FATE test
> dnn-layer-conv2d-test.c
> v4: use extern to call dnn_native_class in dnn-layer-conv2d-test.c
> v5: use DNN_SUCCESS as return flag instead of 0.
> 
LGTM, will push tomorrow if no other comments.


More information about the ffmpeg-devel mailing list