rust-lang / rust-lang/rust

Create a profile option for autodiff to replace RUSTFLAGS requirement.

Open
#150,345 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

F-autodiff T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I'm not sure if you could convince the cargo team to get dedicated profiles. I was referring to a profile option autodiff = true similar to ones like lto = true or opt-level = 3 that you can specify within the [profile.release] and [profile.debug] sections.

[profile.debug]
autodiff = true

[profile.release]
autodiff = true

Originally posted by @bjorn3 in #147487

Right now, we need two options to make autodiff work.
You need to set lto=fat in your cargo.toml, and add RUSTFLAGS=-Zautodiff=Enable.
It would be good to bundle both in the same place, preferably Cargo.toml.
As a result, each compiler invocation would also become shorter, which makes autodiff much nicer to use.

Creating this issue since the main issue from the thread linked above has ben solved, so I'm closing that one. This would still be good to solve. I'm not experienced with how we parse Cargo.toml, but I assume it's a sufficiently nice beginner issue, if someone is interested.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Cargo.toml [profile.debug] and [profile.release] settings, then trace how existing lto and opt-level options are parsed and how RUSTFLAGS=-Zautodiff=Enable currently reaches compiler invocations. Done means autodiff can be enabled through the profile option in both profiles without requiring the separate RUSTFLAGS setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.