Prefer avx512vl_256 over avxvnni for 256-bit sized batches#1381
Open
DiamonDinoia wants to merge 1 commit into
Open
Prefer avx512vl_256 over avxvnni for 256-bit sized batches#1381DiamonDinoia wants to merge 1 commit into
DiamonDinoia wants to merge 1 commit into
Conversation
When both AVX-VNNI and AVX512VL are available, make_sized_batch/sized_batch
walks all_x86_architectures in order and picks the first arch matching the
requested lane count. For 256-bit float/double batches this selected avxvnni,
whose masked load/store lower to vmaskmov{ps,pd} — a ~3-uop op on Intel that
also does not store-forward. avx512vl_256 (which inherits fma3<avx2>, so every
non-masked op is byte-identical) instead lowers masked load/store to EVEX
k-register moves (vmovups{k}, _mm256_mask*), 1 uop and forwardable.
Reordering avx512vl_256 ahead of avxvnni makes 256-bit sized batches select it
whenever AVX512VL is present. VNNI-only targets (e.g. Alder Lake client) still
resolve to avxvnni, since avx512vl_256 is filtered out of supported_architectures
there — so no target loses codegen, and AVX-512 targets gain clean k-masking.
Note: avx512vl_256 uses EVEX-encoded 256-bit ops, which do not trigger the
512-bit license-based downclock on Skylake-SP/Ice Lake/Sapphire Rapids.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reordering avx512vl_256 ahead of avxvnni makes 256-bit sized batches select it whenever AVX512VL is present.