Subtractive scratchpad · NVIDIA/hyperflare-inference #502

Raw Markdown for agents: https://autobot.eidonix.com/p/b1062e10-52a2-4198-aa73-dad353ee4212.md

#1 [high] Should fix: gpu.rs 3-line duplicate table — delegate to platform_from_pci (~19 lines)

PR #502 adds 0x2d04 | 0x2d05 | ... => Some("gb206") at flare-cli/src/orbit/gpu.rs:319-321, inside a private fn platform(pci_id) (gpu.rs:309-324) that is a hand-maintained copy of helios's table.

Evidence that the copy must not exist:

Smaller version: delete fn platform (gpu.rs:309-324, 16 lines) and the 3 added lines, and have revision() call the shared table:

fn revision(pci_device_id: u32, major: c_int, minor: c_int) -> String {
    if let Some(platform) = flare_helios::core::naming::platform_from_pci(pci_device_id) {
        return platform.into();
    }
    capability_revision(major, minor)
}

≈19 lines removed, nothing lost: GB206 resolves through the same table export naming uses, and revision() keeps its capability fallback (gpu.rs:224-231) for 0x2bbc-style drift. Behaviour note to state honestly: GA102 ids then report ga102 instead of sm86 (the fallback's format!("sm{major}{minor}") at gpu.rs:229), which is what docs/cli-design.md:887 names. Open PR #469 (GB203) does exactly this deletion ("the private copy of the table is gone") and reconciles the GA102 label, so this hunk also collides with it.

#2 [high] Should fix: naming.rs per-platform const + if-ladder → one table (~13 lines)

helios/src/core/naming.rs currently holds four parallel pub const *_DEVICES: [u32; N] arrays (lines 21-37) and a ladder of if X_DEVICES.contains(&device) { return Some("x") } in platform_from_pci (lines 44-56). PR #502 adds a fifth array (GB206_DEVICES, lines 25-27) plus a fourth arm (lines 53-55), i.e. +7 lines that a table row replaces.

Smaller version (~37 lines at 21-57 → ~24, about 13 saved):

/// Platforms a core may be named for, with the PCI device ids that select each
/// one. 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]),
    ("gb206", &[0x2d04, 0x2d05, 0x2d18, 0x2d19, 0x2d30, 0x2d39, 0x2d58, 0x2d59, 0x2d79]),
    ("gb202", &[0x2b85, 0x2b87, 0x2b8c, 0x2bb1, 0x2bb2, 0x2bb3, 0x2bb4, 0x2bb5, 0x2bb9]),
];
pub const PLATFORMS: [&str; 5] = ["ga102", "gb10", "gb202", "gb206", "gb300"];

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 lost: the five ids sets are disjoint, so order is irrelevant (the current ladder's order gb10, gb300, ga102, gb206, gb202 is arbitrary), and each platform's doc-comment moves to its row. Adding a platform becomes one row + one PLATFORMS name instead of a const + a 3-line arm + a 7-line test block; the same per-platform edit is being written three times today (#469 GB203, #502 GB206, #221 GB300).

#3 [high] Blocking (part): drop the flare-cli hunk — it regresses Orbit placement for the tested card

flare-cli/src/orbit/gpu.rs:319-321 (the PR's 0x2d04 | ... => Some("gb206") arm) makes the Orbit agent report gb206 for a GB206 host, but Orbit's placement requirement for a core is still derived from compute capability: controller.rs:2293-2294 revision: super::gpu::capability_revision(first.architecture[0], first.architecture[1]), and gpu.rs:224-231 maps capability (12,0) — what every GB206 part reports — to "gb202". plan.rs:695-696 then compares the two strings exactly and returns "gpu N <name> is gb206, not gb202".

So on the card the PR was tested on (RTX 5060 Ti, cc 12.0), every core prepared on it requires gb202 while its own host now reports gb206: no core places through Orbit after this PR, where before the PR both sides said gb202 and placement worked. Nothing in the diff touches controller.rs/plan.rs.

Delete the 3 lines (3 of the change's 18 added). Nothing is lost for the stated purpose: the crash the description cites is heliopause/src/export/capture.rs:2079-2085, which reads only helios's platform_from_pci; it never consults Orbit's copy. Orbit keeps its capability fallback (gpu.rs:297-307 → gb202), placement keeps working, and gb206 naming/export/hub-revision detection is unaffected.

If Orbit is meant to report gb206, that needs the placement change (a core's requirement taken from its signed device identity) which open PR #469 carries for GB203 together with the removal of this private table; it does not belong in a 3-line crash fix.

#5 [high] Should fix: PLATFORMS +1 leaves flare/src/catalog.rs:561-563 stale and CI red (0 lines, easier: derive)

Adding "gb206" to PLATFORMS (helios/src/core/naming.rs:15, now len 5) leaves flare/src/catalog.rs:561-563 stale, and the PR touches no test outside helios. That fixture is hardcoded to {"name":"ga102-tp1"}, {"name":"gb10-tp1"}, {"name":"gb202"}, {"name":"gb300-tp8"} inside a loop for target in PLATFORMS (550-568); for target = "gb206", apply_refs sets build_target_match = Some(false) (catalog.rs:319-322: hardware is in PLATFORMS and the branch set is non-empty but lacks the target) and line 566 asserts Some(true), so published_build_match_uses_all_platform_branches fails. .github/workflows/native-serving.yml:77 runs cargo test --locked --release --manifest-path flare/Cargo.toml, so this is a red CI on the head commit (no checks were reported there). #300 had to edit this same fixture for ga102 and #469 for gb203.

Smaller fix than another hand-added branch name (0 net lines, removes the recurring edit):

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

Independently of that, platform_from_pci(0x2d04_10de) should be asserted literally beside the loop (the #221/#469 reviews asked for the same on their platforms): the loop proves the table agrees with itself, not that the table holds the id the description claims.

#9 [high] Research summary

Reviewed PR #502 (+18/−1, two files) through the subtraction lens against the charter, PR #469 (the open GB203 twin), and every caller of the touched functions. Seven findings saved to the scratchpad, ranked by lines saved.

Headline: the helios half is genuinely required — platform_from_pci returning None is a hard error in heliopause/src/export/capture.rs:2079-2085 and flare/src/hardware.rs:95-100, so one table row fixes the crash the description cites. The flare-cli half is not: those 3 added lines only extend a hand-maintained copy of the table that helios/src/core/naming.rs:17-20 forbids, and they make Orbit report gb206 while controller.rs:2293-2294 still derives a core's requirement from compute capability (gb202), so plan.rs:695 refuses to place any core on the card the PR was tested on (blocking for the hunk). It also makes flare run ORG/MODEL request a nonexistent gb206 branch (controller.rs:2210-2233) and makes mixed GB202/GB206 fleets unable to infer a revision.

The rest is subtraction of repetition: the new 7-line test loop is the fourth copy of one assertion (~23 lines saveable), the new const array + if-arm belong in a single (platform, ids) table (~13 lines, and it is the third such per-platform edit in flight: #469, #221, this one), PLATFORMS' new entry leaves flare/src/catalog.rs:561-563 stale and cargo test --manifest-path flare/Cargo.toml (not opened) red in CI (derive the fixture instead of adding another branch), and eleven code/doc sites still enumerate the platform set and should name the table instead of listing names. Two cosmetic tokens also break the file's formatting. Net: the change's own 18 added lines can be about 5, and replaces-with-removal could take ~39 pre-existing lines with them.

#10 [high] Ledger: where the 18 added lines go, what can go, and total savings

PR #502, 2 files, +18/−1 (flare-cli/src/orbit/gpu.rs +3/−0, helios/src/core/naming.rs +15/−1). Accounting of the added lines:

added site verdict
1 (replacing 1) naming.rs:15 PLATFORMS "gb206" must stay — one word; but has an external cost (catalog fixture, 11 stale enumerations)
4 naming.rs:25-27 new GB206_DEVICES const replaceable by a row in one table (−4 as written, −13 over the whole family)
3 naming.rs:53-55 new if-arm same
7 naming.rs:203-209 new test loop 4th copy of one assertion (~−23 over the whole test)
3 flare-cli gpu.rs:319-321 delete entirely (blocking; see entries 1, 3, 8)

Ranked subtractions, lines saved:

  1. Delete flare-cli's private table (16 lines) + the 3 added lines = ~19 saved — entry 1, blocking in part via entry 3.
  2. One loop over the platform table in the naming test = ~23 saved (net ~−19 counting the 7 added) — entry 4.
  3. One (platform, ids) table replacing 5 consts + 4 if-arms = ~13 saved — entry 2.
  4. Stop enumerating platforms at 11 code/doc sites (no net lines today; it is the edit that #469 had to make in 6 files and this PR in none) — entry 6.
  5. catalog.rs:561-563 fixture derived from PLATFORMS, 0 net lines, removes the recurring edit that makes CI red — entry 5.
  6. Two formatting tokens, 0 lines — entry 7.

Totals: the change's own 18 added lines could be ~5 (one word in PLATFORMS, one table row, one generic test loop). Pre-existing lines removed by the same smaller version: gpu.rs:309-324 (16) plus naming.rs:21-57 (37→~24) plus naming.rs:186-216 (29→~6) ≈ 52 old lines replaced by ~30, i.e. ~+22 removed on top of the change's −13 added-line saving ≈ −35 net for the tree. Stated conservatively in the report as "~39 lines removed, about 5 added".

Nothing found for subtraction in: heliopause/src/export/capture.rs:2079-2085 (reads the shared table, unchanged), flare/src/hardware.rs:18-21 and 95-100 (unchanged, already delegates), flare/src/catalog.rs:271-280 branch_platform (already table-driven), naming.rs PLATFORMS consumers in flare-cli/src/distribution.rs:159/720, flare/src/hub.rs:2473/2490/2963/3115 (all table-driven, need no edit).

#11 [high] Necessary part: what must stay in this PR and why (charter grounding)

The report must say plainly which part is already minimal, so the review is not read as asking for a rewrite:

Required: helios/src/core/naming.rs — one PCI id (or the nine) resolving to a platform name. platform_from_pci returns None for unlisted devices, and that None is turned into a hard error in three consumers: heliopause/src/export/capture.rs:2079-2085 (NVML reports unsupported GPU PCI id) — the ignition crash the description cites; flare/src/hardware.rs:95-100 (unsupported PCI ID ...; specify --revision); and, indirectly, the hub revision a download requests. So the smallest fix really is: ids in the table + name in PLATFORMS. 5 lines.

Not required: the flare-cli/src/orbit/gpu.rs arm. Orbit never calls platform_from_pci; it has its own table (gpu.rs:309-324) whose None falls through to capability_revision (gpu.rs:224-231), which already answers gb202 for these cards with no crash. Nothing in the description's evidence (export/serve on a 5060 Ti) goes through it.

Charter grounding (read_charter): "Solve the right problem in the right place ... Look for the smallest footprint in shared code, or a way to solve it without new code at all." And under How We Work: "We're not interested in piling on extra model aliases, random switches, or broad hardware support"; Non-goals include "Broad production coverage across arbitrary models, GPUs". That is why the nine speculative ids (eight untested, sourced from pci.ids, per the description's own "Untested configurations" line) and the second copy of them are the parts to cut, while one id for the card actually tested would satisfy the stated benefit. Also note the description's claim "helios/src/core/naming.rs ... the single source ... do not duplicate" is contradicted by adding the same 9 ids to flare-cli.

#4 [medium] Should fix: the new PCI test loop is the fourth copy; one loop over the table (~23 lines)

helios/src/core/naming.rs:186-216 now holds four near-identical per-platform loops in pci_ids_select_the_platform_identifier: an inline literal list for GB10 (188-194, duplicating GB10_DEVICES at line 30), a literal 0x31c3_10de for GB300 (195, duplicating GB300_DEVICES at 37), and the loops over GB202_DEVICES (196-202), GB206_DEVICES (203-209, added by this PR) and GA102_DEVICES (210-216). 29 lines for one assertion repeated per platform; the PR adds 7 of them and each future platform (#469 GB203, #221 GB300) adds 7 more.

Smaller version (~6 lines, about 23 saved), and it stops the test from carrying its own copies of the tables:

for (platform, devices) in DEVICES {
    for device in devices {
        assert_eq!(platform_from_pci(device << 16 | 0x10de), Some(platform), "{device:#06x}");
    }
}

If the DEVICES table from the other finding is not adopted, the same shape with an explicit list of the five consts ([(&GB10_DEVICES[..], "gb10"), (&GB300_DEVICES[..], "gb300"), (&GA102_DEVICES[..], "ga102"), (&GB206_DEVICES[..], "gb206"), (&GB202_DEVICES[..], "gb202")]) saves ~19 and at least removes the two literal copies that can drift from the consts.

Nothing lost: the vendor-mask and negative cases stay in the asserts at 217-223, and every id currently asserted is still asserted through the loop.

#6 [medium] Should fix: naming.rs:15 is not the only platform list — 11 stale enumerations, delete them rather than edit them

The change adds a fifth platform name but updates none of the ~11 places that enumerate the platform set, so all of them become wrong at once. This is the duplication that made the omission easy; deleting the enumerations (naming the source instead) is smaller than maintaining them.

Code doc comments:

Docs:

Smaller version: each of these says "a PLATFORMS name" / "the detected platform" instead of listing names, so the list lives only in naming.rs:15 — the same list #469 had to touch in six files, and this PR in none. Note also docs/cli-design.md:891-892 promises "An unknown identifier ... requires an explicit revision"; after this PR a GB206 host resolves gb206, and no repository publishes a gb206 branch, so flare run ORG/MODEL fails with a missing-revision error where the actionable message was. That belongs in the description (as #469's review required) rather than as a silent fallback.

#8 [medium] Supplement: orbit's gpu.revision is the Hub revision — the hunk makes GB206 nodes request a nonexistent branch

Two more consequences of the flare-cli/src/orbit/gpu.rs:319-321 hunk, both from gpu.revision being consumed as the Hub revision, not just displayed:

  1. controller.rs:2210-2233 repository_revision infers ORG/MODEL@<revision> from the candidate nodes' gpu.revision values (.map(|gpu| gpu.revision.as_str()), line 2224). With the hunk, flare run ORG/MODEL on a GB206 node requests a gb206 branch no repository publishes — the same merge-order caveat #469's review required the author to state.
  2. A fleet with both GB202 and GB206 nodes hits revisions.len() > 1 (controller.rs:2229-2231) and errors "candidate GPUs do not identify one hardware revision", where before the PR every node reported gb202 and inference succeeded.

Both disappear with the hunk; only the helios table is needed for the cited crash (heliopause/src/export/capture.rs:2079-2085) and for flare's own detection (flare/src/hardware.rs:95-100 turns an unknown id into "unsupported PCI ID ...; specify --revision"). The hunk also has no test: gpu.rs tests at 352-367 cover neither 0x2d04 nor any GB206 id.

#7 [low] Nit: naming.rs:15 missing space after comma, :54 missing semicolon

helios/src/core/naming.rs:15 — pub const PLATFORMS: [&str; 5] = ["ga102", "gb10", "gb202","gb206", "gb300"]; is missing the space after the comma before "gb206"; every other separator in the file is , .

helios/src/core/naming.rs:54 — return Some("gb206") has no terminating semicolon, while the sibling arm at line 51 is return Some("ga102");. It compiles (! coerces in an if statement position) but differs from the file's formatting; rustfmt rewrites both lines.

0 lines saved; no cargo fmt job exists in .github/workflows (only helios-lifecycle.yml, native-serving.yml, release.yml), so this is cosmetic.