Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,10 @@ jobs:
if: needs.changes.outputs.rust == 'true'
run: cargo xtask check-crate-edges

- name: Published Doctor catalog is current
if: needs.changes.outputs.rust == 'true'
run: cargo xtask catalog --check

# Surface the cache hit rate for the clippy compile so the effect is visible
# in the logs, on the local-only path too — see build-and-test for why this
# is gated on sccache being present rather than on the remote backend being
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ repos:
pass_filenames: false
stages: [pre-commit]
groups: [local-tools] # compiles xtask; CI covers it in the `clippy` job
- id: cargo-catalog
name: Published Doctor catalog is current
# The catalog the CLI ships and the file tools read have to be the same
# thing. Write form, like cargo-manifest: prek fails the commit when a
# hook rewrites a file, so a stale catalog is refreshed and re-staged
# rather than merely reported.
entry: cargo xtask catalog
language: system
files: '^(crates/rocm-core/src/fix\.rs|xtask/.*|doctor-catalog\.json)$'
pass_filenames: false
stages: [pre-commit]
groups: [local-tools] # compiles xtask; CI covers it in the `clippy` job
- id: cargo-tpn
name: THIRD_PARTY_NOTICES.txt is current
# `--if-available` skips cleanly when cargo-about is absent or not the
Expand Down
30 changes: 27 additions & 3 deletions apps/rocm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ enum Command {
/// For fix-9-igpu-dgpu: the discrete GPU index to pin.
#[arg(long)]
device_index: Option<i64>,
/// Emit the catalog as JSON for tooling. Only valid without a fix id.
#[arg(long)]
json: bool,
},
/// Print the rocm-cli version, release tag or branch, and commit hash,
/// plus the ROCm SDK and GPU driver this machine would use.
Expand Down Expand Up @@ -2135,7 +2138,8 @@ fn dispatch(cli: Cli) -> Result<()> {
yes,
dry_run,
device_index,
}) => fix(fix_id, yes, dry_run, device_index),
json,
}) => fix(fix_id, yes, dry_run, device_index, json),
Some(Command::Version) => version(),
Some(Command::Setup { command }) => setup(command),
Some(Command::EngineServeHttp {
Expand Down Expand Up @@ -3243,11 +3247,30 @@ fn show_prepared_report(
}
}

fn fix(fix_id: Option<String>, yes: bool, dry_run: bool, device_index: Option<i64>) -> Result<()> {
fn fix(
fix_id: Option<String>,
yes: bool,
dry_run: bool,
device_index: Option<i64>,
json: bool,
) -> Result<()> {
let Some(fix_id) = fix_id else {
print!("{}", rocm_core::list_fix_recipes());
if json {
print!("{}", rocm_core::catalog_manifest_json()?);
} else {
print!("{}", rocm_core::list_fix_recipes());
}
return Ok(());
};
// Refused rather than ignored. "Apply this fix, as JSON" has no meaning, and
// quietly dropping the flag would let a caller believe it had asked for
// machine-readable output and got it.
if json {
anyhow::bail!(
"`--json` describes the whole catalog, so it cannot be combined with a fix id. \
Run `rocm fix --json` to read the catalog, or `rocm fix {fix_id}` to apply this fix."
);
}
let opts = rocm_core::FixOptions {
yes,
dry_run,
Expand Down Expand Up @@ -22974,6 +22997,7 @@ mod tests {
yes: true,
dry_run: false,
device_index: None,
json: false,
}),
};
let result = super::dispatch(cli);
Expand Down
Loading
Loading