Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Oct 2021 11:37:59 +1100
From:      Kubilay Kocak <koobs@FreeBSD.org>
To:        Alexey Dokuchaev <danfe@FreeBSD.org>, ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   Re: git: 3b8065a2adbf - main - math/fastops: new port had been added (+)
Message-ID:  <dedfc127-83ce-a316-efde-dabe5e2b3c84@FreeBSD.org>
In-Reply-To: <202110291052.19TAqnQh062468@gitrepo.freebsd.org>
References:  <202110291052.19TAqnQh062468@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29/10/2021 9:52 pm, Alexey Dokuchaev wrote:
> The branch main has been updated by danfe:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=3b8065a2adbf0f8acae9c980961cb5491034a1ad
> 
> commit 3b8065a2adbf0f8acae9c980961cb5491034a1ad
> Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
> AuthorDate: 2021-10-29 10:49:48 +0000
> Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
> CommitDate: 2021-10-29 10:49:55 +0000
> 
>      math/fastops: new port had been added (+)

For new ports, the COMMENT of the port is great for the git summary

Prefixing a [NEW] also saves summary space for new ports

[NEW] math/fastops: AVX/AVX2-accelerated bulk call of math functions

If one is a stickler/purist for 'imperative' first words:

Add math/fastops: AVX/AVX2-accelerated bulk call of math functions

