Skip to content

feat(rocprofiler-sdk): add rocprofv3-doctor agent skill - #12895

Merged
bgopesh merged 2 commits into
developfrom
users/bgopesh/rocprofv3-doctor-skill
Oct 17, 2026
Merged

bgopesh merged 2 commits into
developfrom
users/bgopesh/rocprofv3-doctor-skill

Conversation

@bgopesh

@bgopesh bgopesh commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Adds a rocprofv3-doctor agent skill that teaches AI coding agents to work out why rocprofv3 does not work on a machine. The agent runs rocprofv3 --doctor, finds the root causes in its report, and gives the user an ordered list of fixes. Like the rocprofv3 skill in #12814, it is meant to be pulled into the amd/skills catalog from this repo.

The two skills split the work. rocprofv3 covers profiling once the setup works. rocprofv3-doctor covers what to do when rocprofv3 fails, crashes, finds no GPU, or will not start.

Stacked on #12889, which adds the rocprofv3 --doctor option this skill runs. This PR's base is that branch; it will be retargeted to develop once #12889 merges, and should not merge before it.

Technical Details

New folder projects/rocprofiler-sdk/skills/rocprofv3-doctor/, in the same layout as skills/rocprofv3/ from #12814:

  • SKILL.md:

    • finds rocprofv3 --doctor: on PATH, under ROCm and TheRock prefixes, or from a source checkout's rocprofv3.py for ROCm releases whose rocprofv3 rejects the option
    • runs it as the user who runs rocprofv3, never with sudo
    • runs it with JSON output and reads the exit codes
    • presents ordered fixes, with these rules:
      • act on likely causes; for possible ones, propose the step that tells causes apart
      • never run sudo, usermod, sysctl, package managers, or pip on the user's behalf
      • never add remediations the report does not give; in particular, no perf_event_paranoid changes and no setcap on the rocprofv3 Python script
    • Its description routes plain profiling questions to the rocprofv3 skill.
  • scripts/summarize_report.py: turns the doctor's JSON report (schema_version 1) into a markdown triage. It lists:

    • root causes, failures first, each with the checks it blocked
    • diagnoses, with their confidence and evidence
    • doctor errors, kept apart from findings about the system
    • what the run did not verify

    It uses only the Python standard library, and on input it cannot read it exits 2 with a message instead of a traceback.

  • tests/test_summarize_report.py: unit tests that need no GPU.

  • evals/evals.json:

    • 5 should-trigger cases, 2 of them graded on behavior: a readiness check, and a pasted HSA_STATUS_ERROR_OUT_OF_RESOURCES error that must be corroborated before a cause is named
    • 3 should-not cases: profiling hot kernels and choosing counters (the rocprofv3 skill's job), and a PyTorch profiler trace
  • evals/machine.yml: os: [Linux], labels: [gpu, rocm].

  • skill-card.md.

Issue Tracking

JIRA ID:

Test Plan

  • Ran the skill's unit tests with Python 3.8 and 3.10.
  • Ran the skill's steps against rocprofv3: add rocprofv3 --doctor self-diagnostic option #12889 on a ROCm 6.2.0 machine: the installed rocprofv3 rejects --doctor as the skill expects, the source-checkout fallback runs, and the script summarizes the real report.
  • Ran amd/skills structural validation: skillscope structural v0.1.2, the version and arguments its check.sh uses, with the skill copied into a catalog checkout.
  • Confirmed that the same validation rejects a deliberately broken dataset.
  • Ran black.

Test Result

  • 11 unit tests pass on both Python versions, and black is clean.
  • The script folds skipped checks into their root causes and separates informational findings.
  • Catalog structural checks pass: 11 skill folders and 85 cases in shape.
  • Routing and behavioral evals (skillscope routing / behavioral) have not been run yet; they need the claude CLI and a ROCm machine.

Submission Checklist

🤖 Generated with Claude Code

@bgopesh
bgopesh requested review from a team as code owners October 6, 2026 10:44
@bgopesh
bgopesh added this pull request to stack #12896 October 6, 2026 10:45
@bgopesh
bgopesh marked this pull request as draft October 6, 2026 10:45
@therock-pr-bot

therock-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@bgopesh
bgopesh marked this pull request as ready for review October 7, 2026 08:25
Copilot AI balanced review requested due to automatic review settings October 7, 2026 08:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The summary can omit unverified checks, and the workflow may retain --version, preventing diagnostics from running.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds an agent skill for diagnosing rocprofv3 setup failures using rocprofv3 --doctor.

Changes:

  • Adds diagnostic workflow guidance and safety constraints.
  • Adds JSON-to-Markdown report summarization with unit tests.
  • Adds routing/behavior evaluations and catalog metadata.
File Description
SKILL.md Defines the diagnostic workflow and remediation rules.
scripts/​summarize_report.py Summarizes doctor JSON reports.
tests/​test_summarize_report.py Tests report summarization.
evals/​evals.json Defines routing and behavioral evaluations.
evals/​machine.yml Specifies evaluation machine requirements.
skill-card.md Provides catalog metadata.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bgopesh
bgopesh force-pushed the users/bgopesh/rocprofv3-doctor-skill branch from 8b3ead4 to 1e79425 Compare October 13, 2026 07:41

@venkat1361 venkat1361 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

overall lgtm

@bgopesh
bgopesh force-pushed the users/bgopesh/rocprofv3-doctor-skill branch from 1e79425 to 54d9636 Compare October 17, 2026 05:27
Base automatically changed from users/bgopesh/rocprofv3-doctor to develop October 17, 2026 13:58
bgopesh and others added 2 commits October 17, 2026 19:29
Adds a `rocprofv3-doctor` agent skill that teaches AI coding agents to
diagnose why rocprofv3 does not work on a machine: run rocprofv3-doctor,
find the root causes in its report, and give the user ordered fixes. It
sits beside the rocprofv3 skill, which covers profiling a working setup,
and follows the same layout so the amd/skills catalog can import it.

New folder projects/rocprofiler-sdk/skills/rocprofv3-doctor/:

  - SKILL.md: locate the tool (PATH, rocprofv3 --doctor, ROCm and
    TheRock prefixes, or a source checkout for older ROCm), run it with
    JSON output, read exit codes, apply diagnosis confidence, and present
    fixes without running privileged commands or adding remediations the
    report does not give.
  - scripts/summarize_report.py: turns the JSON report into a markdown
    triage -- root causes with the checks they block, diagnoses with
    confidence and evidence, doctor errors kept apart from system
    findings, and what the run did not verify. Standard library only.
  - tests/: GPU-free unit tests for the script.
  - evals/evals.json: 5 should-trigger cases (2 graded on behavior) and
    3 should-not cases that belong to the rocprofv3 skill or elsewhere;
    evals/machine.yml.
  - skill-card.md.

Depends on rocprofv3-doctor itself, added in the PR this one is stacked
on.

Co-Authored-By: Claude <noreply@anthropic.com>
The tool no longer installs a separate `rocprofv3-doctor` command
(#12889): `rocprofv3 --doctor` is the only entry point.

  - SKILL.md finds and runs `rocprofv3 --doctor`, from PATH, a ROCm
    prefix, or a source checkout's rocprofv3.py for ROCm releases whose
    rocprofv3 rejects the option, and uses that command throughout.
  - It tells the agent to run the check as the user who runs rocprofv3,
    never with sudo, matching the tool's new run-as-user warning.
  - summarize_report.py, its tests, the skill card, and the evals use the
    new command; the behavior-graded evals also require `--doctor` in the
    logs and treat running the check as root as a mistake.

The skill keeps its name, rocprofv3-doctor, until the flag's name is
settled.

Co-Authored-By: Claude <noreply@anthropic.com>
@bgopesh
bgopesh force-pushed the users/bgopesh/rocprofv3-doctor-skill branch from 54d9636 to 2dc2353 Compare October 17, 2026 13:59
@bgopesh
bgopesh merged commit b679bae into develop Oct 17, 2026
131 of 135 checks passed
@bgopesh
bgopesh deleted the users/bgopesh/rocprofv3-doctor-skill branch October 17, 2026 18:00
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants