Migrate #[autodiff] and #[rustc_autodiff] to the new attribute parser.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Location
I think the author wants to add info to the rustc dev guide.
Summary
Hi @jdonszelmann,
first of all, thanks for the attribute refactor work and congrats on landing your big pr!
I recently introduced an #[autodiff] macro which can be applied on top of a function, and generates a second function. Both of the function then automatically receive a #[rustc_autodiff] attribute.
On of the two rustc_autodiff attributes, as well as the original autodiff macro take user arguments, so there is some duplicated parsing and verification. I'd like to move over to the new infra, and since a few people offered to help with autodiff, I thought this might be a nice opportunity to introduce them to it.
For reference, this was the original autodiff frontend PR: https://github.com/rust-lang/rust/pull/129458
As a dummy example:
#[autodiff(df, Reverse, Duplicated, Duplicated)]
fn f(x: &f32, y: &mut f32) { *y *= *x; }
would expand to:
#[rustc_autodiff]
fn f(x: &f32, y: &mut f32) { *y *= *x; }
#[rustc_autodiff(Reverse, Duplicated, Duplicated)]
fn df(x: &f32, dx: &f32, y: &mut f32, dy: &mut f32) { // dummy code }
I think you haven't yet completed your plan to write a migration guide for the rustc-dev-guide, but do you have a migration PR that you can recommend to us as a blueprint to see how this could be done? Also, I don't know too much about your rework. Do you think the migration is going to end up as one big PR, or is it possible to split the work up?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the original autodiff frontend PR and the current implementations of #[autodiff] and #[rustc_autodiff]; identify where their argument parsing and verification are duplicated. Done means both attributes use the new attribute-parser infrastructure while preserving the illustrated expansion and argument behavior, with any migration guidance added to the rustc dev guide.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100