Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 01/14] vvcdec: add thread executor
Date: Mon, 22 May 2023 19:29:43 +0300
Message-ID: <3830277.hng86v5qvY@basile.remlab.net> (raw)
In-Reply-To: <CAFXK13cuNwO0Ey--5P_yau7bjTq4AP6UPu6Ei1DSKxw-Qk6Vzw@mail.gmail.com>

Le sunnuntaina 21. toukokuuta 2023, 17.24.56 EEST Nuo Mi a écrit :
> > > +
> > > +typedef struct ThreadInfo {
> > > +    int idx;
> > > +    VVCExecutor *e;
> > > +    pthread_t thread;
> > > +} ThreadInfo;
> > > +
> > > +struct VVCExecutor {
> > > +    VVCTaskCallbacks cb;
> > > +    ThreadInfo *threads;
> > > +    uint8_t *local_contexts;
> > 
> > It seems odd and needless complex to separate this from the thread info.
> > It
> > looks like you could simply append a pointer or a flexible array to
> > ThreadInfo
> > instead.
> 
>  Do you mean in VVCTasklet? No, we do not want to expose ThreadInfo details
> to users.

First, it feels very weird for a generic thread pool mechanism to have opaque 
per-thread state at all. AFAIK, any client state should be in the jobs, not 
the threads.

But even if... then the per-thread state should be in the thread structure, 
and the thread index should be unnecessary.

> > Signaling a condition variable without changing any state makes no sense.
> 
> It's for error handling.

Yeah, no.

> Imaging last all thread are waiting for ready jobs except the last one.
> The last one thread has some error, it reports an error to the caller.
> The caller needs to wake up threads to flush the task list.

That's not what this code does.

And you don't need to wake up all threads to flush the task list. There are two 
situations where it makes sense to wake more than one thread:
- When you want all to terminate to destroy the pool.
- When you have atomically queued so many jobs that you want to wake up idle 
runners at once, rather than signal them one at a time. (This is really only 
an optimisation, and only makes sense if you have really a lot of threads.)

-- 
レミ・デニ-クールモン
http://www.remlab.net/



_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2023-05-22 16:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-21 13:03 [FFmpeg-devel] [PATCH 00/14] add vvc decoder c code Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 01/14] vvcdec: add thread executor Nuo Mi
2023-05-21 13:15   ` Rémi Denis-Courmont
2023-05-21 14:24     ` Nuo Mi
2023-05-22 16:29       ` Rémi Denis-Courmont [this message]
2023-05-23  6:23         ` Nuo Mi
2023-05-21 14:44     ` Nuo Mi
2023-05-21 14:11   ` Lynne
2023-05-21 15:03     ` Nuo Mi
2023-05-21 15:06       ` Lynne
2023-05-21 15:16         ` Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 02/14] vvcdec: add vvc decoder stub Nuo Mi
2023-05-21 17:30   ` Michael Niedermayer
2023-05-22  1:55     ` Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 03/14] vvcdec: add sps, pps, sh parser Nuo Mi
2023-05-21 14:25   ` James Almer
2023-06-10 11:37     ` Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 04/14] vvcdec: add cabac decoder Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 05/14] vvcdec: add reference management Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 06/14] vvcdec: add motion vector decoder Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 07/14] vvcdec: add inter prediction Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 08/14] vvcdec: add inv transform 1d Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 09/14] vvcdec: add intra prediction Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 10/14] vvcdec: add LMCS, Deblocking, SAO, and ALF filters Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 11/14] vvcdec: add dsp init and inv transform Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 12/14] vvcdec: add CTU(Coding Tree Unit) parser Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 13/14] vvcdec: add CTU thread logical Nuo Mi
2023-05-21 13:03 ` [FFmpeg-devel] [PATCH 14/14] vvcdec: add full vvc decoder Nuo Mi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3830277.hng86v5qvY@basile.remlab.net \
    --to=remi@remlab.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git