> -----Original Message-----
> From: Chirag Maheshwari via ffmpeg-devel <[email protected]>
> Sent: Tuesday, March 17, 2026 4:11 PM
> To: [email protected]
> Cc: Chirag Maheshwari <[email protected]>
> Subject: [FFmpeg-devel] [PATCH] avfilter/dnn: fix torch AVOption unit field
> and honor nireq in LibTorch backend
> 
> Fix missing .unit designator on the torch const AVOption entry in
> vf_dnn_processing.c, and replace the hardcoded single request item in
> dnn_load_model_th with a ctx->nireq-driven pool matching the TF/OpenVINO
> backends.
> 
> This is also the qualification task for the LibTorch Backend Project for GSoC
> 2026.
> ---
>  libavfilter/dnn/dnn_backend_torch.cpp | 43 ++++++++++++++++++---------
>  libavfilter/vf_dnn_processing.c       |  2 +-
>  2 files changed, 30 insertions(+), 15 deletions(-)
> 
> diff --git a/libavfilter/dnn/dnn_backend_torch.cpp
> b/libavfilter/dnn/dnn_backend_torch.cpp
> index 99f55165f2..3c84eb33a8 100644
> --- a/libavfilter/dnn/dnn_backend_torch.cpp
> +++ b/libavfilter/dnn/dnn_backend_torch.cpp
> @@ -29,6 +29,7 @@
>  extern "C" {
>  #include "dnn_io_proc.h"
>  #include "dnn_backend_common.h"
> +#include "libavutil/cpu.h"
>  #include "libavutil/opt.h"
>  #include "libavutil/mem.h"
>  #include "queue.h"
> @@ -453,28 +454,42 @@ static DNNModel
> *dnn_load_model_th(DnnContext *ctx, DNNFunctionType func_type, A
>          goto fail;
>      }
> 
> +    if (ctx->nireq <= 0)
> +        ctx->nireq = av_cpu_count() / 2 + 1;
> +
> +#if !HAVE_PTHREAD_CANCEL
> +    if (ctx->nireq != 1) {

Others LGTM except that it's better to check ctx->async here.
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to