Skip to content

Unable to differentiate a function adding three values with -enzyme-auto-sparsity=1Β #2627

@nkoukpaizan

Description

@nkoukpaizan

@wsmoses I went back to a simple example adding three entries of a vector and tried, unsuccessfully, to generate the derivative with -enzyme-auto-sparsity=1. This is the simplest example I can think of.
The function to differentiate is:
f[0] = y[0] + y[1] + y[2];

Here is the Enzyme explorer reproducer: https://fwd.gymni.ch/bqPzQv

The cannot tell if depends on loop iv: (zext i1 %20 to i64) error does come from the if (val == 0.0) boolean in sparse_store, but that is precisely what should help with the sparsity detection, and it works in most other cases. Adding two entries instead, or flipping one of the signs in the ternary operation works. The underlying issue has to be elsewhere.

For reference, I came across the issue in a larger function evaluation: https://fwd.gymni.ch/X7pLQp.
cc @pelesh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions