Skip to content

Add PowerPC64 Linux support - #453

Open
runlevel5 wants to merge 1 commit into
pytorch:mainfrom
runlevel5:powerpc-linux
Open

runlevel5 wants to merge 1 commit into
pytorch:mainfrom
runlevel5:powerpc-linux

Conversation

@runlevel5

@runlevel5 runlevel5 commented Oct 31, 2026 •

Copy link
Copy Markdown

Detect POWER8, POWER9, Power10 and Power11 on PowerPC64 Linux, both little-endian and big-endian:

  • Vendor, microarchitecture and PVR from /proc/cpuinfo.
  • Processors, cores and packages from sysfs topology. Linux describes no clusters on PowerPC, so the package is used as the cluster. Offline processors (e.g. SMT threads disabled with ppc64_cpu) are skipped.
  • Caches from sysfs: size, level, type and the processors sharing each cache. Linux misreports their geometry on POWER (the firmware gives every POWER9 cache 8 "sets" and no L2/L3 line size), so associativity and line size come from a table of documented values for POWER8, POWER9 and Power10, falling back to sysfs.
  • ISA features from AT_HWCAP and AT_HWCAP2: Power ISA 2.06 to 3.1, AltiVec, VSX, MMA, DFP, IEEE 128-bit floating point, HTM, DARN and vector crypto.

Both endiannesses share the same code. CMake treats ppc64le as ppc64, and Bazel gains a linux_ppc64 setting next to linux_ppc64le.

Tested on:

  • POWER9 bare metal (PowerNV), ppc64le: all tests pass.
  • POWER9 KVM guest (QEMU pseries), big-endian ppc64: the mock tests and get-current-test pass. init-test fails its two "L2 cache exists" checks, see below.

Known limitation: QEMU pseries guests describe only the L1 caches in the device tree (no l2-cache nodes), so Linux exposes no L2 or L3 in sysfs and cpuinfo reports none. cpuinfo reports what the OS reports here rather than guessing, so the generic init-test, which expects an L2 cache, fails inside such guests on either endianness. power10-kvm-test covers this case.

Supersedes #267

Fixes #2

@runlevel5

Copy link
Copy Markdown
Author

I have just rebased the work with latest main branch.

@runlevel5
runlevel5 force-pushed the powerpc-linux branch 2 times, most recently from 7851004 to 7a1769c Compare November 19, 2026 23:38
Comment thread tools/cpu-info.c
case cpuinfo_uarch_power9:
return "POWER9";
case cpuinfo_uarch_power10:
return "Power10";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Btw, why is it Power10 instead of POWER10? IBM has rebranded it that way

@runlevel5
runlevel5 force-pushed the powerpc-linux branch 3 times, most recently from 6bd1aeb to 425f2cc Compare November 19, 2026 23:49
Detect POWER8, POWER9, Power10 and Power11 on PowerPC64 Linux, both
little-endian and big-endian:

- Vendor, microarchitecture and PVR from /proc/cpuinfo.
- Processors, cores and packages from sysfs topology. Linux describes no
  clusters on PowerPC, so the package is used as the cluster. Offline
  processors (e.g. SMT threads disabled with ppc64_cpu) are skipped.
- Caches from sysfs: size, level, type and the processors sharing each
  cache. Linux misreports their geometry on POWER (the firmware gives every
  POWER9 cache 8 "sets" and no L2/L3 line size), so associativity and line
  size come from a table of documented values for POWER8, POWER9 and
  Power10, falling back to sysfs.
- ISA features from AT_HWCAP and AT_HWCAP2: Power ISA 2.06 to 3.1,
  AltiVec, VSX, MMA, DFP, IEEE 128-bit floating point, HTM, DARN and
  vector crypto.

Co-authored-by: Trung Lê <8@tle.id.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cpuinfo: PPC64 support

2 participants