Improve JIT false-positive review guidance - #131673
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 15 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
Updates the JIT folder-specific review guidance (.github/instructions/jit.instructions.md) to document common AI/automated-review false positives and provide phase/invariant-focused review hygiene for src/coreclr/jit/** changes.
Changes:
- Adds a new “Common false-positive review mistakes” section with targeted bullets covering
varType*contracts, common rewrite patterns, and flag semantics. - Adds review-hygiene guardrails emphasizing phase/invariant context and avoiding re-raising already-resolved by-design discussions.
Show a summary per file
| File | Description |
|---|---|
| .github/instructions/jit.instructions.md | Adds a consolidated list of common JIT review false positives and review-hygiene guidance for AI-assisted reviews. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
Expand .github/instructions/jit.instructions.md with concise, actionable guardrails to reduce common AI review false positives in core JIT areas. Highlights include: - clarifying TYP_I_IMPL/TYP_U_IMPL alias behavior and varType predicate expectations, - documenting intentional phase- and contract-driven patterns (retype-to-void rewrites, late expansion temps, caller-proved lowering preconditions, spill flag semantics), - adding review hygiene guidance to avoid re-raising by-design points without new evidence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
b51a2d7 to
89d3baf
Compare
There was a problem hiding this comment.
Copilot's findings
Suppressed comments (2)
.github/instructions/jit.instructions.md:15
- The guidance around
TYP_I_IMPL/TYP_U_IMPLrisks discouraging a valid review point: on 64-bit,TYP_I_IMPLexpands toTYP_LONG, sovarTypeIsInt(TYP_I_IMPL)is supposed to be false (32-bit-only). It would be clearer to spell out the target-dependent macro expansion and explicitly point reviewers tovarTypeIsI/varTypeIsIntOrIwhen the intent is “native int”.
- **`TYP_I_IMPL`/`TYP_U_IMPL` are aliases, not distinct types.** Do not claim `varTypeIsLong`/`varTypeIsInt` "miss" them.
- **`varTypeIsLong` is width-based.** It is not "C# `long` only."
- **Read `varType*` helpers by contract, not name.** Check `vartype.h` and target guards first.
.github/instructions/jit.instructions.md:25
- The example
new (compiler/allocator)isn’t a pattern that exists literally in the JIT codebase; the common forms arenew (compiler, CMK_*)and sometimesnew (compiler->getAllocator(...)). Using one of those here would make the guidance easier to map to real code.
- **JIT allocation is often arena-based.** Placement `new (compiler/allocator)` without `delete` is usually expected.
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Are these truly common mistakes made by the AI? I haven't noticed any of the listed myself. I assumed that when you correct an AI's mistake, it would store that correction as a shared memory for all contributors. Is that not the case? I do see such actions in the log my Copilot CLI time to time. My main concern is duplicating documentation or including facts that might become outdated or simply redundant, which just consumes extra tokens. Should we consider adjusting our approach based on actual evidence of recorded mistakes? |
I've hit many of these, especially the I have personal instructions for several of these, but that doesn't help the code review or cloud agent skills that aren't run locally.
While some preferences can be stored and shared, these can themselves quickly get out of date and eat up even more tokens or confuse the model. The current runtime set has around 100 and they aren't really well sorted and many even look suboptimal at a glance: https://github.com/dotnet/runtime/settings/copilot/memory Explicit instructions are a stronger and better signal.
AI cannot and should not be pulling in complex documentation every time, that's a much larger waste of tokens and more likely to get it "off" because it kills the context window. We really want a short and succinct list, which may get out of date and need to be updated over time. It's infra, just like other parts of the codebase, and so we'll need to recheck instructions, skills, agents, and more when new models come out and older ones go away to clean things up. |
Pretty sure such a large and popular OSS exists in pre-train so it doesn't even have to. I am not against common pitfalls listed in a skill, just personally never hit any of them, e.g
Right, hence, I asked for an evidence of non-local copilot mistakes. Anyway, pinging the rest of the jit team if they hit any of those @dotnet/jit-contrib PS: I personally try to remove as much noise (unrelated skills, mcp, general instructions) as I can while this change adds +1k tokens to the general context for any jit change if I understand it correctly. |
Being trained on it doesn't mean that there is enough weight/signal left after the model is made production ready. Most of it gets lost in the overall noise, which is why it still trivially gets things wrong without explicit instructions.
Here's an example of the There's another draft PR I have up where it hits the I'm happy to remove any of these if we don't think its enough value, but these are ones that I've seen getting hit and which the models themselves are calling out as points of confusion/contention, causing excess tokens or general failure to get it right. |
|
I've seen confusion on TYP_I_IMPL and (on Wasm) confusion about having a 32 bit target support TYP_LONG. But none of those others that I can recall. One other issue I've seen a few times now:
|
Yep, I've seen confusion about phase ordering as well. We should probably point to the function that calls all phases in order.
Ok, I suggest we continue adding items to the list based on real evidence (links to bad reviews, screenshots of bad local behavior, or issues confirmed by multiple people on the team). I'd like to avoid potentially vibe-driven changes (not saying yours are) to the various prompt files, as I think a big chunk of our skills and that general review skills fall into that category. |
Summary
Improve .github/instructions/jit.instructions.md with concise, actionable guidance that reduces common AI review false positives in core JIT code.
What this adds
Scope
Instructions-file-only change. No product code changes.
Note
This PR description was generated with AI/Copilot assistance.