git: a37234b532d8 - main - misc/onnxruntime: fix build on powerpc64le

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Fri, 04 Jul 2025 21:59:00 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a37234b532d897bea097c4b255054d4394e0c3f6

commit a37234b532d897bea097c4b255054d4394e0c3f6
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2025-07-03 09:16:16 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2025-07-04 21:58:50 +0000

    misc/onnxruntime: fix build on powerpc64le
---
 .../patch-onnxruntime_core_mlas_lib_platform.cpp   | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_platform.cpp b/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_platform.cpp
new file mode 100644
index 000000000000..ac3b2e307ccc
--- /dev/null
+++ b/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_platform.cpp
@@ -0,0 +1,26 @@
+--- onnxruntime/core/mlas/lib/platform.cpp.orig	2025-06-26 13:24:10 UTC
++++ onnxruntime/core/mlas/lib/platform.cpp
+@@ -611,6 +611,11 @@ --*/
+     bool HasP9Instructions = hwcap2 & PPC_FEATURE2_ARCH_3_00;
+ #elif defined(_AIX)
+     bool HasP9Instructions = __power_9_andup();
++#elif defined(__FreeBSD__)
++    unsigned long hwcap2;
++    elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
++
++    bool HasP9Instructions = hwcap2 & PPC_FEATURE2_ARCH_3_00;
+ #endif // __linux__
+     if (HasP9Instructions) {
+         this->QuantizeLinearS8Kernel = MlasQuantizeLinearS8KernelVSX;
+@@ -624,6 +629,11 @@ --*/
+     bool HasP10Instructions = ((hwcap2 & PPC_FEATURE2_MMA) && (hwcap2 & PPC_FEATURE2_ARCH_3_1));
+ #elif defined(_AIX)
+     bool HasP10Instructions = (__power_10_andup() && __power_mma_version() == MMA_V31);
++#elif defined(__FreeBSD__)
++    unsigned long hwcap2;
++    elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
++
++    bool HasP10Instructions = ((hwcap2 & PPC_FEATURE2_MMA) && (hwcap2 & PPC_FEATURE2_ARCH_3_1));
+ #endif // __linux__
+     if (HasP10Instructions) {
+         this->GemmFloatKernel = MlasSgemmKernelPOWER10;