-
Notifications
You must be signed in to change notification settings - Fork 292
Support compress&expand in avx512vbmi2 #1102
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3a75f59
Initial support for avx512vbmi
junparser 83da277
Change avx512vnni_vbmi to avx512vnni_bmi2
junparser 8ede86e
add compress&expand in avx512vbmi2
junparser 85414a7
Move batch<int8_t, A> swizzle to avx512vbmi with _mm512_permutexvar_epi8
junparser 21e98dc
Renaming avx512vnni_vbmi file to avx512vnni_vbmi2, NFC
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /*************************************************************************** | ||
| * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and * | ||
| * Martin Renou * | ||
| * Copyright (c) QuantStack * | ||
| * Copyright (c) Serge Guelton * | ||
| * * | ||
| * Distributed under the terms of the BSD 3-Clause License. * | ||
| * * | ||
| * The full license is in the file LICENSE, distributed with this software. * | ||
| ****************************************************************************/ | ||
|
|
||
| #ifndef XSIMD_AVX512VBMI2_HPP | ||
| #define XSIMD_AVX512VBMI2_HPP | ||
|
|
||
| #include <array> | ||
| #include <type_traits> | ||
|
|
||
| #include "../types/xsimd_avx512vbmi2_register.hpp" | ||
|
|
||
| namespace xsimd | ||
| { | ||
|
|
||
| namespace kernel | ||
| { | ||
| using namespace types; | ||
|
|
||
| // compress | ||
| template <class A> | ||
| XSIMD_INLINE batch<int16_t, A> compress(batch<int16_t, A> const& self, batch_bool<int16_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_compress_epi16(mask.mask(), self); | ||
| } | ||
| template <class A> | ||
| XSIMD_INLINE batch<uint16_t, A> compress(batch<uint16_t, A> const& self, batch_bool<uint16_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_compress_epi16(mask.mask(), self); | ||
| } | ||
| template <class A> | ||
| XSIMD_INLINE batch<int8_t, A> compress(batch<int8_t, A> const& self, batch_bool<int8_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_compress_epi8(mask.mask(), self); | ||
| } | ||
| template <class A> | ||
| XSIMD_INLINE batch<uint8_t, A> compress(batch<uint8_t, A> const& self, batch_bool<uint8_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_compress_epi8(mask.mask(), self); | ||
| } | ||
|
|
||
| // expand | ||
| template <class A> | ||
| XSIMD_INLINE batch<int16_t, A> expand(batch<int16_t, A> const& self, batch_bool<int16_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_expand_epi16(mask.mask(), self); | ||
| } | ||
| template <class A> | ||
| XSIMD_INLINE batch<uint16_t, A> expand(batch<uint16_t, A> const& self, batch_bool<uint16_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_expand_epi16(mask.mask(), self); | ||
| } | ||
| template <class A> | ||
| XSIMD_INLINE batch<int8_t, A> expand(batch<int8_t, A> const& self, batch_bool<int8_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_expand_epi8(mask.mask(), self); | ||
| } | ||
| template <class A> | ||
| XSIMD_INLINE batch<uint8_t, A> expand(batch<uint8_t, A> const& self, batch_bool<uint8_t, A> const& mask, requires_arch<avx512vbmi2>) noexcept | ||
| { | ||
| return _mm512_maskz_expand_epi8(mask.mask(), self); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #endif |
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /*************************************************************************** | ||
| * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and * | ||
| * Martin Renou * | ||
| * Copyright (c) QuantStack * | ||
| * Copyright (c) Serge Guelton * | ||
| * * | ||
| * Distributed under the terms of the BSD 3-Clause License. * | ||
| * * | ||
| * The full license is in the file LICENSE, distributed with this software. * | ||
| ****************************************************************************/ | ||
|
|
||
| #ifndef XSIMD_AVX512VBMI2_REGISTER_HPP | ||
| #define XSIMD_AVX512VBMI2_REGISTER_HPP | ||
|
|
||
| #include "./xsimd_avx512vbmi_register.hpp" | ||
|
|
||
| namespace xsimd | ||
| { | ||
|
|
||
| /** | ||
| * @ingroup architectures | ||
| * | ||
| * AVX512VBMI instructions | ||
| */ | ||
| struct avx512vbmi2 : avx512vbmi | ||
| { | ||
| static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512VBMI2; } | ||
| static constexpr bool available() noexcept { return true; } | ||
| static constexpr char const* name() noexcept { return "avx512vbmi2"; } | ||
| }; | ||
|
|
||
| #if XSIMD_WITH_AVX512VBMI2 | ||
|
|
||
| #if !XSIMD_WITH_AVX512VBMI | ||
| #error "architecture inconsistency: avx512vbmi2 requires avx512vbmi" | ||
| #endif | ||
|
|
||
| namespace types | ||
| { | ||
| template <class T> | ||
| struct get_bool_simd_register<T, avx512vbmi2> | ||
| { | ||
| using type = simd_avx512_bool_register<T>; | ||
| }; | ||
|
|
||
| XSIMD_DECLARE_SIMD_REGISTER_ALIAS(avx512vbmi2, avx512vbmi); | ||
|
|
||
| } | ||
| #endif | ||
| } | ||
| #endif |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you motivate this change? Why would composition between avx512 VNNI be more legit with VMBI2 rather than VBMI?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this change based on https://en.wikichip.org/wiki/x86/avx512_vnni. The table shows that all of the arch have vbmi2 as well as vnni.