From nobody Fri Oct 29 10:52:49 2021 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A0210181FB12; Fri, 29 Oct 2021 10:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HgfQn3z3Tz3N4B; Fri, 29 Oct 2021 10:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 689B815E2F; Fri, 29 Oct 2021 10:52:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19TAqnYd062469; Fri, 29 Oct 2021 10:52:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19TAqnQh062468; Fri, 29 Oct 2021 10:52:49 GMT (envelope-from git) Date: Fri, 29 Oct 2021 10:52:49 GMT Message-Id: <202110291052.19TAqnQh062468@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Alexey Dokuchaev Subject: git: 3b8065a2adbf - main - math/fastops: new port had been added (+) List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: danfe X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b8065a2adbf0f8acae9c980961cb5491034a1ad Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by danfe: URL: https://cgit.FreeBSD.org/ports/commit/?id=3b8065a2adbf0f8acae9c980961cb5491034a1ad commit 3b8065a2adbf0f8acae9c980961cb5491034a1ad Author: Alexey Dokuchaev AuthorDate: 2021-10-29 10:49:48 +0000 Commit: Alexey Dokuchaev CommitDate: 2021-10-29 10:49:55 +0000 math/fastops: new port had been added (+) 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 + +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 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 + #include + #include ++#include + + #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