Skip to content

[MLAS] Do not build the POWER MLAS kernels when VSX is unavailable - #32389

Merged
Hariharan Seshadri (hariharans29) merged 1 commit into
microsoft:mainfrom
pkubaj:ppc64-fix
Sep 3, 2026
Merged

Hariharan Seshadri (hariharans29) merged 1 commit into
microsoft:mainfrom
pkubaj:ppc64-fix

Conversation

@pkubaj

Copy link
Copy Markdown
Contributor

Description

mlas.h only defines MLAS_TARGET_POWER when VSX is defined, so on
PowerPC targets whose default baseline lacks VSX (for example
FreeBSD/powerpc64, whose big-endian baseline is a 970-class CPU with
AltiVec but no VSX) MLAS itself falls back to the generic
implementation. onnxruntime_mlas.cmake, however, still adds the power/
kernel sources and dgemm.cpp for every powerpc* processor. Those
translation units cannot compile without VSX: mlasi.h only includes
<altivec.h> under VSX, so vec_splat and friends are undeclared, and
the MLAS_FLOAT64X2 type and the double-precision helpers exist only for
MLAS_VSX_INTRINSICS:

onnxruntime/core/mlas/lib/power/FgemmKernelpower.h:155:27: error: use of undeclared identifier "vec_splat"
onnxruntime/core/mlas/lib/power/DgemmKernelPower.cpp: error: unknown type name "MLAS_FLOAT64X2"

Motivation and Context

Probe for VSX and skip the POWER-specific sources when it is absent,
so that such targets build with the generic kernels, matching what
mlas.h already decides at the preprocessor level.

Tested on FreeBSD 15.1/powerpc64 (big-endian): the build proceeds past
MLAS with the generic kernels; powerpc64le (VSX baseline) is unaffected.

Copilot AI balanced review requested due to automatic review settings September 2, 2026 13:00
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change correctly selects generic MLAS kernels on PowerPC targets without VSX.

Pull request overview

Aligns MLAS source selection with MLAS_TARGET_POWER by falling back to generic kernels when VSX is unavailable.

Changes:

  • Adds a compile-time VSX capability probe.
  • Disables POWER-specific sources when the probe fails.

No actionable issues identified.

File summaries
File Description
cmake/onnxruntime_mlas.cmake Guards POWER kernel selection with a VSX compiler check.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@hariharans29 Hariharan Seshadri (hariharans29) changed the title Do not build the POWER MLAS kernels when VSX is unavailable [MLAS] Do not build the POWER MLAS kernels when VSX is unavailable Sep 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Clearing the shared POWER architecture flag breaks Java packaging on no-VSX PowerPC builds.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread cmake/onnxruntime_mlas.cmake Outdated
mlas.h only defines MLAS_TARGET_POWER when __VSX__ is defined, so on
PowerPC targets whose default baseline lacks VSX (for example
FreeBSD/powerpc64, whose big-endian baseline is a 970-class CPU with
AltiVec but no VSX) MLAS itself falls back to the generic
implementation.  onnxruntime_mlas.cmake, however, still adds the power/
kernel sources and dgemm.cpp for every powerpc* processor.  Those
translation units cannot compile without VSX: mlasi.h only includes
<altivec.h> under __VSX__, so vec_splat and friends are undeclared, and
the MLAS_FLOAT64X2 type and the double-precision helpers exist only for
MLAS_VSX_INTRINSICS:

  onnxruntime/core/mlas/lib/power/FgemmKernelpower.h:155:27: error: use of undeclared identifier "vec_splat"
  onnxruntime/core/mlas/lib/power/DgemmKernelPower.cpp: error: unknown type name "MLAS_FLOAT64X2"

Probe for __VSX__ and skip the POWER-specific sources when it is absent,
so that such targets build with the generic kernels, matching what
mlas.h already decides at the preprocessor level.  The probe result is
carried in a separate MLAS_HAS_VSX variable rather than clearing POWER,
because onnxruntime_java.cmake uses POWER to select the Java packaging
architecture.

Tested on FreeBSD 15.1/powerpc64 (big-endian): the build proceeds past
MLAS with the generic kernels; powerpc64le (VSX baseline) is unaffected.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused CMake change correctly enables the existing scalar fallback on non-VSX PowerPC targets.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@hariharans29
Hariharan Seshadri (hariharans29) merged commit a535bcf into microsoft:main Sep 3, 2026
90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants