From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- third_party/intgemm/compile_test/avx2.cc | 25 ++++++++++++++++++ third_party/intgemm/compile_test/avx512bw.cc | 31 ++++++++++++++++++++++ third_party/intgemm/compile_test/avx512vnni.cc | 36 ++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 third_party/intgemm/compile_test/avx2.cc create mode 100644 third_party/intgemm/compile_test/avx512bw.cc create mode 100644 third_party/intgemm/compile_test/avx512vnni.cc (limited to 'third_party/intgemm/compile_test') diff --git a/third_party/intgemm/compile_test/avx2.cc b/third_party/intgemm/compile_test/avx2.cc new file mode 100644 index 0000000000..9ed534e929 --- /dev/null +++ b/third_party/intgemm/compile_test/avx2.cc @@ -0,0 +1,25 @@ +// Some compilers don't have AVX2 support. Test for them. +#include + +// clang-cl bug doesn't include these headers when pretending to be MSVC +// https://github.com/llvm/llvm-project/blob/e9a294449575a1e1a0daca470f64914695dc9adc/clang/lib/Headers/immintrin.h#L69-L72 +#if defined(_MSC_VER) && defined(__clang__) +#include +#include +#include +#endif + +#if defined(_MSC_VER) && !defined(__clang__) +#define INTGEMM_AVX2 +#else +#define INTGEMM_AVX2 __attribute__ ((target ("avx2"))) +#endif + +INTGEMM_AVX2 int Test() { + __m256i value = _mm256_set1_epi32(1); + value = _mm256_abs_epi8(value); + return *(int*)&value; +} + +int main() { +} diff --git a/third_party/intgemm/compile_test/avx512bw.cc b/third_party/intgemm/compile_test/avx512bw.cc new file mode 100644 index 0000000000..2361f757d5 --- /dev/null +++ b/third_party/intgemm/compile_test/avx512bw.cc @@ -0,0 +1,31 @@ +// Some compilers don't have AVX512BW support. Test for them. +#include + +// clang-cl bug doesn't include these headers when pretending to be MSVC +// https://github.com/llvm/llvm-project/blob/e9a294449575a1e1a0daca470f64914695dc9adc/clang/lib/Headers/immintrin.h#L69-L72 +#if defined(_MSC_VER) && defined(__clang__) +#include +#include +#include +#include +#include +#include +#endif + +#if defined(_MSC_VER) && !defined(__clang__) +#define INTGEMM_AVX512BW +#elif defined(__INTEL_COMPILER) +#define INTGEMM_AVX512BW __attribute__ ((target ("avx512f"))) +#else +#define INTGEMM_AVX512BW __attribute__ ((target ("avx512bw"))) +#endif + +INTGEMM_AVX512BW int Test() { + // AVX512BW + __m512i value = _mm512_set1_epi32(1); + value = _mm512_maddubs_epi16(value, value); + return *(int*)&value; +} + +int main() { +} diff --git a/third_party/intgemm/compile_test/avx512vnni.cc b/third_party/intgemm/compile_test/avx512vnni.cc new file mode 100644 index 0000000000..59035e4778 --- /dev/null +++ b/third_party/intgemm/compile_test/avx512vnni.cc @@ -0,0 +1,36 @@ +#include + +// clang-cl bug doesn't include these headers when pretending to be MSVC +// https://github.com/llvm/llvm-project/blob/e9a294449575a1e1a0daca470f64914695dc9adc/clang/lib/Headers/immintrin.h#L69-L72 +#if defined(_MSC_VER) && defined(__clang__) +#include +#include +#include +#include +#include +#include +#include +#endif + +#if defined(_MSC_VER) && !defined(__clang__) +#elif defined(__INTEL_COMPILER) +__attribute__ ((target ("avx512f"))) +#else +__attribute__ ((target ("avx512f,avx512bw,avx512dq,avx512vnni"))) +#endif +bool Foo() { + // AVX512F + __m512i value = _mm512_set1_epi32(1); + // AVX512BW + value = _mm512_maddubs_epi16(value, value); + // AVX512DQ + __m256i value2 = _mm256_set1_epi8(1); + value = _mm512_inserti32x8(value, value2, 1); + // AVX512VNNI + value = _mm512_dpbusd_epi32(value, value, value); + return *(int*)&value; +} + +int main() { + return Foo(); +} -- cgit v1.2.3