Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
To: "Rémi Denis-Courmont via ffmpeg-devel" <ffmpeg-devel@ffmpeg.org>
Cc: "Rémi Denis-Courmont" <remi@remlab.net>,
	harish.rajaselvan@multicorewareinc.com,
	"Martin Storsjö" <martin@martin.st>
Subject: [FFmpeg-devel] Re: [DISCUSSION] Adding ARM64EC support to FFmpeg
Date: Fri, 3 Oct 2025 15:44:56 +0300 (EEST)
Message-ID: <4c7e8b2-7d9b-aea8-90ca-16da7bcd8ee@martin.st> (raw)
In-Reply-To: <1932334.tdWV9SEqCh@basile.remlab.net>

On Sat, 27 Sep 2025, Rémi Denis-Courmont via ffmpeg-devel wrote:

> But this will constrain the assembler is aggravating. It probably requires
> major changes already, but even if it doesn't, I don't think we should
> constrain future assembler code nor expect developers to support the JIT-
> friendly ABI.

This is indeed a core concern of mine as well.

I don't mind adding build system tweaks to make it possible to build, but 
having to modify all the assembly to make it properly compatible with 
arm64ec isn't really feasible or maintainable.

Given the information in your other mails, it sounds like you don't make 
any modifications to the aarch64 assembly at all - so it uses all the 
aarch64 registers, including the ones that are disallowed to use in 
arm64ec mode.

If building with MSVC with the suggested configuration, building produces 
a very large number of warnings of this kind:

Z:\home\martin\code\ffmpeg-msvc-arm64ec\libavutil\aarch64\float_dsp_neon.o.asm(1056) 
: warning A4253: this instruction uses forbidden registers
         fmul            v16.4s, v0.4s,  v4.4s

The same also is produced if building with Clang:

src/libavutil/aarch64/float_dsp_neon.S:32:9: warning: register Q16 is 
disallowed on ARM64EC.
         fmul v16.4s, v0.4s, v4.4s
         ^

I've tried to talk to acquaintances to figure out exactly what one can 
expect to work and what one can't expect to work, if using assembly 
routines with all registers in arm64ec mode.

First off, calling a C function, which turns out to be in x86_64 mode, 
will clobber those registers. But for assembly which only works as leaf 
functions, that don't call C functions (and those C functions are internal 
in ffmpeg, which also are in arm64ec mode, not x86_64), this shouldn't be 
happening.

Secondly, unwinding through such functions won't work correctly either. 
But we never provide any unwind info for assembly functions, and don't 
expect to unwind through them anyway, so that's probably not an issue 
either.

Inspecting (and possibly single-stepping through) such code in a debugger 
could break.

One case which really can break though, is if some other process suspends 
and resumes the thread - as a form of manual scheduling. This sounds 
exotic, but I'm told these things do exist.

All in all, it sounds to me like these things actually can work, at least 
with some amount of caveats. In that case, it sounds acceptable to add 
build system tweaks to make it buildable, as long as the assembly itself 
doesn't need compromises for this mode.

I tested a checkasm.exe built in this mode, both with MSVC and with Clang, 
and it seems to run fine in a single-shot test at least.

// Martin
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

  reply	other threads:[~2025-10-03 12:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 10:04 [FFmpeg-devel] " harish.rajaselvan--- via ffmpeg-devel
2025-09-22 11:48 ` [FFmpeg-devel] " Martin Storsjö via ffmpeg-devel
2025-09-23 13:03   ` Harish Raja Selvan via ffmpeg-devel
2025-09-24 12:15     ` Martin Storsjö via ffmpeg-devel
2025-09-30  4:58       ` Harish Raja Selvan via ffmpeg-devel
2025-10-03 12:27         ` Martin Storsjö via ffmpeg-devel
2025-09-27  9:00 ` Rémi Denis-Courmont via ffmpeg-devel
2025-10-03 12:44   ` Martin Storsjö via ffmpeg-devel [this message]
2025-10-03 14:32     ` Rémi Denis-Courmont via ffmpeg-devel
2025-10-03 15:11       ` Martin Storsjö via ffmpeg-devel
2025-10-03 16:39         ` Rémi Denis-Courmont via ffmpeg-devel
2025-10-03 20:49           ` Stephen Hutchinson via ffmpeg-devel
2025-10-04  8:43             ` Rémi Denis-Courmont via ffmpeg-devel

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=4c7e8b2-7d9b-aea8-90ca-16da7bcd8ee@martin.st \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=harish.rajaselvan@multicorewareinc.com \
    --cc=martin@martin.st \
    --cc=remi@remlab.net \
    /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 http://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/ http://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