ut-refactor-review
Skill121 starsChanged 5 months agoApache-2.0View on GitHub
Review PyTorch upstream unit-test (UT) PRs that enable Intel GPU (XPU) on existing tests. Use when reviewing PRs under test/ that port device-generic tests to XPU, add allow_xpu=True, generalize CUDA-hardcoded tests, or add XPU skips/xfails/tolerance overrides in OpInfo.
In this repository28 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- asm-source-mappingSkill
- at-dispatch-v2Skill
- auto-labelSkill
- extract-asm-onednnSkill
- extract-asm-syclkernel-aotSkill
- extract-asm-syclkernel-jitSkill
- extract-asm-tritonSkill
- extract-xpu-kernel-asmSkill
- fix-implementSkill
- fix-reproduceSkill
- fix-root-causeSkill
- fix-verifySkill
- issue-handlerSkill
- issue-triageSkill
- label-issueSkill
- oob-perf-analysisSkill
- pr-reviewSkill
- release-branchingSkill
- skill-writerSkill
- ut-checkSkill
- ut-issue-authoringSkill
- xpu-alignmentSkill
- xpu-build-pytorchSkill
- xpu-ci-health-checkSkill
- xpu-ops-pr-creationSkill
- xpu-release-notesSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Use this skill (instead of the generic pr-review skill in pytorch/pytorch) when the diff is predominantly:
- Very specific: line 26
If the PR also changes operator kernels or native_functions.yaml, hand those files to the pr-review skill and apply this skill only to the …
- Distinctive: line 34
If invoked with no arguments, do not review.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
XPU UT Refactor Review Skill
Review PyTorch (pytorch/pytorch) pull requests that enable XPU on existing
upstream unit tests. These PRs almost never add new operator logic; they make
existing tests device-agnostic and opt XPU into them. The review must focus on
what CI cannot check: whether the generalization preserves the original test
intent, whether device gating is precise, and whether every skip/xfail is
justified and traceable.
Scope: when this skill applies
Use this skill (instead of the generic pr-review
skill in pytorch/pytorch) when the diff is predominantly:
test/**changes that swap CUDA-hardcoded constructs for device-generic onesinstantiate_device_type_tests(..., allow_xpu=True)additionsonlyAccelerator/onlyNativeDeviceTypesAnd([...])decorator migrations- XPU entries in OpInfo (
common_methods_invocations.py,opinfo/definitions/*):DecorateInfo(... device_type='xpu' ...),toleranceOverride, skips, xfails - New
TestXxxDeviceclasses split out from a device-agnosticTestXxx
If the PR also changes operator kernels or native_functions.yaml, hand those
files to the pr-review
skill and apply this skill only to the test files.
Usage Modes
No Argument
If invoked with no arguments, do not review. Ask:
What would you like me to review?
- A PR number or URL (e.g.,
159118or the full PR URL)- A local branch
PR Mode
/ut-refactor-review 159118
/ut-refactor-review https://github.com/pytorch/pytorch/pull/159118
/ut-refactor-review 159118 detailedObtain the PR title, description, diff, changed-file list, and existing review
comments before reviewing. If the command does not name a repo, default to
fetching the PR from pytorch/pytorch.
Suggested fetch commands (CLI environments with gh):
gh pr view <PR_NUMBER> --repo pytorch/pytorch --json title,body,author,baseRefName,headRefName,files,additions,deletions,commits
gh pr diff <PR_NUMBER> --repo pytorch/pytorch
gh pr view <PR_NUMBER> --repo pytorch/pytorch --json comments,reviewsLocal Branch Mode
/ut-refactor-review branch
/ut-refactor-review branch detailedReview the current branch's changes relative to main (diff, commit log, and
changed-file list). Use the branch name in the review header instead of a PR
number.
Review Philosophy
Go through every changed line against
references/xpu-ut-review-checklist.md.
For anything this skill does not address, defer to the
pr-review
skill in pytorch/pytorch.
Files to Reference
- references/xpu-ut-review-checklist.md — the line-by-line checklist
torch/testing/_internal/common_device_type.py—instantiate_device_type_tests,onlyAccelerator,allow_xpu,only_fortorch/testing/_internal/common_utils.py—TEST_XPU,TEST_CUDA,TEST_HPU,xfailIf,HardwareClassificationtorch/testing/_internal/common_methods_invocations.py,torch/testing/_internal/opinfo/definitions/*— OpInfoDecorateInfo,toleranceOverride
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

