Skip to content

Fix ARM Linux topology for heterogeneous core groups - #438

Open
JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:fix/arm-heterogeneous-topology
Open

JakeStevens wants to merge 1 commit into
pytorch:mainfrom
JakeStevens:fix/arm-heterogeneous-topology

Conversation

@JakeStevens

@JakeStevens JakeStevens commented Oct 6, 2026 •

Copy link
Copy Markdown

Android kernels can put different core types in the same topology group. cpuinfo currently copies the group leader's identity to every CPU, so a Pixel 10 reports eight Cortex-A520 cores. With this change it reports the actual 1x Cortex-X4, 5x Cortex-A725, and 2x Cortex-A520 configuration in three homogeneous public clusters.

Preserve per-CPU MIDRs and maximum frequencies when available, retaining the existing identity inference for missing records and older /proc/cpuinfo formats with one shared MIDR. Rebuild cluster leaders and counts after sorting, so processors that move ahead of the original leader receive valid cluster and cache pointers. Keep L3 counts and indices consistent when some of the resulting groups have no modeled L3.

Add eight synthetic topology regressions covering Pixel 8/9/10, the Galaxy S23's mixed A710/A715 group, missing identity data, different frequencies within one core type, unknown CPU parts, and mixed cache models. They check identities, ordering, homogeneous cluster ranges, and cache pointer/range consistency. Cache capacities continue to use the existing models; the cache-discovery work in #437 is separate.

Fixes #316.

Validation:

  • Physical Pixel 10, Tensor G5, Android 17, built with NDK r29: correct core identities and clusters; all 132 init-test checks and all four get-current-test checks pass.
  • Physical Pixel 6 Pro, first-generation Tensor, Android 12 / Linux 5.10: ARM64 and ARMv7 builds both report 2x Cortex-X1 + 2x Cortex-A76 + 4x Cortex-A55 in three clusters. Both pass all 132 initialization checks, four current-CPU checks, and eight new regression modes. ARM64 CPU and cache reports are identical to the original revision.
  • All eight new regression modes pass on Android; all eight fail when linked against the original library.
  • The new regressions pass in ARM32 and ARM64 host mocks under UBSan. Three older ARM32 fixtures also pass their topology/cache checks.
  • Native macOS CMake build and initialization tests pass. Android ARMv7 compilation and formatting checks pass.
  • Full ARM64 Android suite on both Pixel 10 and Pixel 6 Pro: 41/51 test invocations pass, compared with 33/43 on the original revision. The same ten test programs fail in both: alcatel-revvl, galaxy-s7-global, iconia-one-10, meizu-pro-6, meizu-pro-6s, meizu-pro-7-plus, oppo-r9, xiaomi-mi-5c, xperia-c4-dual, and chipset-test. Individual failures within those existing fixture programs can differ as cluster ranges are rebuilt.

@meta-cla meta-cla Bot added the cla signed label Oct 6, 2026
@JakeStevens

Copy link
Copy Markdown
Author

@fbarchard can you confirm this resolves your issue in #316 ?

it does not yet fix the cache reporting issue

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.

Pixel device cluster topology error

1 participant