>      
>      This small library enables acceleration of bulk calls of certain math
>      functions on AVX and AVX2 hardware.  Currently supported operations are
>      exp, log, sigmoid, and tanh.  The library is designed with extensibility
>      in mind.
>      
>      Restrict the port to amd64 as it's inherently useless anywhere else and
>      does not even build at least on i386.
>      
>      WWW: https://github.com/yandex/fastops
> ---
>   math/Makefile                                      |  1 +
>   math/fastops/Makefile                              | 20 ++++++++++++++
>   math/fastops/distinfo                              |  3 +++
>   math/fastops/files/patch-CMakeLists.txt            | 13 +++++++++
>   .../files/patch-fastops_core_SIMDFunctions.h       | 10 +++++++
>   math/fastops/files/patch-fastops_core_avx__id.cpp  | 31 ++++++++++++++++++++++
>   math/fastops/pkg-descr                             |  6 +++++
>   math/fastops/pkg-plist                             | 11 ++++++++
>   8 files changed, 95 insertions(+)
> 
> diff --git a/math/Makefile b/math/Makefile
> index d5e545695f82..1fe9497f83f0 100644
> --- a/math/Makefile
> +++ b/math/Makefile
> @@ -280,6 +280,7 @@
>       SUBDIR += facile
>       SUBDIR += faiss
>       SUBDIR += fann
> +    SUBDIR += fastops
>       SUBDIR += fcl
>       SUBDIR += fcl05
>       SUBDIR += fflas-ffpack
> diff --git a/math/fastops/Makefile b/math/fastops/Makefile
> new file mode 100644
> index 000000000000..3d039e2b74af
> --- /dev/null
> +++ b/math/fastops/Makefile
> @@ -0,0 +1,20 @@
> +# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
> +
> +PORTNAME=	fastops
> +PORTVERSION=	1.0.0
> +DISTVERSIONPREFIX=	v
> +CATEGORIES=	math
> +
> +MAINTAINER=	danfe@FreeBSD.org
> +COMMENT=	AVX/AVX2-accelerated bulk call of math functions
> +
> +LICENSE=	MIT
> +
> +ONLY_FOR_ARCHS=	amd64
> +ONLY_FOR_ARCHS_REASON=	uses AVX and AVX2 instructions
> +
> +USES=		cmake compiler:c++17-lang
> +USE_GITHUB=	yes
> +GH_ACCOUNT=	yandex
> +
> +.include <bsd.port.mk>
> diff --git a/math/fastops/distinfo b/math/fastops/distinfo
> new file mode 100644
> index 000000000000..74e54d2875f7
> --- /dev/null
> +++ b/math/fastops/distinfo
> @@ -0,0 +1,3 @@
> +TIMESTAMP = 1588749823
> +SHA256 (yandex-fastops-v1.0.0_GH0.tar.gz) = 16cd75b85717c60ff9552e140ba59dfc0d49217633a9c8c8614e9d001ce1303b
> +SIZE (yandex-fastops-v1.0.0_GH0.tar.gz) = 266428
> diff --git a/math/fastops/files/patch-CMakeLists.txt b/math/fastops/files/patch-CMakeLists.txt
> new file mode 100644
> index 000000000000..3198b10cb280
> --- /dev/null
> +++ b/math/fastops/files/patch-CMakeLists.txt
> @@ -0,0 +1,13 @@
> +--- CMakeLists.txt.orig	2020-05-06 07:23:43 UTC
> ++++ CMakeLists.txt
> +@@ -3,9 +3,8 @@ cmake_minimum_required(VERSION 2.6)
> + project(fastops)
> +
> + include_directories("${PROJECT_SOURCE_DIR}")
> +-set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/install)
> +
> +-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
> ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
> +
> + # Specify the C++ 17 language standard for
> + # any version of Microsoft Visual C++ Compiler
> diff --git a/math/fastops/files/patch-fastops_core_SIMDFunctions.h b/math/fastops/files/patch-fastops_core_SIMDFunctions.h
> new file mode 100644
> index 000000000000..82a90e4559b8
> --- /dev/null
> +++ b/math/fastops/files/patch-fastops_core_SIMDFunctions.h
> @@ -0,0 +1,10 @@
> +--- fastops/core/SIMDFunctions.h.orig	2020-05-06 07:23:43 UTC
> ++++ fastops/core/SIMDFunctions.h
> +@@ -9,6 +9,7 @@
> + #include <emmintrin.h>
> + #include <xmmintrin.h>
> + #include <immintrin.h>
> ++#include <stdint.h>
> +
> + #if defined(__clang_major__) && !defined(__apple_build_version__) && __clang_major__ >= 8
> + #   define Y_HAVE_NEW_INTRINSICS
> diff --git a/math/fastops/files/patch-fastops_core_avx__id.cpp b/math/fastops/files/patch-fastops_core_avx__id.cpp
> new file mode 100644
> index 000000000000..0ea3e89ab7ab
> --- /dev/null
> +++ b/math/fastops/files/patch-fastops_core_avx__id.cpp
> @@ -0,0 +1,31 @@
> +--- fastops/core/avx_id.cpp.orig	2020-05-06 07:23:43 UTC
> ++++ fastops/core/avx_id.cpp
> +@@ -36,23 +36,23 @@ namespace NFastOps {
> +         // This in EBX of cpuid(7)
> +         static constexpr uint32_t AVX2_BIT    = 0x00000020;
> +
> +-        static void CpuId(int32_t op, int32_t* res) noexcept {
> ++        static void CpuId(int32_t op, int32_t sub, int32_t* res) noexcept {
> + #if defined(_MSC_VER) && !defined(__clang__)
> +-            __cpuid((int*)res, op);
> ++            __cpuidex((int*)res, op, sub);
> + #else
> +-            __cpuid(op, res[EAX], res[EBX], res[ECX], res[EDX]);
> ++            __cpuid_count(op, sub, res[EAX], res[EBX], res[ECX], res[EDX]);
> + #endif
> +         }
> +
> +         bool IsAVXEnabled() noexcept {
> +             int32_t info[NREGS];
> +-            CpuId(1, info);
> ++            CpuId(1, 0, info);
> +             return (info[ECX] & OSXSAVE_BIT) && IsYMMSaveEnabled() && (info[ECX] & AVX_BIT);
> +         }
> +
> +         bool IsAVX2Enabled() noexcept {
> +             int32_t info[NREGS];
> +-            CpuId(7, info);
> ++            CpuId(7, 0, info);
> +             return info[EBX] & AVX2_BIT;
> +         }
> +     }
> diff --git a/math/fastops/pkg-descr b/math/fastops/pkg-descr
> new file mode 100644
> index 000000000000..b3b4a059be88
> --- /dev/null
> +++ b/math/fastops/pkg-descr
> @@ -0,0 +1,6 @@
> +This small library enables acceleration of bulk calls of certain math
> +functions on AVX and AVX2 hardware.  Currently supported operations are
> +exp, log, sigmoid, and tanh.  The library is designed with extensibility
> +in mind.
> +
> +WWW: https://github.com/yandex/fastops
> diff --git a/math/fastops/pkg-plist b/math/fastops/pkg-plist
> new file mode 100644
> index 000000000000..736d23848c3a
> --- /dev/null
> +++ b/math/fastops/pkg-plist
> @@ -0,0 +1,11 @@
> +bin/benchmark
> +bin/eval
> +bin/fastops_test
> +include/avx/ops_avx.h
> +include/avx2/ops_avx2.h
> +include/core/FastIntrinsics.h
> +include/core/SIMDFunctions.h
> +include/core/avx_id.h
> +include/fastops.h
> +include/plain/ops_plain.h
> +lib/libfastops.a
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?dedfc127-83ce-a316-efde-dabe5e2b3c84>