Skip to content

[experimental] Ask copilot to check perf profile degradation #146271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 30, 2025

Conversation

mtrofin
Copy link
Member

@mtrofin mtrofin commented Jun 29, 2025

We can optionally add copilot as a reviewer. As per documentation, we can customize the review. This PR asks it to pay attention to the kind of code that might corrupt performance data, or, in the case of sample profiling, result in poor profiles by dropping debug info.

We can optionally add copilot as a reviewer. As per
[documentation](https://docs.github.com/en/copilot/how-tos/agents/copilot-code-review/using-copilot-code-review#customizing-copilots-reviews-with-custom-instructions),
we can customize the review. This PR asks it to pay attention to the
kind of code that might corrupt performance data, or, in the case of
sampel profiling, result in poor profiles by dropping debug info.
@mtrofin mtrofin requested a review from Copilot June 29, 2025 15:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces custom instructions for Copilot to focus on performance profile integrity and debug information when reviewing code changes.

  • Adds guidance to the Copilot instructions file to watch for control-flow modifications that may corrupt profiling or debug data.
  • Emphasizes checking for invalid debug information on branches and calls.
Comments suppressed due to low confidence (1)

.github/copilot-instructions.md:1

  • [nitpick] The phrase 'modifying a function control flow' is ambiguous; consider rephrasing to 'modifying a function's control flow' for greater clarity.
When performing a code review, pay close attention to code modifying a function

@mtrofin
Copy link
Member Author

mtrofin commented Jun 29, 2025

Note to reviewers: I didn't want to make the prompt too stuffy, in some local experiments, something this short ended up being reasonably good. I'd rather get going, start experimenting with this for a while by selectively adding it to PRs and seeing what mileage we get, and we can wordsmith it if needed.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

(It looks like you meant to request reviewers rather than assign people to the PR?)

This seems reasonable enough to me. This does seem a bit specific to one specific problem though. I'm hoping Copilot is good enough to ignore these instructions when analyzing changes that don't modify function control flow?

@mtrofin
Copy link
Member Author

mtrofin commented Jun 30, 2025

(It looks like you meant to request reviewers rather than assign people to the PR?)

Ugh. yes, fixed.

This seems reasonable enough to me. This does seem a bit specific to one specific problem though. I'm hoping Copilot is good enough to ignore these instructions when analyzing changes that don't modify function control flow?

That's what I'm reading from the example in the documentation, yes - I'm guessing whatever we place in this file is appended to a base prompt. Let's see.

@@ -0,0 +1,4 @@
When performing a code review, pay close attention to code modifying a function
Copy link
Contributor

Choose a reason for hiding this comment

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

s/function/function's?

@mtrofin
Copy link
Member Author

mtrofin commented Jun 30, 2025

I'll land it, and if folks don't mind trying to ask copilot to review on various PRs they see - let's get a feel for its usefulness?

@mtrofin mtrofin merged commit 425359a into llvm:main Jun 30, 2025
7 checks passed
@mtrofin mtrofin deleted the review branch June 30, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants