Skip to content

Support generic / non-x86 CPUs in the lstopo translator - #82

Merged
Amos-Rai-KEYS merged 2 commits into
mainfrom
add-generic-cpu-lstopo
Aug 31, 2026
Merged

Support generic / non-x86 CPUs in the lstopo translator#82
Amos-Rai-KEYS merged 2 commits into
mainfrom
add-generic-cpu-lstopo

Conversation

@Amos-Rai-KEYS

@Amos-Rai-KEYS Amos-Rai-KEYS commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Support generic / non-x86 CPUs in the lstopo translator

Problem

LstopoParser._parse_cpu_info() raised ValueError("Missing required CPU information in XML.") whenever the lstopo XML lacked a CPUModel or CPUVendor info element. hwloc sources both of those from the x86 CPUID instruction, so they are simply absent on aarch64, POWER, RISC-V and s390x — the translator failed outright on any non-x86 topology. Separately, vendor strings lifted straight out of the XML (PCIDevice, GPUModel) frequently contain /, ., : and ,, which the name pattern in schema/common.yaml (^[\sa-zA-Z0-9-_()><\[\]]+$) rejects, so otherwise-valid topologies failed schema validation.

Changes

src/infragraph/translators/lstopo_translator.py

  • CPU info is no longer mandatory. Added _find_info() helper and made CPUModel / CPUVendor optional. Both values are descriptive only: cpu_model is the component description, and cpu_vendor only selects an inter-socket fabric name on multi-socket systems.
  • Added _describe_generic_cpu() as a fallback description for architectures with no self-describing CPU name. Falls back to firmware-exposed data — Architecture — and finally to "Unknown CPU".
  • Package fallback. Topologies that expose no Package object now treat the Machine element as a single package, so cpu_count is never zero.
  • Missing CPU fabric is a warning, not a silent no-op. When the CPU vendor has no known inter-socket fabric, a warning is printed naming the vendor and the number of CPUs whose interconnect was not modelled.
  • Added sanitize_name() which replaces schema-invalid characters with spaces and collapses whitespace. Applied to GPU models and NIC names in _extract_gpu_info(), _extract_nic_info() and the device-name lookup path.
  • Fixed the 102b vendor label ("Matrox card/controller""Matrox card controller") so it satisfies the same name pattern.

@Amos-Rai-KEYS Amos-Rai-KEYS self-assigned this Aug 28, 2026
@Amos-Rai-KEYS
Amos-Rai-KEYS merged commit 83f87f1 into main Aug 31, 2026
1 check passed
@Amos-Rai-KEYS
Amos-Rai-KEYS deleted the add-generic-cpu-lstopo branch August 31, 2026 15:13
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