From 45b0eed17d9bf9f8705bb47b5d9056b1666ad96d Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 8 Sep 2025 17:35:55 +0200 Subject: [PATCH 01/16] Add DYNAMIC_COREs for ZARCH --- cmake/arch.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/arch.cmake b/cmake/arch.cmake index d9a7aafd62..f5e901a316 100644 --- a/cmake/arch.cmake +++ b/cmake/arch.cmake @@ -94,7 +94,13 @@ if (DYNAMIC_ARCH) set(DYNAMIC_CORE PRESCOTT ${DYNAMIC_LIST}) endif () endif () - + + if (ZARCH) + set(DYNAMIC_CORE Z13 Z14 ZARCH_GENERIC) + set(DYN_Z13 1) + set(DYN_Z14 1) + endif () + if (LOONGARCH64) set(DYNAMIC_CORE LA64_GENERIC LA264 LA464) endif () From e9ebae3e19f63e754ad8f8d078c48d67d5a7fdab Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 8 Sep 2025 17:38:33 +0200 Subject: [PATCH 02/16] Add ZARCH --- cmake/system_check.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/system_check.cmake b/cmake/system_check.cmake index dd0dfab637..542419473d 100644 --- a/cmake/system_check.cmake +++ b/cmake/system_check.cmake @@ -50,6 +50,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64.*") set(LOONGARCH64 1) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64.*") set(RISCV64 1) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390.*") + set(ZARCH 1) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" OR (CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")) if (NOT BINARY) if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") From b0cb7894e335d7123bead480972f5013a7618be3 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 8 Sep 2025 17:41:19 +0200 Subject: [PATCH 03/16] Add CMake build --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index baeeee59ff..cd296ccf51 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,5 +10,10 @@ pipeline { sh 'make clean && make' } } + stage('CMakeBuild') { + steps { + sh 'make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' + } + } } } From 293e008da630f521ad772e06b9357478f8bc0b0b Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 8 Sep 2025 18:26:52 +0200 Subject: [PATCH 04/16] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cd296ccf51..d5b2debba7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } stage('CMakeBuild') { steps { - sh 'make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' + sh 'sudo apt install cmake && make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' } } } From 4d02a72ecdacbdd189c3a86da936002f70282144 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 8 Sep 2025 21:03:42 +0200 Subject: [PATCH 05/16] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d5b2debba7..00567e0c5e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } stage('CMakeBuild') { steps { - sh 'sudo apt install cmake && make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' + sh 'sudo apt update && sudo apt install cmake && make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' } } } From a4031babbb0f02ef3ac7657a33d182149c83a199 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 8 Sep 2025 22:09:31 +0200 Subject: [PATCH 06/16] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 00567e0c5e..11688518d6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } stage('CMakeBuild') { steps { - sh 'sudo apt update && sudo apt install cmake && make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' + sh 'sudo apt update && sudo apt install cmake -y && make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' } } } From c02e60f9d5dd3ac4c0b1398331bb777b8cdbb9ac Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 8 Sep 2025 22:28:40 +0200 Subject: [PATCH 07/16] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 11688518d6..c4d2a4147f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } stage('CMakeBuild') { steps { - sh 'sudo apt update && sudo apt install cmake -y && make clean && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' + sh 'sudo apt update && sudo apt install cmake -y && make clean && rm -rf build && mkdir build && cd build && cmake -DDYNAMIC_ARCH=1 .. && make' } } } From 8b200d0c583287c4412359f09f6ea2e2ab971660 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 10:31:55 +0200 Subject: [PATCH 08/16] Add BINARY for zarch --- cmake/cc.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/cc.cmake b/cmake/cc.cmake index 952b2dd7ad..5d0374f70d 100644 --- a/cmake/cc.cmake +++ b/cmake/cc.cmake @@ -86,6 +86,11 @@ if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "LS set(BINARY_DEFINED 1) endif () + if (ZARCH) + set (BINARY64 1) + set (BINARY_DEFINED 1) + endif () + if (CMAKE_SYSTEM_NAME STREQUAL "AIX") set(BINARY_DEFINED 1) endif () From 0d826bcbcb97c3b382368622ef5145b2c7f15f6e Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 10:57:08 +0200 Subject: [PATCH 09/16] Update cc.cmake --- cmake/cc.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/cc.cmake b/cmake/cc.cmake index 5d0374f70d..b3d9e9dc7b 100644 --- a/cmake/cc.cmake +++ b/cmake/cc.cmake @@ -87,7 +87,6 @@ if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "LS endif () if (ZARCH) - set (BINARY64 1) set (BINARY_DEFINED 1) endif () From 6a22424c5a1c594ab0ccba7b9e6eb4a2866cdd0b Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 11:42:14 +0200 Subject: [PATCH 10/16] Update system_check.cmake --- cmake/system_check.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/system_check.cmake b/cmake/system_check.cmake index 542419473d..2e8ff06d3f 100644 --- a/cmake/system_check.cmake +++ b/cmake/system_check.cmake @@ -34,6 +34,7 @@ if(MINGW) endif() # Pretty thorough determination of arch. Add more if needed +message (STATUS "CMake system processor variable is ${CMAKE_SYSTEM_PROCESSOR}") if(CMAKE_CL_64 OR MINGW64) if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)") set(ARM64 1) From 45a4a8cdca8068df0b52c5d23082bfbedaec52a1 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 13:06:43 +0200 Subject: [PATCH 11/16] Update system_check.cmake --- cmake/system_check.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/system_check.cmake b/cmake/system_check.cmake index 2e8ff06d3f..fe9f556162 100644 --- a/cmake/system_check.cmake +++ b/cmake/system_check.cmake @@ -52,6 +52,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64.*") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64.*") set(RISCV64 1) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390.*") + message(STATUS "architecture is ZARCH") set(ZARCH 1) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" OR (CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")) if (NOT BINARY) From e4d5bd6eeb1e6e32f67c73daa1c95262cdcb5463 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 14:27:28 +0200 Subject: [PATCH 12/16] Update system_check.cmake --- cmake/system_check.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/system_check.cmake b/cmake/system_check.cmake index fe9f556162..fdd4f434ae 100644 --- a/cmake/system_check.cmake +++ b/cmake/system_check.cmake @@ -52,8 +52,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64.*") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64.*") set(RISCV64 1) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390.*") - message(STATUS "architecture is ZARCH") set(ZARCH 1) + set(BINARY 64) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" OR (CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")) if (NOT BINARY) if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") From e030be3c6cc03df1f92a836833a75f00ba4ed378 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 14:50:24 +0200 Subject: [PATCH 13/16] Update system_check.cmake --- cmake/system_check.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/system_check.cmake b/cmake/system_check.cmake index fdd4f434ae..3d987c3062 100644 --- a/cmake/system_check.cmake +++ b/cmake/system_check.cmake @@ -34,7 +34,6 @@ if(MINGW) endif() # Pretty thorough determination of arch. Add more if needed -message (STATUS "CMake system processor variable is ${CMAKE_SYSTEM_PROCESSOR}") if(CMAKE_CL_64 OR MINGW64) if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)") set(ARM64 1) @@ -104,6 +103,8 @@ elseif(X86) set(ARCH "x86") elseif(POWER) set(ARCH "power") +elseif(ZARCH) + set(ARCH "zarch") elseif(MIPS32) set(ARCH "mips") elseif(MIPS64) From 1ca05e6edd2f6eadee41874af381a6bbd38e7067 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 14:56:18 +0200 Subject: [PATCH 14/16] Update system.cmake --- cmake/system.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/system.cmake b/cmake/system.cmake index bf4c548b92..4274576867 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -316,6 +316,13 @@ if (DEFINED TARGET) set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math") endif() +if (${TARGET} STREQUAL Z13) + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=z13 -mzvector" +endif() +if (${TARGET} STREQUAL Z14) + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=z14 -mzvector" +endif() + if (${TARGET} STREQUAL NEOVERSEV1) if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve_intrinsics -march=armv8.4-a+sve+bf16 -mtune=neoverse-v1") @@ -485,7 +492,7 @@ if (SMALL_MATRIX_OPT) endif () if (DYNAMIC_ARCH) - if (X86 OR X86_64 OR ARM64 OR POWER OR RISCV64 OR LOONGARCH64) + if (X86 OR X86_64 OR ARM64 OR POWER OR RISCV64 OR LOONGARCH64 OR ZARCH) set(CCOMMON_OPT "${CCOMMON_OPT} -DDYNAMIC_ARCH") if (DYNAMIC_OLDER) set(CCOMMON_OPT "${CCOMMON_OPT} -DDYNAMIC_OLDER") From 985e158801599219a62194509f36610a5efb0dbd Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 16:09:28 +0200 Subject: [PATCH 15/16] Update system.cmake --- cmake/system.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/system.cmake b/cmake/system.cmake index 4274576867..8dded3c215 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -317,10 +317,10 @@ if (DEFINED TARGET) endif() if (${TARGET} STREQUAL Z13) - set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=z13 -mzvector" + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=z13 -mzvector") endif() if (${TARGET} STREQUAL Z14) - set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=z14 -mzvector" + set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=z14 -mzvector") endif() if (${TARGET} STREQUAL NEOVERSEV1) From 1aedcddcbccbdd594030073ad2e8377031aa8576 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 9 Sep 2025 17:59:33 +0200 Subject: [PATCH 16/16] add DYNAMIC_ARCH support for ZARCH --- driver/others/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/driver/others/CMakeLists.txt b/driver/others/CMakeLists.txt index ebcc0aa781..e963fd9dda 100644 --- a/driver/others/CMakeLists.txt +++ b/driver/others/CMakeLists.txt @@ -52,6 +52,8 @@ if (DYNAMIC_ARCH) list(APPEND COMMON_SOURCES dynamic_arm64.c) elseif (POWER) list(APPEND COMMON_SOURCES dynamic_power.c) + elseif (ZARCH) + list(APPEND COMMON_SOURCES dynamic_zarch.c) elseif (RISCV64) list(APPEND COMMON_SOURCES dynamic_riscv64.c detect_riscv64.c) elseif (LOONGARCH64)