Skip to content

Commit 127faf0

Browse files
KV2773Copilot
andauthored
Build issues on AIX for POWER10 and POWER11 (microsoft#26704)
While building onnxruntime from source for AIX I ran into macro pre-defined errors for the POWER10 and POWER11 machines. This patch resolves the issue. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c0b3212 commit 127faf0

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

cmake/onnxruntime_mlas.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,13 @@ else()
636636
enable_language(ASM)
637637
check_cxx_source_compiles("
638638
#ifdef _AIX
639+
#include <sys/systemcfg.h>
640+
#if !defined(POWER_10)
639641
#define POWER_10 0x40000
642+
#endif
643+
#if !defined(POWER_10_ANDUP)
640644
#define POWER_10_ANDUP (POWER_10)
641-
#include <sys/systemcfg.h>
645+
#endif
642646
#define __power_10_andup() (_system_configuration.implementation & POWER_10_ANDUP)
643647
int main() {
644648
bool HasP10 = (__power_10_andup() && __power_mma_version() == MMA_V31);

onnxruntime/core/mlas/lib/platform.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ Module Name:
4040
#if defined(__linux__)
4141
#include <sys/auxv.h>
4242
#elif defined(_AIX)
43+
#include <sys/systemcfg.h>
44+
#if !defined(POWER_10)
4345
#define POWER_10 0x40000
46+
#endif
47+
#if !defined(POWER_10_ANDUP)
4448
#define POWER_10_ANDUP (POWER_10)
45-
#include <sys/systemcfg.h>
49+
#endif
4650
#define __power_10_andup() (_system_configuration.implementation & POWER_10_ANDUP)
4751
#elif defined(__FreeBSD__)
4852
#include <machine/cpu.h>

0 commit comments

Comments
 (0)