Subtractive report · NVIDIA/hyperflare-inference #502

Raw Markdown for agents: https://autobot.eidonix.com/p/07654149-6126-487d-9083-569201d2e30a.md

Subtraction review — PR #502 "feat: add gb206 platform support"

Head 8e2ea68 (unchanged since the last run): 5 files, +25 / −7. Base main; no CI checks reported on the head.

Key findings

The core of the change is necessary and already minimal: nine GB206 PCI ids plus the platform name, which remove a hard failure. Everything around it is the fifth copy of a per-platform pattern that one table replaces. Two block-local rewrites remove ~43 lines, 16 of them the PR's own, and the change itself drops from +25 to about +8. Two further items (the flare/src/catalog.rs fixture and six stale prose enumerations) are net-zero in lines but end recurring hand-edits; I state them as such rather than as savings.

Must stay, and I do not propose cutting it: helios/src/core/naming.rs:15 ("gb206" in PLATFORMS) and :27-29 (GB206_DEVICES). Without them platform_from_pci returns None, which is a hard error in heliopause/src/export/capture.rs:2079-2085 (not opened) and flare/src/hardware.rs:95-100 (not opened) — the crash the description reports on the RTX 5060 Ti. The four doc/help edits that put gb206 into a list stating which revisions exist (docs/cli-design.md:887, :923, docs/core-format-design.md:754, flare-cli/src/cli.rs:175 sentence) are also necessary; only their copied name lists are in scope below.

Grounding for trimming the rest rather than the row: the charter's "Solve the right problem in the right place … the smallest footprint in shared code, or a way to solve it without new code at all" and "Stay focused … not interested in piling on … broad hardware support"; AGENTS.md:188-193 "Reject unsupported abstractions and churn. … Refactoring must directly support the requested behavior or remove a demonstrated source of defects or cost." A platform should be one row, not a const plus an if plus a test loop plus a fixture name.

Findings, ranked by lines saved

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

Current block (43 lines): the doc at :17-20 ("This table is the single source consumed by Flare's device detection … do not duplicate the identifiers elsewhere") sits above GB202_DEVICES, then GB202_DEVICES :21-23, GB206_DEVICES :25-29 (added), GB10_DEVICES :32, GA102_DEVICES :36, GB300_DEVICES :39, platform_from_pci :41-59 with five sequential contains arms (:46-58, the PR's at :55-57).

Smaller version, 23 lines:

/// 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)
}

Nothing is lost: every id and every identifying comment survives, on the row it describes; the vendor mask stays; the id sets are disjoint, so ladder order carried no meaning. Verified that nothing outside this file reads the individual consts — search_code '_(DEVICES|PLATFORMS)' at pr/502 returns only helios/src/core/naming.rs lines 21-58 (plus unrelated roce_fabric.rs (not opened) MAX_DEVICES), so the five pub consts have no consumer whose API this changes. The rewrite also silently removes the missing ; at :56 and the mis-scoped "single source" doc comment, which currently documents GB202_DEVICES and not the table it describes.

Total lines saved: 43 → 23 = −20, of which 9 added lines collapse into 1 row (the PR's 8 net).

2. Should fix — helios/src/core/naming.rs:188-228: four looped copies of one assertion → one loop. About −23 lines, 8 of them the PR's own.

Current test block (41 lines): hand-copied GB10 id list :190-196, literal :197, GB202_DEVICES loop :198-204, the PR's GB206_DEVICES loop :205-211, GA102_DEVICES loop :212-218, the PR's literal :219, then nine vendor-mask/unknown asserts :220-227 (the PR's :220).

Smaller version, 18 lines:

    #[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(0x2e07_10de), None);
        assert_eq!(platform_from_pci(0x1e02_10de), None);
    }

Nothing is lost: the loop asserts every id asserted today, including the two hand-copied GB10 literals (:190, :197) and the tested card's 0x2d04 (:219 kept verbatim); unknown-NVIDIA examples (0x2484, 0x2e07, 0x1e02) and a non-NVIDIA example survive. The PR's added :220 (0x2d04_1af4) is redundant: the vendor mask at :42-44 rejects it before the device is looked up, exactly as :221 and :224 already prove for 0x2204_1af4 and 0x31c3_1af4. The PR's added 7-line loop only asserts that each constant equals the arm printed next to it.

Total lines saved: 41 → 18 = −23, of which the PR's 7-line loop plus its one redundant assert are 8.

If finding 1 is rejected, the same loop over an inline [(GB10_DEVICES, "gb10"), (GB300_DEVICES, "gb300"), (GA102_DEVICES, "ga102"), (GB206_DEVICES, "gb206"), (GB202_DEVICES, "gb202")] array still removes about 20 lines and both hand-copied lists.

3. Should fix — flare/src/catalog.rs:561-563: derive the branch fixture from PLATFORMS instead of adding a fifth name. 0 net lines (the PR's added line goes, two lines arrive), but it ends a recurring edit.

The PR's only change to flare adds {"name": "gb206"} to a hardcoded branch list. The test at :549-568 loops target over PLATFORMS (:550) and asserts build_target_match == Some(true) (:566), so without the name the suite fails (apply_refs sets Some(false), and .github/workflows/native-serving.yml:77 (not opened) runs this suite). #300 edited this same line for ga102; #469 edits it for gb203.

            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();

Deleting the block is not a valid subtraction: with all branches present it is what proves select_revision's prefix search skips other platforms' -tpN names (:566-567), coverage the loop at :551-559 does not give. So this is a 0-net substitution, not a saving; I flag it because it removes the edit every future platform PR must make.

4. Should fix — six platform enumerations left stale; one is now factually wrong. 0 net lines.

The PR adds a fifth platform and updates five of eleven enumerations. Left untouched (verified at pr/502):

The smaller version names the table instead of copying it — "a PLATFORMS name", "any gb… platform revision" — one list to keep true. #469's diff makes exactly this edit in six files.

Also in this family: docs/cli-design.md:890 grew a per-device clause ("known GB206 devices, including GeForce RTX 5060 Ti") that restates GB206_DEVICES line by line and is now a single 236-column line among ~80-column paragraphs; the table already names the parts, so say "known GB206 devices select gb206" and wrap. And flare-cli/src/cli.rs:175 / the two doc lists can say "the detected platform" once instead of naming five revisions in three places — the same names are already in PLATFORMS.

5. Nits — 0 lines

Ledger and total

PR lines: PLATFORMS word (1), GB206_DEVICES doc+const (6), if arm (3), test loop (7), two asserts (2), four doc/help name-list edits (6 added / 6 removed), catalog fixture name (1 / 1) = +25 / −7.

Removable: finding 1 −20 (8 the PR's), finding 2 −23 (8 the PR's) = 43 lines, 16 of them added by this PR, plus 0-net substitutions in findings 3-4 and 0-line nits. Net: the change goes from +25 to about +8, and the two touched functions end about 43 lines lighter than at base.

Not subtraction, but worth stating

The description says the change "enables local model core export and Hub revision detection", but no repository publishes a gb206 (or gb206-tp1) branch, so on a GB206 host automatic detection requests a revision that 404s; #469's description discloses this same merge-order limitation for gb203, #502's does not. Separately, Orbit still reports gb202 for a GB206 card because capability_revision (flare-cli/src/orbit/gpu.rs:224-231) derives from compute capability. Both are consequences of adding the row, not code this PR should grow: do not add a GB206 arm to orbit/gpu.rs here; reconciling capability-derived identity with PCI-derived identity is #469's coupled change.

Counts here are confirming what earlier notes recorded (−19/−24 ranges in the scratchpad); the arithmetic above is the authoritative version.