Add basic riscv64 architecture support#18
Conversation
There was a problem hiding this comment.
Pull request overview
Adds baseline riscv64 support to lscompute’s CPU detection and Snap packaging, plus a new SiFive P550 Premier machine fixture to exercise the end-to-end pipeline on riscv64.
Changes:
- Extend CPU parsing/model to include a riscv64
isafield sourced from/proc/cpuinfo. - Update Snap build logic so
nvidia-smiis only pulled/used on supported architectures and provides a stub elsewhere. - Add a new
test_data/machines/sifive-p550-premierfixture and tests covering riscv64 dispatch + fullInfo()pipeline.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test_data/machines/sifive-p550-premier/machine-root/sys/bus/pci/devices/0000:00:00.0/vendor | Adds PCI vendor ID fixture data for the P550 machine. |
| test_data/machines/sifive-p550-premier/machine-root/sys/bus/pci/devices/0000:00:00.0/subsystem_vendor | Adds PCI subsystem vendor fixture data for the P550 machine. |
| test_data/machines/sifive-p550-premier/machine-root/sys/bus/pci/devices/0000:00:00.0/subsystem_device | Adds PCI subsystem device fixture data for the P550 machine. |
| test_data/machines/sifive-p550-premier/machine-root/sys/bus/pci/devices/0000:00:00.0/device | Adds PCI device ID fixture data for the P550 machine. |
| test_data/machines/sifive-p550-premier/machine-root/sys/bus/pci/devices/0000:00:00.0/class | Adds PCI class fixture data for the P550 machine. |
| test_data/machines/sifive-p550-premier/machine-root/run/disk-stats.json | Adds disk stats fixture data for end-to-end machine parsing. |
| test_data/machines/sifive-p550-premier/machine-root/proc/sys/kernel/arch | Adds riscv64 arch fixture input for architecture detection. |
| test_data/machines/sifive-p550-premier/machine-root/proc/meminfo | Adds meminfo fixture input for memory parsing. |
| test_data/machines/sifive-p550-premier/machine-root/proc/cpuinfo | Adds riscv64 cpuinfo fixture input for CPU parsing. |
| snap/snapcraft.yaml | Makes nvidia-smi packaging arch-aware and provides a stub on unsupported arches. |
| pkg/machine/cpu/types.go | Adds isa field to CPU output model and internal proc structure for riscv64. |
| pkg/machine/cpu/proc_cpuinfo.go | Adds riscv64 /proc/cpuinfo parsing and dispatcher routing. |
| pkg/machine/cpu/proc_cpuinfo_test.go | Adds riscv64 cpuinfo fixture and dispatcher test coverage. |
| pkg/machine/cpu/cpu.go | Maps parsed riscv64 ISA into the exported CpuInfo. |
| pkg/machine/cpu/cpu_test.go | Adds riscv64 end-to-end fixture test coverage for Info() and infoFromRawData(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jpm-canonical
left a comment
There was a problem hiding this comment.
I do not have access to a riscv machine, nor can I get access to one on testflinger.
I did a code review, and I am happy with these changes.
I also added another riscv64 machine to the test_data. We had this test set from before but never added it here because riscv was not supported. This machine also passes the tests.
Scoped nvidia-smi part to amd64/arm64, with wrapper error message on riscv64 Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
This adds basic riscv64 architecture support.
It allows building the snap on riscv64, and then running basic commands:
See also Original PR to inference-snaps-cli