[FFmpeg-devel] [PATCH 03/10] lavc/hevcdec: allocate local_ctx as array of structs rather than pointers
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon May 27 16:10:02 EEST 2024
Anton Khirnov:
> Quoting Andreas Rheinhardt (2024-04-17 11:29:18)
>> Anton Khirnov:
>>> It is more efficient and easier to manage.
>>> ---
>>
>> Allocating structures used by slice contexts jointly has the potential
>> downside of false sharing if the structures are not sufficiently
>> aligned/padded.
>
> What do you suggest? Align first member to cacheline size?
>
This is problematic, because av_malloc is not necessarily aligned to the
chacheline size; for the same reason it is not possible to simply
DECLARE_ALIGNED_64 for it (see e.g.
7945d30e91b96d2f4f5b612048169087d214d41e). Given that the structure we
are talking about is already pretty big, the easiest way is to add
explicit padding at the end. Use __GCC_DESTRUCTIVE_SIZE if that is
defined or 64 if not (or maybe always use 128B?
https://stackoverflow.com/questions/72126606/should-the-cache-padding-size-of-x86-64-be-128-bytes).
- Andreas
More information about the ffmpeg-devel
mailing list