Skip to content

feat(hipdnn): add hipdnn-code-quality AI skill#9299

Draft
SamuelReeder wants to merge 1 commit into
developfrom
users/sareeder/hipdnn-code-quality-skill
Draft

feat(hipdnn): add hipdnn-code-quality AI skill#9299
SamuelReeder wants to merge 1 commit into
developfrom
users/sareeder/hipdnn-code-quality-skill

Conversation

@SamuelReeder

Copy link
Copy Markdown
Contributor

Summary

Adds hipdnn-code-quality, a diff-scoped code-quality AI skill for hipDNN under projects/hipdnn/tools/ai/skills/. It is the maintainability-axis companion to the existing hipdnn-review skill: same change-set scope and target resolution, but focused purely on duplication, shared-helper reuse, design patterns, performance hygiene, readability, comment complexity, file size, and naming — the concerns hipdnn-review deliberately deprioritizes. The skill is registered in the project AI-rules list. JIRA ID : ALMIOPEN-2304

Risk Assessment

Minimal risk. Documentation/tooling-only: adds a skill package (SKILL.md, agents metadata, a helper script) and one AI-rules list entry. No product code, build configuration, public API, schema, or existing skill is modified; the skill is inert until invoked.

Testing Summary

  • Skill packaging validated by the repo's own validator (validate-skills.py), which checks required agents/openai.yaml fields, forbidden host-specific text, and command frontmatter.
  • Helper script static + behavioral checks: Python compiles clean; runs end-to-end against origin/develop on this skill-only branch (0 source signals, as expected) and against a real 20-file C++ diff worktree (reports large files, long functions, duplicated regions).
  • Detectors were developed and validated against the real hipDNN tree, with a false positive or bug found and fixed in each (include-block duplication excluded, Allman-brace/namespace-aware long-function detection, no repo-wide naming rule since the frontend intentionally mirrors cuDNN snake_case).

Testing Checklist

  • Skill packaging validation - python3 tools/ai/validate-skills.py - Status: Passed (10 skills)
  • Helper script compiles - python3 -m py_compile tools/ai/skills/hipdnn-code-quality/scripts/quality_scan.py - Status: Passed
  • End-to-end run vs develop (skill-only branch) - quality_scan.py --repo . --base origin/develop - Status: Passed
  • End-to-end run on real C++ diff (20 files) - quality_scan.py --repo <worktree> --base origin/develop - Status: Passed
  • PR CI - GitHub PR checks - Status: Pending

Technical Changes

  • Adds tools/ai/skills/hipdnn-code-quality/SKILL.md: quality-only checklist (duplication, shared-helper reuse, design/structure, performance hygiene, readability/naming, file size), Project-Specific Conventions derived from projects/hipdnn/CLAUDE.md (Allman braces, #pragma once, -Wconversion, RAII, TYPED_TEST), and a Tooling Notes section encoding validated caveats (e.g. ast-grep silently skips unparseable hipDNN files).
  • Adds scripts/quality_scan.py: in-harness-only metric pass (no clang-tidy/lizard/cloc) reporting large files, namespace- and Allman-brace-aware long functions, duplicated regions (changed files matched against the whole tree, boilerplate excluded), and a naming-mix hint; supports --base, --files, --json, and tunable thresholds.
  • Adds agents/openai.yaml interface metadata, matching the other skills.
  • Reuses hipdnn-review's scope buckets and severity ladder rather than introducing a second taxonomy; routes any correctness/leak/compat defect it encounters back to hipdnn-review.
  • Registers the skill in the hipDNN AI-rules list (projects/hipdnn/docs/ai-rules.md, surfaced as CLAUDE.md).

Diff-scoped code-quality companion to hipdnn-review focused purely on
maintainability: duplication, shared-helper reuse, design patterns,
performance hygiene, readability, comment complexity, file size, and
naming. Reuses hipdnn-review's scope buckets and severity ladder.

Ships quality_scan.py, an in-harness-only metric pass (no clang-tidy/
lizard/cloc): large files, long functions (namespace- and Allman-brace-
aware), duplicated regions (changed files matched against the whole tree,
boilerplate excluded), and a naming-mix hint. Detectors validated against
the real hipDNN tree. Registers the skill in the project AI-rules list.
@therock-pr-bot

therock-pr-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
JIRA ID : TESTAUTO-6039
JIRA ID - #330
JIRA ID #330
ISSUE ID : TESTUTO-3334
ISSUE ID #3334
ISSUE ID - TESTAUTO-3433
ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
Closes #10
Fixes octo-org/octo-repo#100
Resolves: #123
#123
https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
Forbidden Files ✅ Pass
🧪 Unit Test ❌ Fail Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/hipdnn/tools/ai/skills/hipdnn-code-quality/scripts/quality_scan.py; no test file found
🔎 pre-commit ❌ Fail Error: Check concluded with failure.
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 3 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Title/Description
  • ❌ Unit Test
  • ❌ pre-commit

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

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

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Title/Description
  • ❌ Unit Test

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

❌ Your project status has failed because the head coverage (76.84%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9299      +/-   ##
===========================================
- Coverage    65.36%   65.36%   -0.00%     
===========================================
  Files         2685     2685              
  Lines       422269   422269              
  Branches     62742    62742              
===========================================
- Hits        276012   276009       -3     
- Misses      125466   125469       +3     
  Partials     20791    20791              
Flag Coverage Δ *Carryforward flag
TensileLite 35.07% <ø> (ø) Carriedforward from 9272c48
hipBLAS 90.81% <ø> (ø) Carriedforward from 9272c48
hipBLASLt 34.69% <ø> (ø) Carriedforward from 9272c48
hipCUB 82.68% <ø> (ø) Carriedforward from 9272c48
hipDNN 86.13% <ø> (-0.01%) ⬇️
hipFFT 50.88% <ø> (ø) Carriedforward from 9272c48
hipRAND 76.12% <ø> (ø) Carriedforward from 9272c48
hipSOLVER 69.18% <ø> (ø) Carriedforward from 9272c48
hipSPARSE 86.10% <ø> (ø) Carriedforward from 9272c48
rocBLAS 47.91% <ø> (ø) Carriedforward from 9272c48
rocFFT 55.50% <ø> (ø) Carriedforward from 9272c48
rocRAND 57.02% <ø> (ø) Carriedforward from 9272c48
rocSOLVER 76.84% <ø> (ø) Carriedforward from 9272c48
rocSPARSE 72.37% <ø> (ø) Carriedforward from 9272c48
rocThrust 91.36% <ø> (ø) Carriedforward from 9272c48

*This pull request uses carry forward flags. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants