WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
258708
[LibWebRTC] Enable AVX2 extensions only if host supports AVX2
https://bugs.webkit.org/show_bug.cgi?id=258708
Summary
[LibWebRTC] Enable AVX2 extensions only if host supports AVX2
Diego Pino
Reported
2023-06-29 20:24:53 PDT
265400@main
updated the CMake list of LibWebRTC sources after update to M115 (
265320@main
). In the sources update, a new block was added to include specialized files that make use of AVX2 extensions if the host is X64. This condition is too broad, since not all X64 computers have support for AVX2 extensions (rare nowadays, but it may happen). Another issue we found out was that since the AVX2 files are built with `-march=native` the host may emit AVX512 instructions if the host supports that extension. This may cause compatibility issues if a binary is built in a host with AVX512 support and it is executed in a host without AVX512 suport (the result will be a crash due to 'invalid instruction'). The build flag `m=no-avx512f` prevents emitting AVX512 instructions.
https://stackoverflow.com/questions/60815316/disabling-all-avx512-extensions
Attachments
Add attachment
proposed patch, testcase, etc.
Diego Pino
Comment 1
2023-06-29 20:39:29 PDT
Pull request:
https://github.com/webkit/webkit/pull/15432
EWS
Comment 2
2023-06-30 01:18:09 PDT
Committed
265646@main
(d95cad7579b5): <
https://commits.webkit.org/265646@main
> Reviewed commits have been landed. Closing PR #15432 and removing active labels.
Radar WebKit Bug Importer
Comment 3
2023-06-30 01:19:15 PDT
<
rdar://problem/111556402
>
Diego Pino
Comment 4
2023-07-03 20:14:02 PDT
After chatting with Carlos Lopez in a private conversation, we concluded that the LibWebRTC's AVX2 files should be included always, regardless of whether the host machine that builds WebKit has support for it or not. The flags `-march=machine -mno-avx512f` added to CMAKE_CXX_FLAGS should be removed because they affect all files. Instead, these flags should only apply to the set of AVX2 files. To enable compilation with AVX2 extension is enough with adding '-mavx2'. This is how Chromium does it:
https://webrtc.googlesource.com/src/+/refs/heads/main/modules/audio_processing/aec3/BUILD.gn#269
CMake macro `set_source_files_properties` can be used to apply build flags to a set of files.
https://cmake.org/cmake/help/latest/prop_sf/COMPILE_OPTIONS.html#prop_sf:COMPILE_OPTIONS
Diego Pino
Comment 5
2023-07-03 20:21:03 PDT
Pull request:
https://github.com/webkit/webkit/pull/15527
EWS
Comment 6
2023-07-04 07:45:25 PDT
Committed
265754@main
(0de2717c0029): <
https://commits.webkit.org/265754@main
> Reviewed commits have been landed. Closing PR #15527 and removing active labels.
Diego Pino
Comment 7
2023-07-05 21:38:50 PDT
Re-opening for pull request
https://github.com/webkit/webkit/pull/15586
EWS
Comment 8
2023-07-05 21:48:08 PDT
Committed
265790@main
(48d7dce49219): <
https://commits.webkit.org/265790@main
> Reviewed commits have been landed. Closing PR #15586 and removing active labels.
Diego Pino
Comment 9
2023-07-06 19:47:55 PDT
Re-opening for pull request
https://github.com/webkit/webkit/pull/15622
EWS
Comment 10
2023-07-06 20:00:16 PDT
Committed
265832@main
(aff1c9e1b48a): <
https://commits.webkit.org/265832@main
> Reviewed commits have been landed. Closing PR #15622 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug