Skip to content

Commit 4413468

Browse files
[sleef] Update to version 3.7 (microsoft#42706)
1 parent 23ef699 commit 4413468

File tree

7 files changed

+91
-14
lines changed

7 files changed

+91
-14
lines changed

ports/libtorch/fix-sleef.patch

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,65 @@ index f3281d3cb..c8b6ed30e 100644
2020

2121
set(CMAKE_C_FLAGS_DEBUG ${OLD_CMAKE_C_FLAGS_DEBUG})
2222
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
23+
diff --git a/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h b/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h
24+
index f3281d3cb..c8b6ed30e 100644
25+
--- a/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h
26+
+++ b/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h
27+
@@ -21,6 +21,17 @@ inline namespace CPU_CAPABILITY {
28+
29+
#if defined(CPU_CAPABILITY_AVX2) && !defined(_MSC_VER)
30+
31+
+#ifndef SLEEF_CONST
32+
+#if (defined(__GNUC__) || defined(__CLANG__)) && !defined(__INTEL_COMPILER)
33+
+#define SLEEF_CONST const
34+
+#else
35+
+#define SLEEF_CONST
36+
+#endif
37+
+#define SLEEF_CONST_OLD SLEEF_CONST
38+
+#else
39+
+#define SLEEF_CONST_OLD
40+
+#endif
41+
+
42+
// bfloat16 conversion
43+
static inline void cvtbf16_fp32(const __m128i& a, __m256& o) {
44+
o = _mm256_castsi256_ps(_mm256_slli_epi32(_mm256_cvtepu16_epi32(a), 16));
45+
@@ -266,7 +277,7 @@ public:
46+
}
47+
return b;
48+
}
49+
- Vectorized<T> map(const __m256 (*const vop)(__m256)) const {
50+
+ Vectorized<T> map(SLEEF_CONST __m256 (*SLEEF_CONST_OLD vop)(__m256)) const {
51+
__m256 lo, hi;
52+
cvt_to_fp32<T>(values, lo, hi);
53+
const auto o1 = vop(lo);
54+
diff --git a/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h b/aten/src/ATen/cpu/vec/vec256/vec256_bfloat16.h
55+
index f3281d3cb..c8b6ed30e 100644
56+
--- a/aten/src/ATen/cpu/vec/vec512/vec512_bfloat16.h
57+
+++ b/aten/src/ATen/cpu/vec/vec512/vec512_bfloat16.h
58+
@@ -18,6 +18,17 @@ inline namespace CPU_CAPABILITY {
59+
60+
#if defined(CPU_CAPABILITY_AVX512) && !defined(_MSC_VER)
61+
62+
+#ifndef SLEEF_CONST
63+
+#if (defined(__GNUC__) || defined(__CLANG__)) && !defined(__INTEL_COMPILER)
64+
+#define SLEEF_CONST const
65+
+#else
66+
+#define SLEEF_CONST
67+
+#endif
68+
+#define SLEEF_CONST_OLD SLEEF_CONST
69+
+#else
70+
+#define SLEEF_CONST_OLD
71+
+#endif
72+
+
73+
// bfloat16 conversion
74+
static inline void cvtbf16_fp32(const __m256i& a, __m512& o) {
75+
o = _mm512_castsi512_ps(_mm512_slli_epi32(_mm512_cvtepu16_epi32(a), 16));
76+
@@ -345,7 +356,7 @@ public:
77+
}
78+
#pragma clang diagnostic push
79+
#pragma clang diagnostic ignored "-Wignored-qualifiers"
80+
- Vectorized<T> map(const __m512 (*const vop)(__m512)) const {
81+
+ Vectorized<T> map(SLEEF_CONST __m512 (*SLEEF_CONST_OLD vop)(__m512)) const {
82+
__m512 lo, hi;
83+
cvt_to_fp32<T>(values, lo, hi);
84+
const auto o1 = vop(lo);

ports/libtorch/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "libtorch",
33
"version": "2.1.2",
4-
"port-version": 8,
4+
"port-version": 9,
55
"description": "Tensors and Dynamic neural networks in Python with strong GPU acceleration",
66
"homepage": "https://pytorch.org/",
77
"license": null,

ports/sleef/portfile.cmake

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
vcpkg_from_github(
22
OUT_SOURCE_PATH SOURCE_PATH
33
REPO shibatch/sleef
4-
REF 3.5.1
5-
SHA512 e8e4e5028db52998c6b82bd462622c08d670e4e85273327f1c3bdbd900827dd7793b217c2876ca1229b6f672493bb96f40140e14366390cccea0e6780689e128
4+
REF ${VERSION}
5+
SHA512 0f42c4132523f87c9e214bd9eb965e77b84c80e9a63588ed854796fccd2b9affb849a74e5f95f7b0161ba6281ca7ff509d510b42950dc38a6b8175cf6745ab07
66
HEAD_REF master
77
)
88

99
vcpkg_cmake_configure(
1010
SOURCE_PATH "${SOURCE_PATH}"
1111
OPTIONS
12-
-DBUILD_LIBM=ON
13-
-DBUILD_DFT=ON
14-
-DBUILD_QUAD=ON
15-
-DBUILD_GNUABI_LIBS=${VCPKG_TARGET_IS_LINUX}
16-
-DBUILD_TESTS=OFF
17-
-DBUILD_INLINE_HEADERS=OFF
12+
-DSLEEF_BUILD_LIBM=ON
13+
-DSLEEF_BUILD_DFT=ON
14+
-DSLEEF_BUILD_QUAD=ON
15+
-DSLEEF_BUILD_GNUABI_LIBS=${VCPKG_TARGET_IS_LINUX}
16+
-DSLEEF_BUILD_TESTS=OFF
17+
-DSLEEF_BUILD_INLINE_HEADERS=OFF
1818
)
19+
1920
vcpkg_cmake_install()
21+
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/sleef)
2022
vcpkg_copy_pdbs()
2123
vcpkg_fixup_pkgconfig()
2224

ports/sleef/vcpkg.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "sleef",
3-
"version": "3.5.1",
4-
"port-version": 4,
3+
"version": "3.7",
54
"description": "SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT",
65
"homepage": "https://sleef.org/",
76
"license": "BSL-1.0",
@@ -10,6 +9,10 @@
109
{
1110
"name": "vcpkg-cmake",
1211
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
1316
}
1417
]
1518
}

versions/baseline.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5242,7 +5242,7 @@
52425242
},
52435243
"libtorch": {
52445244
"baseline": "2.1.2",
5245-
"port-version": 8
5245+
"port-version": 9
52465246
},
52475247
"libtorrent": {
52485248
"baseline": "2.0.10",
@@ -8449,8 +8449,8 @@
84498449
"port-version": 2
84508450
},
84518451
"sleef": {
8452-
"baseline": "3.5.1",
8453-
"port-version": 4
8452+
"baseline": "3.7",
8453+
"port-version": 0
84548454
},
84558455
"sleepy-discord": {
84568456
"baseline": "2022-02-05",

versions/l-/libtorch.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "0a4d67bf0f603494ff7ce3e51587513a1df295fe",
5+
"version": "2.1.2",
6+
"port-version": 9
7+
},
38
{
49
"git-tree": "d6c80d406232a0bfd3360a40132a69d9f70b972c",
510
"version": "2.1.2",

versions/s-/sleef.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "dcb27d5e3d26cfdbbd2d27bf9d71b0f3b7a0578a",
5+
"version": "3.7",
6+
"port-version": 0
7+
},
38
{
49
"git-tree": "12afaa5146f51bf2912339befaafd1776e10442a",
510
"version": "3.5.1",

0 commit comments

Comments
 (0)