Skip to content

Unexpected Crash using Forward #174

@g-bauer

Description

@g-bauer

I encountered unexpected behavior with a function and I am unsure what the issue is (compiled via cargo +enzyme run --release)

// this crashes
#[autodiff(df2f, Forward, Const, Dual, Dual)]
pub fn _f2(x: &[f64], y: f64) -> f64 {
    let xy: Vec<_> = x.iter().map(|xi| xi / y).collect();
    xy.iter().sum()
}

// this works
#[autodiff(df4f, Forward, Const, Dual, Dual)]
pub fn _f4(x: &[f64], y: f64) -> f64 {
    x.iter().fold(0.0, |acc, xi| acc + xi / y)
}

Error message:

source_id: DefId(0:13 ~ enzyme_playground[95ff]::_f2)
rustc: /code/rust/src/llvm-project/llvm/lib/IR/Instructions.cpp:686: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(Args.size() == FTy->getNumParams() || (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && "Calling a function with bad signature!"' failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions