Skip to content

Commit dede991

Browse files
committed
rstdoc: update change logs, avx512 flag topics
1 parent 4f87ee3 commit dede991

3 files changed

Lines changed: 49 additions & 18 deletions

File tree

distrib/docs/english/source/avisynthdoc/FilterSDK/Cplusplus_api.rst

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,10 @@ To test against the default Avisynth+ "fast" flags, test:
487487
::
488488

489489
if ((env->GetCPUFlags() & CPUF_AVX512_FAST) == CPUF_AVX512_FAST) {
490-
// all "fast" AVX512 features supported
490+
// all "fast" AVX512 features supported (in AviSynth: *_avx512.cpp)
491+
// function dispatch here
492+
} else if ((env->GetCPUFlags() & CPUF_AVX512_BASE) == CPUF_AVX512_BASE)) {
493+
// "base" AVX512 features supported (in AviSynth: *_avx512b.cpp)
491494
// function dispatch here
492495
} else if (env->GetCPUFlags() & CPUF_AVX2) {
493496
// AVX2 path
@@ -497,13 +500,27 @@ To test against the default Avisynth+ "fast" flags, test:
497500
// simple C++ path
498501
}
499502

500-
In Avisynth - as of end of 2025 -, the AVX512 function dispatchers check for CPUF_AVX512_FAST for calling function from ``*_avx512.cpp`` files.
501-
Compiler flags for ``*_avx512.cpp`` files are automatically set for MSVC as /arch:AVX512.
502-
For gcc or LLVM (clang-cl) builds the relevant flags in CMakeLists.txt are set
503-
as ``"-mfma -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni -mavx512vbmi -mavx512vbmi2 -mavx512bitalg -mavx512vpopcntdq "`` .
503+
In Avisynth AVX512 function dispatchers check for CPUF_AVX512_BASE and CPUF_AVX512_FAST for calling function from
504+
``*_avx512b.cpp`` or ``*_avx512.cpp`` files, repectively.
505+
506+
Compiler flags for ``*_avx512b.cpp`` and ``*_avx512.cpp`` files are automatically set for MSVC as ``/arch:AVX512``.
507+
508+
For gcc or LLVM (clang-cl) builds the relevant flags in CMakeLists.txt are set as
509+
510+
* "Base" (``*_avx512b.cpp``) : ``" -mfma -mbmi2 -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl "``
511+
* "Fast" (``*_avx512.cpp``) : ``" -mfma -mbmi2 -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl -mavx512vnni -mavx512vbmi -mavx512vbmi2 -mavx512bitalg -mavx512vpopcntdq "``
512+
513+
Similar to AVX2, FMA must be added explicitly for GCC/Clang. We also enable BMI2, as it is standard since AVX2 and useful for
514+
AVX512 mask operations like _bzhi_u64/u32. The core subsets (F, CD, BW, DQ, VL) comprising the CPUF_AVX512_BASE
515+
flag are present on all AVX-512-capable architectures.
516+
517+
We note again: early Xeon (e.g., Skylake-X/Cascadelake) may exhibit severe thermal throttling even on a single thread.
518+
In AviSynth+, AVX512_BASE must be manually enabled in-script unless ``CPUF_AVX512_FAST`` is also detected.
519+
Functions in ``*_avx512b.cpp`` should be dispatched on ``CPUF_AVX512_BASE``.
520+
Functions in ``*_avx512.cpp`` should be dispatched on ``CPUF_AVX512_FAST``.
504521

505-
The relevant CPU features for the "Fast" group are: FMA3, AVX512_BASE (F, CD, BW, DQ, Vl) and the "fast avx512" criteria.
506522
AVX512 is considered to be "Fast" when either
523+
507524
- pre AVX10, and minimum Ice Lake architecture is found (VNNI, VBMI, VBMI2, BITALG, VPOPCNTDQ and three crypto flags).
508525
- or AVX10 (any version) is found.
509526

@@ -2909,7 +2926,7 @@ Intel x86 and AMD64 CPU feature flags
29092926
+------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------------------+
29102927
| ``CPUF_AVX512VBMI`` | ``0x10000000`` | AVX-512 VBMI, byte/word shuffling, sign/zero extension, and general pixel manipulation |
29112928
+------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------------------+
2912-
| ``CPUF_AVX512_BASE`` | ``0x20000000`` | AVX-512 Base group feature set. When F, CD, BW, DQ, VL flags exist |
2929+
| ``CPUF_AVX512_BASE`` | ``0x20000000`` | AVX-512 Base group feature set. When F, CD, BW, DQ, VL flags exist. Avisynth sets it only if CPUF_AVX512_FAST exists |
29132930
+------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------------------+
29142931
| ``CPUF_AVX512_FAST`` | ``0x40000000`` | Base + VNNI, VBMI, VBMI2, BITALG, VPOPCNTDQ. Spec detection logic excludes older/throttling models that also have these |
29152932
| | | features |
@@ -2934,6 +2951,11 @@ AVX-512 features are grouped into two categories:
29342951
- CPUF_AVX512_BASE: Base (F, CD, BW, DQ, VL)
29352952
- CPUF_AVX512_FAST: The "usable" AVX-512, starting with Intel's 10th gen Ice Lake, incl. AMD Zen4/5. The features Base + (VNNI, VBMI, VBMI2, BITALG, VPOPCNTDQ) are guaranteed.
29362953

2954+
Important note for user of old AVX512 CPUs, where only the Base flags exist (not an Ice Lake or better level CPU):
2955+
the "Base" group flag ``CPUF_AVX512_BASE`` is not enabled automatically, even if the individual base flags exist!
2956+
The reason is to prevent the AVX512 Base-only optimizations in Avisynth for possibly old AVX512 systems.
2957+
However when users know what they are doing (know they do have non-throttling old CPU), they can enable it with ``SetMaxCPU("avx512base+")``
2958+
29372959
"Fast" means a usable AVX-512 implementation without severe throttling penalties on client CPUs. It basically guarantees a feature set
29382960
similar to Intel Ice Lake/Rocket Lake and AMD Zen4/Zen5 and excludes older AVX-512 implementations (Skylake-X, Cascade Lake, Ice Lake-SP)
29392961
which have severe throttling issues on client CPUs.
@@ -2953,7 +2975,7 @@ Due to the large number of AVX-512 sub-features, the following group and composi
29532975
:align: center
29542976

29552977
+------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------------------+
2956-
| ``CPUF_AVX512_BASE`` | ``0x20000000`` | AVX-512 Base group feature set. When F, CD, BW, DQ, VL flags exist |
2978+
| ``CPUF_AVX512_BASE`` | ``0x20000000`` | AVX-512 Base group feature set. When F, CD, BW, DQ, VL flags. Avisynth sets it only if CPUF_AVX512_FAST exists |
29572979
+------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------------------+
29582980
| ``CPUF_AVX512_FAST`` | ``0x40000000`` | AVX-512 Advance group FAST (Ice Lake/Rocket Lake/Zen4/Zen5) feature set: Base + VNNI, VBMI, VBMI2, BITALG, VPOPCNTDQ. |
29592981
+------------------------------+--------------------+---------------------------------------------------------------------------------------------------------------------------+
@@ -2973,7 +2995,10 @@ Due to the large number of AVX-512 sub-features, the following group and composi
29732995
Compiling code solely with checking only ``"avx512base"`` (which often only implies first-generation AVX-512)
29742996
can lead to poor performance due to aggressive clock throttling on older hardware.
29752997

2976-
Developers should generally use ``"avx512fast"`` group as a minimum for realistic performance testing of 512-bit code paths.
2998+
Developers should generally use ``"avx512fast"`` group in their optimizer function dispatchers, as a minimum for
2999+
realistic performance testing of 512-bit code paths. Avisynth (e.g. in resamplers) has both base and fast optimizations
3000+
implemented. However for accessing the optimizations for "Base" AVX512 on old CPUs, ``SetMaxCPU("avx512base+")`` script
3001+
command must be used to re-enable AVX512 on these systems.
29773002

29783003

29793004
.. note::

distrib/docs/english/source/avisynthdoc/changelist376.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Additions, changes
1313
- "Info": Optimize AVX512 features display, group features, make a bit more compact
1414
- "Info": add L2 cache size display
1515
- "SetMaxCPU": add "avx512base" and "avx512fast" options to enable/disable AVX512 grouped features.
16-
see :ref:`SetMaxCPU <setmaxcpu>` .
16+
see :ref:`SetMaxCPU <setmaxcpu>` . Users of base-only AVX512 CPUs can enable Avisynth-optimizations
17+
with SetMaxCPU("avx512base+").
1718
- ARM64 (aarch64) area:
1819

1920
* "Info": add ARMV8-A features display (NEON, DOTPROD, SVE2)
@@ -27,10 +28,11 @@ Additions, changes
2728
Build environment, Interface
2829
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2930
- introduce ``AVS_RESTRICT`` to ``avs/config.h`` (compiler invariant c++ ``__restrict``)
30-
- AVX512: CMake to recognize ``*_avx512.*`` file pattern, add compiler specific AVX512
31+
- AVX512: CMake to recognize ``*_avx512b.*`` and ``*_avx512.*`` file pattern, add compiler specific AVX512
3132
compile flags accordingly (AVX512 Base and Ice Lake extensions)
3233
- AVX512 support by conditional define.
3334
Define `INTEL_INTRINSICS_AVX512` if avx512 modules are enabled and compiler supports it.
35+
For MSVC,AVX512 support enabled only from MSVC 2019 16.2 (19.22) or newer.
3436
- add ``.editorconfig``, update .gitignore to include the new .slnx format of Visual Studio 2026
3537
- v12 interface: Global Lock support (https://github.com/AviSynth/AviSynthPlus/issues/444),
3638
mainly for plugins using common fftw3 library:
@@ -55,7 +57,7 @@ Build environment, Interface
5557
- added many new AVX512 individual feature flags
5658
- added ARM64 feature flags CPUF_ARM_NEON, CPUF_ARM_DOTPROD, CPUF_ARM_SVE2
5759
- CPUF_xxxxx flags are now 64 bit, replace enum with constexpr.
58-
- CMakeLists.txt: avx512 compile flag support for gcc/clang ("fast" Ice Lake-like feature set).
60+
- CMakeLists.txt: avx512 compile flag support for gcc/clang ("base" and "fast", latter is Ice Lake-like feature set).
5961
- V12 interface: ``GetCPUFlagsEx`` returning 64 bit flags (too many AVX512 subfeatures to fit in 32 bit).
6062
C interface: ``avs_get_cpu_flags_ex``.
6163
see :ref:`GetCPUFlagsEx<cplusplus_getcpuflagsex>` and :ref:`GetCPUFlags<cplusplus_getcpuflags>`
@@ -111,20 +113,20 @@ Bugfixes
111113

112114
Optimizations
113115
~~~~~~~~~~~~~
116+
- TurnLeft, TurnRight: AVX2 support (1,5-3x speed on i7-11700 compared to SSE2 version)
117+
- Turn180 AVX2 support (very slight speed gain)
114118
- Resamplers:
115119

116120
* introduce a SIMD-like C header (avs_simd_c.h) for smart auto-vectorizing compilers.
117121
* restore vertical float performance (3.7.4 was slower than 3.7.3) + SSE2 special optimization
118122
* further optimize verticals, use ``AVS_RESTRICT``
123+
* (quicker RGB32/64 horizontal on AVX2 since TurnRigh/Left was optimized - packed RGB H-resize = TurnLeft-V-Resize-TurnRight)
119124
* optimize SSSE3 and AVX2 horizontal resampler for 32-bit float for small (<=4) kernel sizes
120125
* optimize 32-bit float vertical avx2
121126
* add AVX512 code path
122127

123128
- 32-bit float resamplers, verticals; horizontals up to kernel size 16.
124-
- 8-16-bit horizontal resamplers,
125-
126-
- kernel size <= 4 and specific ratios; 300%+ !!
127-
- kernel sizes up to 8 and 16 and specific ratios.
129+
- 8-16-bit horizontal resamplers, for kernel size <= 16 and specific ratios; speed gain up to 300%+ (DTL2020)!!
128130
- 8-16-bit vertical resamplers
129131
* (Work In Progress) unify horizontal and vertical plane processing flow
130132

@@ -151,7 +153,7 @@ Documentation
151153
Please report bugs at `github AviSynthPlus page`_ - or - `Doom9's AviSynth+
152154
forum`_
153155

154-
$Date: 2026/01/07 15:19:00 $
156+
$Date: 2026/01/17 21:50:00 $
155157

156158
.. _github AviSynthPlus page:
157159
https://github.com/AviSynth/AviSynthPlus

distrib/docs/english/source/avisynthdoc/syntax/syntax_internal_functions_global_options.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ distinguishing the Ice Lake generation from the earlier Skylake-X and Cascade La
105105
Multiple options can be put in a comma separated list. They will evaluate in that order.
106106

107107
The ``"avx512base"`` and ``"avx512fast"`` cover a group of feature flags. Internal Avisynth+ codes test for
108-
``CPUF_AVX512_FAST`` in internal AVX-512 optimized paths, not the base CPUF_AVX512_BASE one.
108+
``CPUF_AVX512_BASE`` and ``CPUF_AVX512_FAST`` in internal AVX-512 optimized paths.
109109

110110
.. note::
111111

@@ -123,6 +123,9 @@ The ``"avx512base"`` and ``"avx512fast"`` cover a group of feature flags. Intern
123123
lead to **misleadingly poor performance** due to aggressive clock throttling on older hardware.
124124

125125
Developers should generally use the ``"avx512fast"`` group for realistic performance testing of 512-bit code paths.
126+
127+
Users, who have AVX512 Base level CPU but "Fast" is not fulfilled, must manually enable the Base features,
128+
despite that the individual flags (F, CD, BW, DQ, VL) may exist.
126129

127130

128131
*Examples:*
@@ -131,6 +134,7 @@ The ``"avx512base"`` and ``"avx512fast"`` cover a group of feature flags. Intern
131134
SetMaxCPU("SSE2") #reports at most SSE2 processor (even if AVX2 is available)
132135
SetMaxCPU("avx,sse4.1-") #limits to avx2 but explicitely removes reporting sse4.1 support
133136
SetMaxCPU("none,avx2+") #limits to plain C, then switches on AVX2-only support
137+
SetMaxCPU("avx512base+") # Forcibly switches on AVX512 Base support, for users of old AVX512 CPU.
134138

135139
OnCPU
136140
~~~~~

0 commit comments

Comments
 (0)