Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVX512 not working with x265 or svt-av1 codecs #483

Closed
phpb-com opened this issue Jul 4, 2024 · 7 comments
Closed

AVX512 not working with x265 or svt-av1 codecs #483

phpb-com opened this issue Jul 4, 2024 · 7 comments

Comments

@phpb-com
Copy link
Contributor

phpb-com commented Jul 4, 2024

I've tried to run this ffmpeg on a system with AVX512 and found that neither x265 nor svt-av1 are using it. I was able to make svt-av1 use it after adding -DENABLE_AVX512=ON to the Dockerfile (to the compilation flags of svt-av1) but was not able to make x265 use or detect it. Do you know of any reasons why that might be the case with x265?

@phpb-com
Copy link
Contributor Author

phpb-com commented Jul 4, 2024

actually, adding asm=avx512 to the -x265-params does seem to work, so I guess the only thing is to maybe add compilation flag to the svt-av1 if it it not going to break compilation for the other architectures.

@wader
Copy link
Owner

wader commented Jul 4, 2024

Hey, huh nice find! i guess at the time i assumed it would be feature detected. I see in build log that some other libs and ffmpeg do detect and i hope build with avx512.

So yes it would be great to add this if it needs to be done explicitly in some places. I wonder if it needs to be done conditionally only for amd64? also for svt-av1 the cmake has AVX512 stuff but for x265 i don't find much about asm=avx512, do you know if it's documented etc somewhere? ...also are there more cpu features we should enable in some libs?

About breaking, good question. I did a quick search what kind of support one can expect on half-modern cpus but was not clear, seems there are subsets of AVX-512? i also wonder if ffmpeg and libs usually runtime detect even if built with it?

@phpb-com
Copy link
Contributor Author

phpb-com commented Jul 4, 2024

https://www.intel.com/content/dam/develop/external/us/en/documents/mcw-intel-x265-avx512.pdf has the flag for avx512 so that is where I got it and converted into x265-param. Seems that the avx-svt1 has similar flag and it is in their documentation, but I have not tried it, and it is default to asm=max. x264 uses avx512 without any need to modify or recompile.

I am not sure of any other flags, or codecs that could benefit from them, but I am sure there are some for vpx codecs too.

@wader
Copy link
Owner

wader commented Jul 4, 2024

Aha now i see, you mean for x265 i do build with avx512 but it need to be enabled at runtime with -x265-params? if so can it be made default or is there some reason it's not default?

Sorry for feature creeping this issue, probably good to focus on fixing just avx512 for x265 and svt-av1 first. Can look at other stuff later.

Please do a draft PR if you like. It's a bit late here but can have a look at it also tomorrow

@phpb-com
Copy link
Contributor Author

phpb-com commented Jul 4, 2024

I think that x265 is not using avx512 unless forced is because it may actually make the encoding slower, so it is a good thing. As for the svt-av1, it does increase the performance but (from my understanding) it should be enabled during compile time to be utilized. In the end I think that the only thing that I should PR is svt-av1 compile flags, so I will do that for now. Enjoy your evening, I'll do it sometime within next 12 hours since I am AFK at the moment.

@wader
Copy link
Owner

wader commented Jul 5, 2024

I guess for x265 it could be mentioned in the README that it's possible

@wader
Copy link
Owner

wader commented Sep 26, 2024

Close issue? svt1-av1 is now built with avx512 and as i understand x265 can use avx512 with an option

@wader wader closed this as completed Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants