Add NEOVERSEV2 target supportpull/5405/head
| @@ -1,3 +1,31 @@ | |||||
| ############################################################################### | |||||
| # Copyright (c) 2025, The OpenBLAS Project | |||||
| # All rights reserved. | |||||
| # Redistribution and use in source and binary forms, with or without | |||||
| # modification, are permitted provided that the following conditions are | |||||
| # met: | |||||
| # 1. Redistributions of source code must retain the above copyright | |||||
| # notice, this list of conditions and the following disclaimer. | |||||
| # 2. Redistributions in binary form must reproduce the above copyright | |||||
| # notice, this list of conditions and the following disclaimer in | |||||
| # the documentation and/or other materials provided with the | |||||
| # distribution. | |||||
| # 3. Neither the name of the OpenBLAS project nor the names of | |||||
| # its contributors may be used to endorse or promote products | |||||
| # derived from this software without specific prior written permission. | |||||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||||
| # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
| # ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE | |||||
| # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||||
| # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||||
| # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||||
| # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||||
| # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||||
| # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||||
| # POSSIBILITY OF SUCH DAMAGE. | |||||
| ############################################################################### | |||||
| ifneq ($(C_COMPILER), PGI) | ifneq ($(C_COMPILER), PGI) | ||||
| ifeq ($(C_COMPILER), CLANG) | ifeq ($(C_COMPILER), CLANG) | ||||
| @@ -183,10 +211,15 @@ endif | |||||
| # Detect ARM Neoverse V2. | # Detect ARM Neoverse V2. | ||||
| ifeq ($(CORE), NEOVERSEV2) | ifeq ($(CORE), NEOVERSEV2) | ||||
| ifeq (1, $(filter 1,$(GCCVERSIONGTEQ12) $(ISCLANG))) | |||||
| CCOMMON_OPT += -march=armv9-a -mtune=neoverse-v2 | |||||
| ifeq (1, $(filter 1,$(GCCVERSIONGTEQ13) $(ISCLANG))) | |||||
| CCOMMON_OPT += -mcpu=neoverse-v2 | |||||
| ifneq ($(F_COMPILER), NAG) | |||||
| FCOMMON_OPT += -mcpu=neoverse-v2 | |||||
| endif | |||||
| else | |||||
| CCOMMON_OPT += -march=armv8.2-a+sve+bf16 -mtune=neoverse-n1 | |||||
| ifneq ($(F_COMPILER), NAG) | ifneq ($(F_COMPILER), NAG) | ||||
| FCOMMON_OPT += -march=armv9-a -mtune=neoverse-v2 | |||||
| FCOMMON_OPT += -march=armv8.2-a -mtune=neoverse-n1 | |||||
| endif | endif | ||||
| endif | endif | ||||
| endif | endif | ||||
| @@ -102,6 +102,7 @@ CORTEXX2 | |||||
| NEOVERSEN1 | NEOVERSEN1 | ||||
| NEOVERSEV1 | NEOVERSEV1 | ||||
| NEOVERSEN2 | NEOVERSEN2 | ||||
| NEOVERSEV2 | |||||
| CORTEXA55 | CORTEXA55 | ||||
| EMAG8180 | EMAG8180 | ||||
| FALKOR | FALKOR | ||||
| @@ -1,3 +1,30 @@ | |||||
| ############################################################################### | |||||
| # Copyright (c) 2025, The OpenBLAS Project | |||||
| # All rights reserved. | |||||
| # Redistribution and use in source and binary forms, with or without | |||||
| # modification, are permitted provided that the following conditions are | |||||
| # met: | |||||
| # 1. Redistributions of source code must retain the above copyright | |||||
| # notice, this list of conditions and the following disclaimer. | |||||
| # 2. Redistributions in binary form must reproduce the above copyright | |||||
| # notice, this list of conditions and the following disclaimer in | |||||
| # the documentation and/or other materials provided with the | |||||
| # distribution. | |||||
| # 3. Neither the name of the OpenBLAS project nor the names of | |||||
| # its contributors may be used to endorse or promote products | |||||
| # derived from this software without specific prior written permission. | |||||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||||
| # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
| # ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE | |||||
| # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||||
| # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||||
| # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||||
| # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||||
| # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||||
| # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||||
| # POSSIBILITY OF SUCH DAMAGE. | |||||
| ############################################################################### | |||||
| ## | ## | ||||
| ## Author: Hank Anderson <hank@statease.com> | ## Author: Hank Anderson <hank@statease.com> | ||||
| ## Description: Ported from portion of OpenBLAS/Makefile.system | ## Description: Ported from portion of OpenBLAS/Makefile.system | ||||
| @@ -192,6 +219,24 @@ if (${CORE} STREQUAL A64FX) | |||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| if (${CORE} STREQUAL NEOVERSEV2) | |||||
| if (NOT DYNAMIC_ARCH) | |||||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -Msve_intrinsics -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-v2") | |||||
| elseif (${CMAKE_C_COMPILER_ID} STREQUAL "NVC" AND NOT NO_SVE) | |||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -tp=neoverse-v2") | |||||
| else () | |||||
| if (${GCC_VERSION} VERSION_GREATER 13.0 OR ${GCC_VERSION} VERSION_EQUAL 13.0) | |||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -mcpu=neoverse-v2") | |||||
| elseif (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.4-a+sve+bf16 -mtune=neoverse-v1") | |||||
| else () | |||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.2-a+sve+bf16") | |||||
| endif() | |||||
| endif () | |||||
| endif () | |||||
| endif () | |||||
| if (${CORE} STREQUAL NEOVERSEN2) | if (${CORE} STREQUAL NEOVERSEN2) | ||||
| if (NOT DYNAMIC_ARCH) | if (NOT DYNAMIC_ARCH) | ||||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | ||||
| @@ -199,10 +244,10 @@ if (${CORE} STREQUAL NEOVERSEN2) | |||||
| elseif (${CMAKE_C_COMPILER_ID} STREQUAL "NVC" AND NOT NO_SVE) | elseif (${CMAKE_C_COMPILER_ID} STREQUAL "NVC" AND NOT NO_SVE) | ||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -tp=neoverse-v2") | set (CCOMMON_OPT "${CCOMMON_OPT} -tp=neoverse-v2") | ||||
| else () | else () | ||||
| if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||||
| if (${GCC_VERSION} VERSION_GREATER 11.1 OR ${GCC_VERSION} VERSION_EQUAL 11.1) | |||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | ||||
| else () | else () | ||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.2-a+sve") | |||||
| set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.2-a+sve+bf16") | |||||
| endif() | endif() | ||||
| endif () | endif () | ||||
| endif () | endif () | ||||
| @@ -1,3 +1,30 @@ | |||||
| ############################################################################### | |||||
| # Copyright (c) 2025, The OpenBLAS Project | |||||
| # All rights reserved. | |||||
| # Redistribution and use in source and binary forms, with or without | |||||
| # modification, are permitted provided that the following conditions are | |||||
| # met: | |||||
| # 1. Redistributions of source code must retain the above copyright | |||||
| # notice, this list of conditions and the following disclaimer. | |||||
| # 2. Redistributions in binary form must reproduce the above copyright | |||||
| # notice, this list of conditions and the following disclaimer in | |||||
| # the documentation and/or other materials provided with the | |||||
| # distribution. | |||||
| # 3. Neither the name of the OpenBLAS project nor the names of | |||||
| # its contributors may be used to endorse or promote products | |||||
| # derived from this software without specific prior written permission. | |||||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||||
| # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
| # ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE | |||||
| # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||||
| # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||||
| # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||||
| # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||||
| # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||||
| # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||||
| # POSSIBILITY OF SUCH DAMAGE. | |||||
| ############################################################################### | |||||
| ## | ## | ||||
| ## Author: Hank Anderson <hank@statease.com> | ## Author: Hank Anderson <hank@statease.com> | ||||
| ## Description: Ported from OpenBLAS/Makefile.system | ## Description: Ported from OpenBLAS/Makefile.system | ||||
| @@ -311,6 +338,19 @@ if (${TARGET} STREQUAL NEOVERSEV1) | |||||
| endif() | endif() | ||||
| endif() | endif() | ||||
| endif() | endif() | ||||
| if (${TARGET} STREQUAL NEOVERSEV2) | |||||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve-intrinsics -march=armv9-a+sve+sve2+bf16 -mtune=neoverse-v2") | |||||
| else () | |||||
| if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 13.0 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 13.0) | |||||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=neoverse-v2") | |||||
| elseif (CMAKE_C_COMPILER_VERSION VERSION_GREATER 10.4 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.4) | |||||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.4-a+sve+bf16 -mtune=neoverse-v1") | |||||
| else () | |||||
| message(FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION} does not support Neoverse V2.") | |||||
| endif() | |||||
| endif() | |||||
| endif() | |||||
| if (${TARGET} STREQUAL ARMV8SVE) | if (${TARGET} STREQUAL ARMV8SVE) | ||||
| if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | ||||
| set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve-intrinsics -march=armv8.2-a+sve") | set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve-intrinsics -march=armv8.2-a+sve") | ||||
| @@ -1498,6 +1498,22 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| #define CORENAME "NEOVERSEN2" | #define CORENAME "NEOVERSEN2" | ||||
| #endif | #endif | ||||
| #ifdef FORCE_NEOVERSEV2 | |||||
| #define FORCE | |||||
| #define ARCHITECTURE "ARM64" | |||||
| #define SUBARCHITECTURE "NEOVERSEV2" | |||||
| #define SUBDIRNAME "arm64" | |||||
| #define ARCHCONFIG "-DNEOVERSEV2 " \ | |||||
| "-DL1_CODE_SIZE=65536 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=4 " \ | |||||
| "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=4 " \ | |||||
| "-DL2_SIZE=1048576 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \ | |||||
| "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \ | |||||
| "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DHAVE_SVE -DARMV8 " \ | |||||
| "-mcpu=neoverse-v2" | |||||
| #define LIBNAME "neoversev2" | |||||
| #define CORENAME "NEOVERSEV2" | |||||
| #endif | |||||
| #ifdef FORCE_CORTEXA55 | #ifdef FORCE_CORTEXA55 | ||||
| #define FORCE | #define FORCE | ||||
| #define ARCHITECTURE "ARM64" | #define ARCHITECTURE "ARM64" | ||||
| @@ -3636,7 +3636,7 @@ is a big desktop or server with abundant cache rather than a phone or embedded d | |||||
| #define CGEMM_DEFAULT_R 4096 | #define CGEMM_DEFAULT_R 4096 | ||||
| #define ZGEMM_DEFAULT_R 4096 | #define ZGEMM_DEFAULT_R 4096 | ||||
| #elif defined(NEOVERSEN2) | |||||
| #elif defined(NEOVERSEN2) || defined(NEOVERSEV2) | |||||
| #if defined(XDOUBLE) || defined(DOUBLE) | #if defined(XDOUBLE) || defined(DOUBLE) | ||||
| #define SWITCH_RATIO 8 | #define SWITCH_RATIO 8 | ||||