-
Notifications
You must be signed in to change notification settings - Fork 5k
Add a copilot prompt file for JIT-EE interface modifications #115889
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
base: main
Are you sure you want to change the base?
Conversation
@stephentoub @mrsharm @dotnet/jit-contrib opinions? |
The JIT-VM interface defines the APIs through which the JIT compiler communicates with the runtime (VM). | ||
If the new API signature is not provided, prompt the user for it with `src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt` file as a reference. | ||
|
||
For example, assume the following API signature is provided: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the LLM get "assume" wrong at all?
Would a different wording perhaps be better, such as:
The steps to add the new API signature are given below and use the following API signature as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this seems better given a few times the LLM got confused and used the example as the actual API it needs to add
Sounds cool, LGTM 🙂 |
[add-new-jit-ee-api.prompt.md](../../.github/prompts/add-new-jit-ee-api.prompt.md) contains a prompt that can be used to add a new JIT-VM API through an agent. Example usage in VSCode: | ||
* Open the Copilot Chat Window | ||
* Type "/add-new-jit-ee-api.prompt" and either hit enter and follow the instructions or provide the API signature directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we retain the old information for environments where no agent mode is available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should indeed, I just removed the out-of-date stuff, I can update it
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Insert the new API definition without removing any existing entries, placing it near similar signatures. | ||
|
||
2. Invoke `<repo_root>/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh` script | ||
(or `<repo_root>/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh` on Windows) to update auto-generated files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(or `<repo_root>/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh` on Windows) to update auto-generated files. | |
(or `<repo_root>/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat` on Windows) to update auto-generated files. |
Adding new APIs to the JIT-EE interface is time-consuming and is difficult to automate: 15-16 files need to be updated with a complex (de)serialization logic in SPMI. So far, we’ve managed to automate generation for only 7 of those files; the rest still require manual edits. This prompt file (see Prompt Files feature) is designed to help with it. The typical workflow looks like this:
/add-new-jit-ee-api.prompt
(there should be suggestions) and hit enterIt is supposed to ask for the signature (e.g.
CORINFO_METHOD_HANDLE getHelperHandle(int helperId)
) and perform all the modifications (including thegen.sh
script).Alternatively, you can type the signature right away
/add-new-jit-ee-api.prompt CORINFO_METHOD_HANDLE getHelperHandle(int helperId)
It managed to successfully generate simple APIs for me (sometimes not from the first try). If it lands, I presume we can improve the prompt to handle more complex cases if it fails on them.