Skip to content

feat: add PCI subsystem IDs to GPU fingerprints - #235

Open
JuanDelPueblo wants to merge 1 commit into
OpenGamingCollective:mainfrom
JuanDelPueblo:poc/pci-subsystem-fingerprint
Open

feat: add PCI subsystem IDs to GPU fingerprints#235
JuanDelPueblo wants to merge 1 commit into
OpenGamingCollective:mainfrom
JuanDelPueblo:poc/pci-subsystem-fingerprint

Conversation

@JuanDelPueblo

@JuanDelPueblo JuanDelPueblo commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

This change adds PCI subsystem vendor and device IDs to the internal PCI model. For this the daemon reads both values from sysfs during IOMMU and normal PCI enumeration. Then the GPU enumeration logs a deterministic hardware fingerprint for POC debugging.

Related to #228

TODO for future PRs related to #228

  • Either find a third truly unique variable for the GPU fingerprint or compromise with using the PCIE BDF's enumerator.
  • Save the UUID in gpu_state.json.
  • Expose it for use in environment variables, CLI, and GUI
  • Ensure all edge cases are handled without changing the ID (identical dual GPUs, eGPUs, swapping GPU location, etc.)

Checklist:

  • My code follows the style guidelines of this project (cargo fmt)
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the mdBook documentation
  • My changes generate no new warnings (clippy/clang)
  • New and existing unit tests pass locally with my changes (either use nix flake check or wait for the ci)

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 29d8ba1e-6fad-4ce2-a9b3-3e35bab89bb0

📥 Commits

Reviewing files that changed from the base of the PR and between 318502a and c813816.

📒 Files selected for processing (4)
  • crates/cardwire-daemon/src/core/gpu/enumerator.rs
  • crates/cardwire-daemon/src/core/gpu/models.rs
  • crates/cardwire-daemon/src/core/pci/models.rs
  • crates/cardwire-daemon/src/core/pci/pci_device.rs

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Summary

Summary by CodeRabbit

  • New Features

    • Added more detailed hardware identification for graphics and PCI devices, including subsystem information.
    • Hardware fingerprints now provide a consistent summary of device identifiers, including clear placeholders when details are unavailable.
  • Diagnostics

    • GPU discovery logs now include each device’s PCI address and hardware fingerprint, making device detection easier to monitor and troubleshoot.

Walkthrough

The change adds subsystem PCI identifiers to PciDevice, reads them from sysfs, formats hardware fingerprints, and logs each fingerprint during GPU enumeration. Tests cover populated and missing identifier values.

Changes

GPU hardware fingerprinting

Layer / File(s) Summary
PCI device fingerprint contract
crates/cardwire-daemon/src/core/pci/models.rs, crates/cardwire-daemon/src/core/gpu/models.rs
PciDevice stores subsystem vendor and device identifiers, exposes accessors, and formats fingerprints with "unknown" for missing values. Tests and the GPU fixture pass and validate the new fields.
PCI subsystem identifier discovery
crates/cardwire-daemon/src/core/pci/pci_device.rs
The IOMMU and sysfs discovery paths read subsystem identifiers from sysfs and pass them to PciDevice::new.
GPU enumeration logging
crates/cardwire-daemon/src/core/gpu/enumerator.rs
GPU enumeration logs each PCI address and hardware fingerprint before building the GPU device.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c8138

The daemon now captures PCI subsystem IDs and logs deterministic GPU hardware fingerprints without changing GPU construction behavior. No concrete merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant Sysfs
  participant PciDiscovery
  participant PciDevice
  participant GpuEnumerator
  Sysfs->>PciDiscovery: Read subsystem PCI identifiers
  PciDiscovery->>PciDevice: Construct device with identifiers
  PciDevice-->>GpuEnumerator: Provide hardware fingerprint
  GpuEnumerator->>GpuEnumerator: Log PCI address and fingerprint
Loading

Suggested reviewers: luytan

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding PCI subsystem IDs to GPU hardware fingerprints.
Description check ✅ Passed The description explains the implementation, motivation, related issue, future work, and checklist status. Documentation updates and local test execution are marked incomplete, but the description is …

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JuanDelPueblo
JuanDelPueblo marked this pull request as ready for review September 8, 2026 20:43
@luytan
luytan self-requested a review September 8, 2026 21:12

@luytan luytan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Postponed until we find a truly unique ID

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.

2 participants