Subtractive report · NVIDIA/hyperflare-inference #502

Raw Markdown for agents: https://autobot.eidonix.com/p/10f9cf17-4ba9-49fe-b6e7-88d1d5bbb5ef.md

Key findings

The change fixes a real defect — platform_from_pci returning None is a hard error at heliopause/src/export/capture.rs:2079-2085 ("NVML reports unsupported GPU PCI id"), which is the ignition crash the description describes — and the nine device ids at helios/src/core/naming.rs:27-29 plus the "gb206" entry in PLATFORMS (:15) are the whole fix. Nothing below asks for those to go.

What can go is the per-platform scaffolding around them: a fifth const array and a fourth if arm where one table would do (−17), a fourth copy of the same test loop (−24), and two edits that exist only because the repository keeps hand-written copies of the platform list (flare/src/catalog.rs:561-563, and six stale enumerations elsewhere).

One correction to an earlier state of this review: the flare-cli/src/orbit/gpu.rs hunk was removed in commit 8e2ea68, so the duplicate-PCI-table and Orbit-placement objections no longer apply to this PR at all. Orbit still derives both the host revision and the core requirement from compute capability (orbit/gpu.rs:297-307, orbit/controller.rs:2294), so a GB206 card reports gb202 on that path and gb202 cores still place. Its own private, drifted table (orbit/gpu.rs:309-321) is untouched here and belongs to #469.

Detail

Baseline

Head 8e2ea68, 5 files, +25/−7: helios/src/core/naming.rs +19/−1, docs/cli-design.md +3/−3, docs/core-format-design.md +1/−1, flare-cli/src/cli.rs +1/−1, flare/src/catalog.rs +1/−1. No CI checks reported on the head; .github/workflows/native-serving.yml:77 (not opened) runs the flare suite, which includes the fixture at flare/src/catalog.rs:548.

1. Should fix — helios/src/core/naming.rs:21-59: five consts and a five-arm ladder → one table (−17 lines, 8 of them the PR's)

The block is five pub const *_DEVICES arrays (:21-23 GB202, PR's :25-29 GB206, :32 GB10, :36 GA102, :39 GB300) followed by five sequential if X_DEVICES.contains(&device) { return Some("x") } arms and a .then_some("gb202") tail (:46-58). The PR adds one const (6 lines) and one arm (3 lines) to that pattern.

Nothing else in the tree reads the individual consts — search_code for GB202_DEVICES|GB10_DEVICES|GA102_DEVICES|GB300_DEVICES|GB206_DEVICES returns 13 lines, all in this file (definition, platform_from_pci, tests). Replacing them breaks no caller. The id sets are disjoint, so the ladder's order carries no meaning.

/// Platforms a core may be named for, with the PCI device ids that select each.
/// Flare's device detection and core export naming both read this table; do not
/// duplicate the identifiers elsewhere.
pub const DEVICES: [(&str, &[u32]); 5] = [
    // GB10 and RTX Spark N1X, the SM121 platform.
    ("gb10", &[0x2e02, 0x2e03, 0x2e06, 0x2e12, 0x2e2a]),
    // `0x31c3` is the SM103 GPU of DGX Station GB300.
    ("gb300", &[0x31c3]),
    // GeForce RTX 3090 Ti, 3090, 3080, 3080 Ti, 3080 12 GB and 3080 LHR.
    ("ga102", &[0x2203, 0x2204, 0x2206, 0x2208, 0x220a, 0x2216]),
    // GeForce RTX 5060 Ti, 5060, and mobile/workstation variants.
    ("gb206", &[0x2d04, 0x2d05, 0x2d18, 0x2d19, 0x2d30, 0x2d39, 0x2d58, 0x2d59, 0x2d79]),
    ("gb202", &[0x2b85, 0x2b87, 0x2b8c, 0x2bb1, 0x2bb2, 0x2bb3, 0x2bb4, 0x2bb5, 0x2bb9]),
];

pub fn platform_from_pci(pci_id: u32) -> Option<&'static str> {
    if pci_id & 0xffff != 0x10de {
        return None;
    }
    let device = pci_id >> 16;
    DEVICES.iter().find(|(_, ids)| ids.contains(&device)).map(|(platform, _)| *platform)
}

39 lines → 22. Every documented id keeps its platform and doc comment, the vendor mask at :42-44 is unchanged, and a platform becomes one row instead of const + arm + test block. The semicolon nit at :56 (the only arm without one; siblings :50, :53 have it) disappears with the ladder.

Why this is in scope for a "recognize GB206" PR rather than speculative refactoring: the cost is being paid repeatedly. #469 (open, GB203) and #221 (closed, GB300) each added a const, an arm and a test block to this same pattern; #502 is the third. AGENTS.md:188-193 asks that refactoring "directly support the requested behavior or remove a demonstrated source of defects or cost" — the per-platform edit site is that cost, and the charter's "smallest footprint in shared code" points the same way.

2. Should fix — helios/src/core/naming.rs:188-228: four copies of one assertion → one loop over the table (−24 lines, 8 of them the PR's)

pci_ids_select_the_platform_identifier is 41 lines for one assertion in four shapes:

The added 7-line loop is also redundant with the added literal assert two lines below it: it proves each const agrees with the arm printed next to it, which a table lookup makes structural.

    #[test]
    fn pci_ids_select_the_platform_identifier() {
        for (platform, devices) in DEVICES {
            for device in devices {
                assert_eq!(
                    platform_from_pci(device << 16 | 0x10de),
                    Some(platform),
                    "{device:#06x}"
                );
            }
        }
        assert_eq!(platform_from_pci(0x2d04_10de), Some("gb206"));
        assert_eq!(platform_from_pci(0x2204_1af4), None);
        assert_eq!(platform_from_pci(0x2484_10de), None);
        assert_eq!(platform_from_pci(0x2bbc_1af4), None);
        assert_eq!(platform_from_pci(0x2e07_10de), None);
        assert_eq!(platform_from_pci(0x1e02_10de), None);
    }

41 lines → 17. Every id asserted today is still asserted (the loop covers all five rows, so the two hand-copied literals at :190 and :197 disappear rather than move); both "unknown NVIDIA id" cases survive (:2484, :2e07, :1e02) and the non-NVIDIA case keeps one example. Without the table, the same loop over [(GB10_DEVICES, "gb10"), (GB300_DEVICES, "gb300"), (GA102_DEVICES, "ga102"), (GB206_DEVICES, "gb206"), (GB202_DEVICES, "gb202")] still saves ~20 and removes the two literal copies that can drift.

3. Should fix — flare/src/catalog.rs:561-563: derive the fixture from PLATFORMS (0 net lines)

The PR's only edit to flare adds {"name": "gb206"} to a hardcoded branch list. The fixture has to contain one branch per PLATFORMS member because :550 loops target over PLATFORMS and :566 asserts build_target_match == Some(true); without the added name the test fails for target = "gb206". #300 edited this line for ga102, #469 for gb203, this PR for gb206.

Deleting the block is not free: with all branches present it is what proves select_revision's prefix search skips another platform's -tpN branch. Deriving it is:

            let branches: Vec<_> = flare_helios::core::naming::PLATFORMS
                .iter()
                .map(|platform| json!({ "name": platform }))
                .collect();
            let refs = serde_json::from_value(json!({ "branches": branches })).unwrap();

3 lines → 5, so 0 net, and the next platform touches no test. Stated plainly because it is the honest answer: this is not a line saving, it is stopping a line from being paid again.

4. Should fix — six enumerations of the platform set left stale, one now false (0 net lines)

The PR adds a fifth platform and updates four of eleven enumerations of that set. Updated: flare-cli/src/cli.rs:175, docs/cli-design.md:887, :890, :923, docs/core-format-design.md:754. Left stale (search for gb202):

The smaller version keeps every sentence and drops the copied names: "a PLATFORMS name from naming" at orbit/gpu.rs:38 and plan.rs:38; "physical device platform name" at distribution.rs:66; "revision (a PLATFORMS name from the PCI device id or compute capability)" at docs/orbit.md:321; the rule rather than three names at cli-design.md:901 ("any gb… platform revision"). 0 net lines, one list to maintain. #469 made this edit in six files; #502 does it in five and leaves six.

Not a subtraction: docs/core-format-design.md:753-754 and docs/cli-design.md:887 state which revisions exist and genuinely need gb206 spelled out.

5. Nit — three tokens, 0 lines

The missing space in PLATFORMS ("gb202","gb206") from the first commit was fixed in 8e2ea68 — nothing to report.

Ledger

The +25 added lines decompose as: 1 PLATFORMS word (keep) + 6 GB206_DEVICES const (→ 1 table row) + 3 if-arm (→ folded into the lookup) + 7 test loop (delete; replaced by the table loop) + 1 vendor-mask assert (delete; fourth repeat of one branch) + 1 literal 0x2d04_10de assert (keep) + 4 doc/help edits (keep, minus the name lists) + 1 catalog fixture entry (derive instead).

With the smaller version the change itself is ≈ +9, and the same files end ≈ 41 lines lighter in pre-existing code (naming.rs −17 ladder, −24 test), with 0 net at catalog.rs and the stale enumerations. Verdict: make it smaller first — not blocking, because the behaviour the PR adds is the right behaviour, but the shape it adds is the fifth, sixth and seventh copy of the same per-platform pattern.

What must stay

Open questions / not found