[med-svn] [Git][med-team/gmap][master] 2 commits: Use debian package of SIMDe instead of code-copy.
Michael R. Crusoe (@crusoe)
gitlab at salsa.debian.org
Thu Jul 13 11:49:58 BST 2023
Michael R. Crusoe pushed to branch master at Debian Med / gmap
Commits:
b29ab64d by Michael R. Crusoe at 2023-07-13T09:00:06+02:00
Use debian package of SIMDe instead of code-copy.
- - - - -
596beba0 by Michael R. Crusoe at 2023-07-13T12:31:11+02:00
d/rules: build all SIMD variants for x86-64
- - - - -
6 changed files:
- debian/changelog
- debian/control
- debian/copyright
- debian/patches/series
- + debian/patches/simd_fixes
- debian/rules
Changes:
=====================================
debian/changelog
=====================================
@@ -1,8 +1,15 @@
gmap (2023-06-01+ds-1) UNRELEASED; urgency=medium
+ [ Andreas Tille ]
* New upstream version
* Standards-Version: 4.6.2 (routine-update)
+ [ Michael R. Crusoe ]
+ * Use debian package of SIMDe instead of code-copy.
+ * d/patches/simd_fixes: fix compiling "lower" SIMD levels on processors that
+ have more advanced features.
+ * d/rules: build all SIMD variants for x86-64
+
-- Andreas Tille <tille at debian.org> Wed, 12 Jul 2023 09:40:34 +0200
gmap (2021-12-17+ds-3) unstable; urgency=medium
=====================================
debian/control
=====================================
@@ -10,7 +10,8 @@ Build-Depends: debhelper-compat (= 13),
help2man,
libbz2-dev,
zlib1g-dev,
- debhelper
+ debhelper,
+ libsimde-dev
Standards-Version: 4.6.2
Vcs-Browser: https://salsa.debian.org/med-team/gmap
Vcs-Git: https://salsa.debian.org/med-team/gmap.git
=====================================
debian/copyright
=====================================
@@ -20,6 +20,7 @@ Files-Excluded:
tests/Makefile.in
util/Makefile.in
*/getopt*
+ src/simde
Files: *
Copyright: 2005-2020 Thomas D. Wu and Genentech, Inc.
=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
install-data-local
remove_getopt_code_copy.patch
+simd_fixes
=====================================
debian/patches/simd_fixes
=====================================
@@ -0,0 +1,114 @@
+From: Michael R. Crusoe <crusoe at debian.org>
+Subject: Fix use of some intrinsics when compiling for SSE2 only
+--- gmap.orig/src/intersect-simd.c
++++ gmap/src/intersect-simd.c
+@@ -238,9 +238,12 @@
+ maxFreq = freq[2 * 4 - 1];
+ #ifdef HAVE_AVX2
+ F = _mm256_loadu_si256((const __m256i *)(freq));
+-#else
++#elif defined(HAVE_SSSE3) // Actually SSE3
+ F0 = _mm_lddqu_si128((const __m128i *)(freq));
+ F1 = _mm_lddqu_si128((const __m128i *)(freq + 4));
++#else
++ F0 = _mm_loadu_si128((const __m128i *)(freq));
++ F1 = _mm_loadu_si128((const __m128i *)(freq + 4));
+ #endif
+
+ if (COMPILER_RARELY(maxFreq < valRare))
+@@ -281,8 +284,13 @@
+ if (_mm_movemask_epi8(F0)) {
+ matchOut++;
+ }
++#ifdef HAVE_SSSE3 // Actually SSE3
+ F0 = _mm_lddqu_si128((const __m128i *)(freq));
+ F1 = _mm_lddqu_si128((const __m128i *)(freq + 4));
++#else
++ F0 = _mm_loadu_si128((const __m128i *)(freq));
++ F1 = _mm_loadu_si128((const __m128i *)(freq + 4));
++#endif
+ #endif
+
+ } while (maxFreq >= valRare);
+@@ -305,9 +313,12 @@
+
+ #ifdef HAVE_AVX2
+ F = _mm256_loadu_si256((const __m256i *)(freq));
+-#else
++#elif defined(HAVE_SSSE3) // Actually SSE3
+ F0 = _mm_lddqu_si128((const __m128i *)(freq));
+ F1 = _mm_lddqu_si128((const __m128i *)(freq + 4));
++#else
++ F0 = _mm_loadu_si128((const __m128i *)(freq));
++ F1 = _mm_loadu_si128((const __m128i *)(freq + 4));
+ #endif
+
+ goto ADVANCE_RARE;
+--- gmap.orig/src/intersect-uint2.c
++++ gmap/src/intersect-uint2.c
+@@ -30,7 +30,7 @@
+ #endif
+
+
+-#if !defined(HAVE_STTNI)
++#if !defined(HAVE_STTNI) || !defined(HAVE_SSE4_2)
+
+ static int
+ intersect_vector16 (const uint16_t *A, const uint16_t *B,
+@@ -369,8 +369,11 @@
+
+ if ((i_a < st_a) && (i_b < st_b)) {
+ v_a = _mm_loadu_si128((const __m128i *) &A[i_a]);
++#if defined(HAVE_SSSE3) // Actually SSE3
+ v_b = _mm_lddqu_si128((const __m128i *) &B[i_b]);
+-
++#else
++ v_b = _mm_loadu_si128((const __m128i *) &B[i_b]);
++#endif
+ while ((A[i_a] == 0) || (B[i_b] == 0)) {
+ const __m128i res_v =
+ _mm_cmpestrm(v_b, 8, v_a, 8,
+@@ -396,7 +399,11 @@
+ if (i_b == st_b) {
+ break;
+ }
++#if defined(HAVE_SSSE3) // Actually SSE3
+ v_b = _mm_lddqu_si128((const __m128i *) &B[i_b]);
++#else
++ v_b = _mm_loadu_si128((const __m128i *) &B[i_b]);
++#endif
+ }
+ }
+
+@@ -424,7 +431,11 @@
+ if (i_b == st_b) {
+ break;
+ }
++#if defined(HAVE_SSSE3) // Actually SSE3
+ v_b = _mm_lddqu_si128((const __m128i *) &B[i_b]);
++#else
++ v_b = _mm_loadu_si128((const __m128i *) &B[i_b]);
++#endif
+ }
+ }
+ }
+--- gmap.orig/src/genomebits.h
++++ gmap/src/genomebits.h
+@@ -329,7 +329,7 @@
+ return 64 + (int) _lzcnt_u64(_mm_extract_epi64(_diff,0));
+ }
+
+-#elif defined(HAVE_MM_EXTRACT_EPI64)
++#elif defined(HAVE_MM_EXTRACT_EPI64) && defined(HAVE_SSE4_1)
+ UINT8 x;
+
+ if ((x = _mm_extract_epi64(_diff,1)) != 0) {
+@@ -375,7 +375,7 @@
+ return 64 + (int) _tzcnt_u64(_mm_extract_epi64(_diff,1));
+ }
+
+-#elif defined(HAVE_MM_EXTRACT_EPI64)
++#elif defined(HAVE_MM_EXTRACT_EPI64) && defined(HAVE_SSE4_1)
+ UINT8 x;
+
+ if ((x = _mm_extract_epi64(_diff,0)) != 0) {
=====================================
debian/rules
=====================================
@@ -10,24 +10,47 @@ include /usr/share/dpkg/architecture.mk
HELP2MAN = /usr/bin/help2man --no-info --version-string=${DEB_VERSION}
-# FIXME: gmap seems to have all the cpuid control necessary to avoid baseline
-# violation when compiled with high simd level (e.g. avx512bw) but running on
-# low baseline CPU (e.g. sse4_2). The problem is that the build fails when
-# attempting to compile high baseline on a build system with low baseline. It
-# would be nice to be able to provide high simd level to high baseline CPU as
-# well without build failure. See #1020793 for more details.
-ifeq (amd64,$(DEB_HOST_ARCH))
- SIMD = --enable-simd --with-simd-level=sse2
-else
- SIMD = --disable-simd
-endif
+export DEB_CFLAGS_MAINT_APPEND=-O3 -DSIMDE_ENABLE_OPENMP -fomit-frame-pointer -Werror=implicit-function-declaration
+# -Werror=implicit-function-declaration is to catch issues with SIMD levels
%:
- dh $@
+ dh $@ --builddir build
override_dh_auto_configure:
+ rm -Rf src/simde
+ifeq (amd64,$(DEB_HOST_ARCH))
+ DEB_CFLAGS_MAINT_APPEND="${DEB_CFLAGS_MAINT_APPEND} -UHAVE_MM_EXTRACT_EPI64 -UHAVE_STTNI" dh_auto_configure --reload-all-buildenv-variables -- --with-gmapdb=/var/cache/gmap \
+ --bindir=/usr/lib/gmap --enable-simd --with-simd-level=sse2
+ DEB_CFLAGS_MAINT_APPEND="${DEB_CFLAGS_MAINT_APPEND} -UHAVE_MM_EXTRACT_EPI64 -UHAVE_STTNI" dh_auto_configure --reload-all-buildenv-variables --builddir build_ssse3 -- --with-gmapdb=/var/cache/gmap \
+ --bindir=/usr/lib/gmap --enable-simd --with-simd-level=ssse3 ax_cv_cpu_has_ssse3_ext=yes ax_cv_compile_ssse3_ext=yes ax_cv_link_tmmintrin_h=yes
+ DEB_CFLAGS_MAINT_APPEND="${DEB_CFLAGS_MAINT_APPEND} -UHAVE_STTNI" dh_auto_configure --builddir build_sse41 -- --with-gmapdb=/var/cache/gmap \
+ --bindir=/usr/lib/gmap --enable-simd --with-simd-level=sse41 ax_cv_cpu_has_sse41_ext=yes ax_cv_compile_sse41_ext=yes ax_cv_link_smmintrin_h=yes
+ dh_auto_configure --builddir build_sse42 -- --with-gmapdb=/var/cache/gmap \
+ --bindir=/usr/lib/gmap --enable-simd --with-simd-level=sse42 ax_cv_cpu_has_sse42_ext=yes ax_cv_compile_sse42_ext=yes ax_cv_link_nmmintrin_h=yes ax_cv_cpu_has_popcnt_ext=yes ax_make_sse42=yes ax_cv_cpu_has_bmi1_ext=yes ax_cv_compile_bmi_ext=yes ax_cv_link_bmi=yes
+ dh_auto_configure --builddir build_avx2 -- --with-gmapdb=/var/cache/gmap \
+ --bindir=/usr/lib/gmap --enable-simd --with-simd-level=avx2 ax_make_avx2=yes ax_cv_cpu_has_bmi2_ext=yes ax_cv_compile_bmi2_ext=yes ax_cv_link_bmi2=yes
+ dh_auto_configure --builddir build_avx512 -- --with-gmapdb=/var/cache/gmap \
+ --bindir=/usr/lib/gmap --enable-simd --with-simd-level=avx512 ax_cv_cpu_has_avx512_ext=yes ax_cv_compile_avx512_ext=yes ax_cv_compile_avx512bw_ext=no ax_cv_link_avx512bw=no
+ # skipping avx512bw for now:
+ # ../../src/oligoindex_hr.c: In function 'count_positions_fwd_simd':
+ # ../../src/oligoindex_hr.c:19814:3: error: 'hugereverse8' undeclared (first use in this function); did you mean 'bigreverse8'?
+ # 19814 | hugereverse8 = _mm512_broadcast_i64x4(bigreverse8);
+ # | ^~~~~~~~~~~~
+ # | bigreverse8
+else
dh_auto_configure -- --with-gmapdb=/var/cache/gmap \
- --bindir=/usr/lib/gmap $(SIMD)
+ --bindir=/usr/lib/gmap --disable-simd
+endif
+
+override_dh_auto_build:
+ dh_auto_build
+ifeq (amd64,$(DEB_HOST_ARCH))
+ dh_auto_build --builddir build_ssse3
+ dh_auto_build --builddir build_sse41
+ dh_auto_build --builddir build_sse42
+ dh_auto_build --builddir build_avx2
+ dh_auto_build --builddir build_avx512
+endif
override_dh_auto_install:
mkdir -p $(mandir)
@@ -37,8 +60,16 @@ override_dh_auto_install:
$(bindir)/gsnap |debian/filter.pl >$(mandir)/gsnap.1
$(HELP2MAN) --name='Tool for genome database creation for GMAP or GSNAP' \
$(utildir)/gmap_build |debian/filter.pl >$(mandir)/gmap_build.1
+ifeq (amd64,$(DEB_HOST_ARCH))
+ dh_auto_install --builddir build_avx512
+ dh_auto_install --builddir build_avx2
+ dh_auto_install --builddir build_sse42
+ dh_auto_install --builddir build_sse41
+ dh_auto_install --builddir build_ssse3
+endif
dh_auto_install
+
override_dh_install:
mkdir -p debian/$(DEB_SOURCE)/usr/bin
dh_install
@@ -53,6 +84,16 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
dh_auto_test --no-parallel
endif
+override_dh_auto_clean:
+ifeq (amd64,$(DEB_HOST_ARCH))
+ dh_auto_clean --builddir build_avx512
+ dh_auto_clean --builddir build_avx2
+ dh_auto_clean --builddir build_sse42
+ dh_auto_clean --builddir build_sse41
+ dh_auto_clean --builddir build_ssse3
+endif
+ dh_auto_clean
+
override_dh_installexamples:
mkdir $(CURDIR)/debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/examples
find tests/ -type f -print0 | xargs -0r sed -i \
View it on GitLab: https://salsa.debian.org/med-team/gmap/-/compare/130487e09d15406377b26bf7693826681f0c6e42...596beba027da3944b0f45a9ffc9e03d1d9dca5ba
--
View it on GitLab: https://salsa.debian.org/med-team/gmap/-/compare/130487e09d15406377b26bf7693826681f0c6e42...596beba027da3944b0f45a9ffc9e03d1d9dca5ba
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230713/824e0607/attachment-0001.htm>
More information about the debian-med-commit
mailing list