Skip to content

add sret handling for scalar autodiff #139465

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 2 commits into from
Apr 7, 2025
Merged

Conversation

ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Apr 7, 2025

r? @oli-obk

Fixing one of the todo's which I left in my previous batching PR.
This one handles sret for scalar autodiff. sret mostly shows up when we try to return a lot of scalar floats.
People often start testing autodiff which toy functions which just use a few scalars as inputs and outputs, and those were the most likely to be affected by this issue. So this fix should make learning/teaching hopefully a bit easier.

Tracking:

@rustbot rustbot added F-autodiff `#![feature(autodiff)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 7, 2025
@rust-log-analyzer

This comment has been minimized.

Comment on lines 212 to 213
let param_tys = cx.func_params_types(fn_ty);
for (i, act) in attrs.input_activity.iter().enumerate() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let param_tys = cx.func_params_types(fn_ty);
for (i, act) in attrs.input_activity.iter().enumerate() {
let param_tys = cx.func_params_types(fn_ty);
for (act, param_ty) in attrs.input_activity.iter().zip(param_tys) {

Copy link
Contributor

@oli-obk oli-obk left a comment

Choose a reason for hiding this comment

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

r=me with nit

@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Apr 7, 2025

@bors r=@oli-obk rollup

@bors
Copy link
Collaborator

bors commented Apr 7, 2025

📌 Commit ca5bea3 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 7, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 7, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang#139035 (Add new `PatKind::Missing` variants)
 - rust-lang#139108 (Simplify `thir::PatKind::ExpandedConstant`)
 - rust-lang#139112 (Implement `super let`)
 - rust-lang#139365 (Default auto traits: fix perf)
 - rust-lang#139397 (coverage: Build the CGU's global file table as late as possible)
 - rust-lang#139455 ( Remove support for `extern "rust-intrinsic"` blocks)
 - rust-lang#139461 (Stop calling `source_span` query in significant drop order code)
 - rust-lang#139465 (add sret handling for scalar autodiff)
 - rust-lang#139466 (Trivial tweaks to stop tracking source span directly)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5863b42 into rust-lang:master Apr 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 7, 2025
Rollup merge of rust-lang#139465 - EnzymeAD:autodiff-sret, r=oli-obk

add sret handling for scalar autodiff

r? `@oli-obk`

Fixing one of the todo's which I left in my previous batching PR.
This one handles sret for scalar autodiff.  `sret` mostly shows up when we try to return a lot of scalar floats.
People often start testing autodiff which toy functions which just use a few scalars as inputs and outputs, and those were the most likely to be affected by this issue. So this fix should make learning/teaching hopefully a bit easier.

Tracking:

- rust-lang#124509
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-autodiff `#![feature(autodiff)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants