Thoughts about assembly language

Skip to first unread message

Jeff Mears

Feb 25, 2022, 3:57:10 PM2/25/22
Looking at the libvpx project, I'm thinking that perhaps libvpx shouldn't use assembly language for anything. Using assembly language as opposed to intrinsics adds much complexity to the project.

For one, it complicates the build process. The requirement to use Yasm is a problem in some environments.

Additionally, supporting every ABI out there is difficult. As an example, the existing assembly code does not follow the Windows x64 calling convention fully: there is no exception metadata for stack unwinding. Crashes in the libvpx assembly code won't have a stack trace in Windows because of this.

The assembly code I've seen in libvpx looks like it would be better off as intrinsics. It likely would be slightly slower, but you'd gain in maintenance advantages.

Much of this is likely true of libdav1d as well, but I haven't checked.

James Zern

Feb 25, 2022, 4:30:23 PM2/25/22
Hi Jeff,

I agree with most of your points and new code in libvpx and libaom has primarily been in intrinsics. The performance gap for simpler functions has improved over the years, but I think in many projects that deal with media performance is generally prioritized as a few percent difference can be significant. I'm opposed to converting some of the code to intrinsics, but that work isn't planned and any change would be subject to the performance impact.

James Zern

Feb 25, 2022, 4:34:30 PM2/25/22
I'm not opposed... 
Reply all
Reply to author
0 new messages