[FFmpeg-devel] [PATCH] swscale: Disable avx2 hscale 8to15 on IceLake and below due to Intel Gather Data Sampling mitigation performance loss

Alan Kelly alankelly at google.com
Fri Aug 8 15:20:45 EEST 2025


Intel provided a microcode update to mitigate this security
vulnerability which has a huge negative performance impact on gather
instructions. This means that hscale 8to15 avx2, which uses gather
extensively, is no longer faster than SSSE3 on impacted CPUs.
---
 libavutil/x86/cpu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index d6cd4fab9c..923c63e0c4 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -244,9 +244,11 @@ int ff_get_cpu_flags_x86(void)
             family == 6 && model < 23)
             rval |= AV_CPU_FLAG_SSSE3SLOW;
 
-        /* Haswell has slow gather */
-        if ((rval & AV_CPU_FLAG_AVX2) && family == 6 && model < 70)
+        /* Ice Lake and below have slow gather due to Gather Data Sampling
+         * mitigation. */
+        if ((rval & AV_CPU_FLAG_AVX2) && family == 6 && model < 143) {
             rval |= AV_CPU_FLAG_SLOW_GATHER;
+        }
     }
 
 #endif /* cpuid */
-- 
2.50.1.703.g449372360f-goog



More information about the ffmpeg-devel mailing list