Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Jan 2026 08:36:07 +0000
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 0efa90c72c76 - main - misc/onnxruntime: fix build on powerpc64le
Message-ID:  <695b77f7.be26.1b5301c8@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by pkubaj:

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

commit 0efa90c72c76f6e7ac38945098f76f60406a909e
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-01-02 14:51:24 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-01-05 08:36:03 +0000

    misc/onnxruntime: fix build on powerpc64le
    
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/platform.cpp:636:18: error: use of undeclared identifier 'AT_HWCAP2'
      636 |     elf_aux_info(AT_HWCAP2, &hwcap2, sizeof(hwcap2));
          |                  ^
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/platform.cpp:638:39: error: use of undeclared identifier 'PPC_FEATURE2_ARCH_3_00'
      638 |     bool HasP9Instructions = hwcap2 & PPC_FEATURE2_ARCH_3_00;
          |                                       ^
    2 errors generated.
    /wrkdirs/usr/ports/misc/onnxruntime/work/.build/_deps/eigen3-src/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/AltiVec/PacketMath.h:119:35: error: 'vec_lvsl' is deprecated: use assignment for unaligned little endian loads/s
    tores [-Werror,-Wdeprecated-declarations]
      119 | static Packet16uc p16uc_FORWARD = vec_lvsl(0, (float*)0);
          |                                   ^
    /usr/lib/clang/19/include/altivec.h:4610:20: note: 'vec_lvsl' has been explicitly marked deprecated here
     4610 |     __attribute__((__deprecated__("use assignment for unaligned little endian \
          |                    ^
    1 error generated.
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp:880:70: error: expected a type
      880 |     __vector signed int columnsum = *reinterpret_cast<const __vector int32_t *>(&ColumnSumBuffer[pos]);
          |                                                                      ^
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp:880:69: error: expected '>'
      880 |     __vector signed int columnsum = *reinterpret_cast<const __vector int32_t *>(&ColumnSumBuffer[pos]);
          |                                                                     ^
          |                                                                     >
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp:880:54: note: to match this '<'
      880 |     __vector signed int columnsum = *reinterpret_cast<const __vector int32_t *>(&ColumnSumBuffer[pos]);
          |                                                      ^
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp:887:74: error: expected a type
      887 |         __vector signed int zeropoint = *reinterpret_cast<const __vector int32_t *>(&ZeroPointB[pos]);
          |                                                                          ^
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp:887:73: error: expected '>'
      887 |         __vector signed int zeropoint = *reinterpret_cast<const __vector int32_t *>(&ZeroPointB[pos]);
          |                                                                         ^
          |                                                                         >
    /wrkdirs/usr/ports/misc/onnxruntime/work/onnxruntime-1.23.2/onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp:887:58: note: to match this '<'
      887 |         __vector signed int zeropoint = *reinterpret_cast<const __vector int32_t *>(&ZeroPointB[pos]);
          |                                                          ^
    4 errors generated.
---
 misc/onnxruntime/Makefile                            |  1 +
 .../patch-onnxruntime_core_mlas_lib_platform.cpp     | 12 ++++++++++++
 ...me_core_mlas_lib_power_qgemm__kernel__power10.cpp | 19 +++++++++++++++++++
 .../files/patch-onnxruntime_core_mlas_lib_qlmul.cpp  | 20 ++++++++++++++++++++
 4 files changed, 52 insertions(+)

diff --git a/misc/onnxruntime/Makefile b/misc/onnxruntime/Makefile
index cdf7a7214bce..67152ff60acc 100644
--- a/misc/onnxruntime/Makefile
+++ b/misc/onnxruntime/Makefile
@@ -35,6 +35,7 @@ CMAKE_ARGS=	-Donnx_SOURCE_DIR=${WRKSRC}/cmake/external/onnx
 CMAKE_TESTING_ON=	onnxruntime_BUILD_UNIT_TESTS
 
 CXXFLAGS+=	-Wno-array-bounds # workaround for https://github.com/microsoft/onnxruntime/issues/23410
+CXXFLAGS+=	-Wno-deprecated-declarations #fixes error: 'vec_lvsl' is deprecated: use assignment for unaligned little endian loads/stores
 CXXFLAGS+=	-I${WRKSRC}/include/onnxruntime/core/common/logging # otherwise logging.h isn't found
 CXXFLAGS+=	-frtti # fixes error: onnxruntime/test/contrib_ops/gather_block_quantized_op_test.cc:85:77: error: use of typeid requires -frtti
 
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..7aa857e38594
--- /dev/null
+++ b/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_platform.cpp
@@ -0,0 +1,12 @@
+--- onnxruntime/core/mlas/lib/platform.cpp.orig	2026-01-02 14:17:14 UTC
++++ onnxruntime/core/mlas/lib/platform.cpp
+@@ -32,6 +32,9 @@ --*/
+ #define POWER_10_ANDUP (POWER_10)
+ #include <sys/systemcfg.h>
+ #define __power_10_andup() (_system_configuration.implementation & POWER_10_ANDUP)
++#elif defined(__FreeBSD__)
++#include <machine/cpu.h>
++#include <sys/auxv.h>
+ #endif
+ #endif
+ 
diff --git a/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_power_qgemm__kernel__power10.cpp b/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_power_qgemm__kernel__power10.cpp
new file mode 100644
index 000000000000..76caadec4836
--- /dev/null
+++ b/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_power_qgemm__kernel__power10.cpp
@@ -0,0 +1,19 @@
+--- onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp.orig	2026-01-02 14:17:54 UTC
++++ onnxruntime/core/mlas/lib/power/qgemm_kernel_power10.cpp
+@@ -874,14 +874,14 @@ MlasQgemmStoreVectorMMA
+ {
+     size_t RowCount;
+     __vector signed int vsum0, vsum1, vsum2, vsum3;
+-#if defined(_AIX) && defined(__clang__)
++#if (defined(_AIX) || defined(__FreeBSD__)) && defined(__clang__)
+     __vector signed int columnsum = *reinterpret_cast<const __vector int *>(&ColumnSumBuffer[pos]);
+ #else
+     __vector signed int columnsum = *reinterpret_cast<const __vector int32_t *>(&ColumnSumBuffer[pos]);
+ #endif
+     C += VectorCount;
+     if (ZeroPointB != nullptr) {
+-#if defined(_AIX) && defined(__clang__)
++#if (defined(_AIX) || defined(__FreeBSD__)) && defined(__clang__)
+         __vector signed int zeropoint = *reinterpret_cast<const __vector int *>(&ZeroPointB[pos]);
+ #else
+         __vector signed int zeropoint = *reinterpret_cast<const __vector int32_t *>(&ZeroPointB[pos]);
diff --git a/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_qlmul.cpp b/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_qlmul.cpp
new file mode 100644
index 000000000000..16521c584b6c
--- /dev/null
+++ b/misc/onnxruntime/files/patch-onnxruntime_core_mlas_lib_qlmul.cpp
@@ -0,0 +1,20 @@
+--- onnxruntime/core/mlas/lib/qlmul.cpp.orig	2026-01-02 14:18:24 UTC
++++ onnxruntime/core/mlas/lib/qlmul.cpp
+@@ -325,7 +325,7 @@ MlasQLinearMulKernel(
+     }
+ 
+     while (N >= 4) {
+-#if defined(_AIX) && defined(__clang__)
++#if (defined(_AIX) || defined(__FreeBSD__)) && defined(__clang__)
+         __vector int IntegerAVector {InputA[0], InputA[1], InputA[2], InputA[3]};
+ #else
+         __vector int32_t  IntegerAVector {InputA[0], InputA[1], InputA[2], InputA[3]};
+@@ -334,7 +334,7 @@ MlasQLinearMulKernel(
+         auto ValueAVector = vec_mul(ScaleAVector, vec_ctf(IntegerVector, 0));
+ 
+         if (!IsScalarB) {
+-#if defined(_AIX) && defined(__clang__)
++#if (defined(_AIX) || defined(__FreeBSD__)) && defined(__clang__)
+             __vector int  IntegerBVector {InputB[0], InputB[1], InputB[2], InputB[3]};
+ #else
+             __vector int32_t  IntegerBVector {InputB[0], InputB[1], InputB[2], InputB[3]};


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?695b77f7.be26.1b5301c8>