Skip to content

Commit f0c21e7

Browse files
Provide stub for avx512 vnni architecture
1 parent 42d885c commit f0c21e7

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

include/xsimd/arch/xsimd_isa.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
#include "./xsimd_avx512vbmi.hpp"
8585
#endif
8686

87+
#if XSIMD_WITH_AVX512VNNI
88+
#include "./xsimd_avx512vnni.hpp"
89+
#endif
90+
8791
#if XSIMD_WITH_NEON
8892
#include "./xsimd_neon.hpp"
8993
#endif

include/xsimd/config/xsimd_config.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,17 @@
288288
#define XSIMD_WITH_AVX512VBMI 0
289289
#endif
290290

291+
/**
292+
* @ingroup xsimd_config_macro
293+
*
294+
* Set to 1 if AVX512VNNI is available at compile-time, to 0 otherwise.
295+
*/
296+
#ifdef __AVX512VNNI__
297+
#define XSIMD_WITH_AVX512VNNI XSIMD_WITH_AVX512F
298+
#else
299+
#define XSIMD_WITH_AVX512VNNI 0
300+
#endif
301+
291302
#ifdef __ARM_NEON
292303

293304
/**

include/xsimd/config/xsimd_cpuid.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ namespace xsimd
5454
unsigned avx512pf : 1;
5555
unsigned avx512ifma : 1;
5656
unsigned avx512vbmi : 1;
57+
unsigned avx512vnni : 1;
5758
unsigned neon : 1;
5859
unsigned neon64 : 1;
5960
unsigned sve : 1;
@@ -206,6 +207,9 @@ namespace xsimd
206207

207208
avx512vbmi = regs7[2] >> 1 & 1;
208209
best = std::max(best, avx512vbmi::version() * avx512vbmi * avx512ifma * avx512bw * avx512dq * avx512cd * avx512f);
210+
211+
avx512vnni = regs7[2] >> 11 & 1;
212+
best = std::max(best, avx512vnni::version() * avx512vnni * avx512vbmi * avx512ifma * avx512bw * avx512dq * avx512cd * avx512f);
209213
#endif
210214
}
211215
};

include/xsimd/types/xsimd_all_registers.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "xsimd_fma3_avx2_register.hpp"
2222
#include "xsimd_fma3_avx_register.hpp"
2323

24+
#include "xsimd_avx512vnni_register.hpp"
25+
2426
#include "xsimd_avx512ifma_register.hpp"
2527
#include "xsimd_avx512vbmi_register.hpp"
2628

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/***************************************************************************
2+
* Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3+
* Martin Renou *
4+
* Copyright (c) QuantStack *
5+
* Copyright (c) Serge Guelton *
6+
* *
7+
* Distributed under the terms of the BSD 3-Clause License. *
8+
* *
9+
* The full license is in the file LICENSE, distributed with this software. *
10+
****************************************************************************/
11+
12+
#ifndef XSIMD_AVX512VNNI_REGISTER_HPP
13+
#define XSIMD_AVX512VNNI_REGISTER_HPP
14+
15+
#include "./xsimd_avx512vbmi_register.hpp"
16+
17+
namespace xsimd
18+
{
19+
20+
/**
21+
* @ingroup architectures
22+
*
23+
* AVX512VNNI instructions
24+
*/
25+
struct avx512vnni : avx512vbmi
26+
{
27+
static constexpr bool supported() noexcept { return XSIMD_WITH_AVX512VNNI; }
28+
static constexpr bool available() noexcept { return true; }
29+
static constexpr unsigned version() noexcept { return generic::version(3, 6, 0); }
30+
static constexpr char const* name() noexcept { return "avx512vnni"; }
31+
};
32+
33+
#if XSIMD_WITH_AVX512VNNI
34+
35+
namespace types
36+
{
37+
template <class T>
38+
struct get_bool_simd_register<T, avx512vnni>
39+
{
40+
using type = simd_avx512_bool_register<T>;
41+
};
42+
43+
XSIMD_DECLARE_SIMD_REGISTER_ALIAS(avx512vnni, avx512vbmi);
44+
45+
}
46+
#endif
47+
}
48+
#endif

0 commit comments

Comments
 (0)