Skip to content

Add error handling for incorrect activities in Forward mode autodiff #139590

Open
@vayunbiyani

Description

@vayunbiyani

Code

#[autodiff(df, Forward, Dual, Dual)]
fn f(x: f32, _y: f32) -> f32 {
    x
}

Discussion: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Assistance.20with.20autodiff.20compiler.20panic/with/510644112
Bug repro in enzyme explorer: https://fwd.gymni.ch/rMla2i

Meta

rustc --version --verbose:

 rustc --version --verbose
rustc 1.85.0-nightly (0aeaa5eb2 2024-12-14)
binary: rustc
commit-hash: 0aeaa5eb22180fdf12a8489e63c4daa18da6f236
commit-date: 2024-12-14
host: aarch64-apple-darwin
release: 1.85.0-nightly
LLVM version: 19.1.5

Error output

error: expected 3 activities, but found 2
Backtrace

thread 'rustc' panicked at compiler/rustc_builtin_macros/src/autodiff.rs:506:17:
Expected two return types for dual
stack backtrace:
   0:        0x10b93a3bc - std::backtrace::Backtrace::create::hd5f74c9541fa041c
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-autodiff`#![feature(autodiff)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions