On Tue, Dec 15, 2020 at 12:42:24PM +0900, Norbert Preining wrote:
> Hi Julian,
> 
> thanks for the suggestion, sounds interesting.

Yeah, I'm looking at this from APT's side of things, because I have a custom
Intel CRC32c implementation for cache hashing, and want to optimize and while
unoptimized XXH3 is the same - two times faster, optimized XXH3 (AVX2) yields
results similar to Mark Adler's 3-way CRC32c code (another 2 times faster or 
so),
just without having all that vendorization :)

> 
> On Mon, 14 Dec 2020, Julian Andres Klode wrote:
> > > At the bare minimum, on x86, export DIGEST=1 when building and install
> > > xxh_x86dispatch.h header. I'd love to see the xxh_x86dispatch.h also
> 
> Do you have something like the following in mind?
> --- a/debian/libxxhash-dev.install
> +++ b/debian/libxxhash-dev.install
> @@ -4,3 +4,4 @@ usr/include/xxhash.h
>  usr/include/xxh3.h
>  usr/lib/*/pkgconfig/libxxhash.pc
>  doc/xxhash_spec.md usr/share/doc/libxxhash-dev
> +xxh_x86dispatch.h /usr/include

(1) /usr/include/xxh_x86dispatch.h works for me too
(2) might make sense to only ship that file when building with dispatch.

So the clever path out seems to be to just say usr/include/xxh*.h, as that
will pick up xxh_x86dispatch.h when we're building with DISPATCH=1, and
doesn't pick it up when building without :)

> diff --git a/debian/rules b/debian/rules
> index 2053a97..b6159cd 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -2,7 +2,12 @@
> 
>  #export DH_VERBOSE=1
> 
> -DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
> +include /usr/share/dpkg/architecture.mk
> +
> +ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),i386 amd64))
> +       export DISPATCH=1
> +endif

Maybe Filter for DEB_HOST_ARCH_CPU instead, so it works on non-Linux arch, or
use dpkg-architecture --is any-amd64 || dpkg-architecture --is any-i386. But
not sure symbols files support wildcards, and:

You also need to add various _dispatch symbols to the symbols file for
those architectures, like this, but with (arch=amd64 i386) in front of them
I suppose.

--- debian/libxxhash0.symbols (libxxhash0_0.8.0-1_amd64)
+++ dpkg-gensymbolsSwiZXg       2020-12-15 12:38:51.857342147 +0100
@@ -15,20 +15,28 @@
  XXH32_update@Base 0.6.5
  XXH3_128bits@Base 0.7.0
  XXH3_128bits_digest@Base 0.7.1
+ XXH3_128bits_dispatch@Base 0.8.0-1
  XXH3_128bits_reset@Base 0.7.1
  XXH3_128bits_reset_withSecret@Base 0.7.1
  XXH3_128bits_reset_withSeed@Base 0.7.1
  XXH3_128bits_update@Base 0.7.1
+ XXH3_128bits_update_dispatch@Base 0.8.0-1
  XXH3_128bits_withSecret@Base 0.7.1
+ XXH3_128bits_withSecret_dispatch@Base 0.8.0-1
  XXH3_128bits_withSeed@Base 0.7.0
+ XXH3_128bits_withSeed_dispatch@Base 0.8.0-1
  XXH3_64bits@Base 0.7.0
  XXH3_64bits_digest@Base 0.7.1
+ XXH3_64bits_dispatch@Base 0.8.0-1
  XXH3_64bits_reset@Base 0.7.1
  XXH3_64bits_reset_withSecret@Base 0.7.1
  XXH3_64bits_reset_withSeed@Base 0.7.1
  XXH3_64bits_update@Base 0.7.1
+ XXH3_64bits_update_dispatch@Base 0.8.0-1
  XXH3_64bits_withSecret@Base 0.7.1
+ XXH3_64bits_withSecret_dispatch@Base 0.8.0-1
  XXH3_64bits_withSeed@Base 0.7.0
+ XXH3_64bits_withSeed_dispatch@Base 0.8.0-1
  XXH3_copyState@Base 0.7.1
  XXH3_createState@Base 0.7.1
  XXH3_freeState@Base 0.7.1


-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

Reply via email to