Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] get_cabac_inline_x86: Don't inline the assembly function on 32 bit
@ 2023-03-28 10:53 Martin Storsjö
  2023-03-31  6:52 ` Martin Storsjö
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Storsjö @ 2023-03-28 10:53 UTC (permalink / raw)
  To: ffmpeg-devel

From: Christopher Degawa <ccom@randomderp.com>

While the inline cabac assembly has worked correctly in i386 builds
historically, modern compiler updates has started showing issues
with it, when the function gets inlined into larger contexts that
fail to provide the amount of free registers as this function
requires.

This was an issue with Clang on Windows on i386, which was fixed
in c6d284b945324a7bc70ea8b9056040c8148aa835. However, recently
the same issues also have started showing up with GCC (both for
Windows and Linux). Whether the issue appears seems dependent on
a lot of optimizer tuning (e.g. the issue appears or goes away
depenent on the combinaton of -march= and -mtune= options),
potentially due to the compiler making different decisions on
how much to inline.

Fixes: https://trac.ffmpeg.org/ticket/8903

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavcodec/x86/cabac.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
index b046a56a6b..ce2aefcbac 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -178,7 +178,7 @@
 #if HAVE_7REGS && !BROKEN_COMPILER
 #define get_cabac_inline get_cabac_inline_x86
 static
-#if defined(_WIN32) && !defined(_WIN64) && defined(__clang__)
+#if ARCH_X86_32
 av_noinline
 #else
 av_always_inline
-- 
2.37.1 (Apple Git-137.1)

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] get_cabac_inline_x86: Don't inline the assembly function on 32 bit
  2023-03-28 10:53 [FFmpeg-devel] [PATCH] get_cabac_inline_x86: Don't inline the assembly function on 32 bit Martin Storsjö
@ 2023-03-31  6:52 ` Martin Storsjö
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Storsjö @ 2023-03-31  6:52 UTC (permalink / raw)
  To: ffmpeg-devel

On Tue, 28 Mar 2023, Martin Storsjö wrote:

> From: Christopher Degawa <ccom@randomderp.com>
>
> While the inline cabac assembly has worked correctly in i386 builds
> historically, modern compiler updates has started showing issues
> with it, when the function gets inlined into larger contexts that
> fail to provide the amount of free registers as this function
> requires.
>
> This was an issue with Clang on Windows on i386, which was fixed
> in c6d284b945324a7bc70ea8b9056040c8148aa835. However, recently
> the same issues also have started showing up with GCC (both for
> Windows and Linux). Whether the issue appears seems dependent on
> a lot of optimizer tuning (e.g. the issue appears or goes away
> depenent on the combinaton of -march= and -mtune= options),
> potentially due to the compiler making different decisions on
> how much to inline.
>
> Fixes: https://trac.ffmpeg.org/ticket/8903
>
> Signed-off-by: Martin Storsjö <martin@martin.st>
> ---
> libavcodec/x86/cabac.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
> index b046a56a6b..ce2aefcbac 100644
> --- a/libavcodec/x86/cabac.h
> +++ b/libavcodec/x86/cabac.h
> @@ -178,7 +178,7 @@
> #if HAVE_7REGS && !BROKEN_COMPILER
> #define get_cabac_inline get_cabac_inline_x86
> static
> -#if defined(_WIN32) && !defined(_WIN64) && defined(__clang__)
> +#if ARCH_X86_32
> av_noinline
> #else
> av_always_inline
> -- 
> 2.37.1 (Apple Git-137.1)

Will push this today if there's no objections.

// Martin
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-31  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 10:53 [FFmpeg-devel] [PATCH] get_cabac_inline_x86: Don't inline the assembly function on 32 bit Martin Storsjö
2023-03-31  6:52 ` Martin Storsjö

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