Repository navigation
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Some new guidance contradicts implementation behavior and could lead to invalid refactors or misleading measurements.
Review effort: Balanced
Findings: 4
Open (4)
What changed in this PR
This documentation-only PR centralizes MIGraphX contributor conventions and clarifies how review tools handle findings.
Changes:
- Documents build, lint, testing, debugging, and GPU development practices.
- Refines review guidance to avoid known false positives.
- Clarifies that review flags cover every finding category.
| File | Description |
|---|---|
AGENTS.md |
Adds contributor workflows and implementation guidance. |
.claude/skills/migraphx-simplify/SKILL.md |
Refines cleanup rules and exceptions. |
.claude/skills/migraphx-code-review/SKILL.md |
Expands review checks and clarifies flag behavior. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| - **No locally-called named lambdas** - A lambda that is only called from the enclosing function (`auto used_outside = [&](...) {...};`) is a function in disguise with hidden captures. Make it a `static` free function with explicit parameters, or inline it at the single call site. Lambdas that are *passed* to an algorithm or callback are fine. | ||
|
|
||
| - **Helpers in headers** - A non-template helper is declared in the header (with the target's export macro, e.g. `MIGRAPHX_GPU_EXPORT`) and implemented in the `.cpp`. Only templates and trivial one-line accessors stay inline; an inline definition pulls its includes into every consumer. |
Comment on lines
+897
to
+898
| - `migraphx-driver time` - One isolated kernel without launch overhead; use it for the | ||
| clean number once `perf` has told you which op to look at |
| - **Kernel packaging**: New GPU kernels must be included in CMake install targets | ||
| - **Build failures**: Check clang-tidy warnings - they're enforced in CI | ||
| - **`reshape` copies at runtime**: `op::reshape` and `flatten` allocate and copy in `compute`; they are not views and have no `output_alias`. The runtime view op is `reshape_lazy`. A pass that inserts a generated view chain (e.g. from `shape_transform_descriptor::generate()`) into a lowered GPU graph must convert `reshape` to `reshape_lazy` and reject chains that cannot alias (see `invert_alias_transforms` in `src/replace_allocate.cpp`); violating this is a GPU VM fault in the kernel writing through the "view". Separately, do not insert `contiguous` before `reshape` — reshape already handles non-standard input layouts. | ||
| - **`squeeze` / `unsqueeze` are not inverses on scalars**: `unsqueeze` returns a rank-1 `{1}` input unchanged, and squeezing all axes clamps to rank-1 `{1}`. To invert a squeeze on an input whose lens are `{1}`, use `multibroadcast` to the reduce lens instead of `unsqueeze`. |
Updated MIGRAPHX_GPU_DUMP_ASM instructions for clarity. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5356 +/- ##
========================================
Coverage 92.71% 92.72%
========================================
Files 635 635
Lines 36203 36203
========================================
+ Hits 33565 33566 +1
+ Misses 2638 2637 -1 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
Guidance that reviewers had given repeatedly in sessions (lint workflow, test
patterns, kernel-header rules, IR gotchas) only existed as per-session memory, so
each new session or contributor rediscovered it. The review skills also had two
gaps:
/migraphx-simplifykept flagging things reviewers had explicitly rejectedas false positives, and
/migraphx-code-review --fix,--comment, and--selectcould be read as acting on correctness findings only, leaving quality,
convention, test-coverage, and precedent findings unapplied and unposted.
Technical Details
AGENTS.mdtools/format.py -i origin/developformats changed lines only(whole-file
clang-formatadds unrelated hunks); trustmakefor thekernel-header → embed → relink chain; run
make -k testsbeforectest.make analyzeand judge by exit code (cppcheck reports asstyle:,clang-tidy emits ANSI escapes between location and severity); rename instead of
NOLINTforreadability-identifier-naming; root.clang-tidyAllowedTypesfor cheap-copy opaque types; never redefine a parent
.clang-tidykey in a childconfig;
#ifndef CPPCHECKinstead ofcppcheck-suppress syntaxError; how toresolve the cppcheck/clang-tidy cast conflict;
#elifdefis C++23.non-template helpers declared in headers and defined in
.cpp, a helper structinstead of 5+ parameter static helpers, static member helpers stay in their
class, 1–3 line comments, no narrow predicates in core headers, explicit JIT
source templates, insert + replace + DCE rather than in-place replace.
TEST_CASE_REGISTER(name<T>)for per-type tests andTEST_CASE_TEMPLATEfor kernel tests, the single-thread kernel harness, no property-based pass
tests, copy the module for no-op pass tests,
-pis appendable and--passesdoes not exist, run only the tests that exercise the change, never modify a
failing test to match output.
MIGRAPHX_DISABLE_PASSES,MIGRAPHX_GPU_DUMP_ASMwithMIGRAPHX_USE_HIPRTC=0,MIGRAPHX_GPU_DEBUG, env vars are memoized, Releasebuilds never fire
assert,driver timevsperf,-b Nfor cold buffers,interleaved A/B with median ratio and no concurrent CPU load.
if constexprbranches, kernel toolkithelpers are kept without callers,
%[name]inline-asm operands, gfx1201 is wave32.reshape/flattencopy at runtime so inserted view chains needreshape_lazy, nocontiguousbeforereshape,squeeze/unsqueezeare notinverses on
{1}, nested sub-matchers needmatch::opaqueto avoid OOM in CI,target knobs go in
backend_optionsnot env vars.origin/develop(HEAD^2on a mergecommit).
.claude/skills/migraphx-simplify/SKILL.mdre-asserted by internal helpers, static member helpers, orphaned kernel toolkit
helpers, branch-pinning test stubs, instantiation-reducing
if constexpr,merged JIT templates,
static_cast<T&&>moves,::valuein tests.std::for_eachmust never become a raw loop,contiguousbeforereshape, pair member access over structured bindings, locally-called namedlambdas, 5+ parameter static helpers, narrow predicates in core headers, inline
non-template helpers in headers.
.claude/skills/migraphx-code-review/SKILL.md--fix,--comment,and
--selectnow state explicitly that they act on every reported finding(
correctness,language-pitfall,api-abi,ir-contract,quality,conventions,test-coverage,precedent). The reuse path acts on the fullearlier list, picker labels carry
[category],--fixhas per-category applyguidance, and
--commentposts non-correctness findings as inline comments too.replace_instruction, nested sub-matcher withoutmatch::opaque, generated view chain inserted asreshapeinstead ofreshape_lazy,unsqueezeused to invert a squeeze on{1}, preconditionsenforced only by
assert.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot ApplicableFollow the LLVM AI Tool Use Policy for contributions using AI.