EnzymeAD / EnzymeAD/Enzyme

Enzyme hangs when using CoDiPack forward AD type in function

Open
#1,308 8 comments 1 reaction 0 assignees View on GitHub
type analysis
Dominant language
LLVM
Stars
1.7k
Forks
188
Avg merge
1d 22h
Merged PRs (30d)
26

Description

This might be related to issue #142.

Enzyme does not finish when applied to the code:
```
#include
#include

extern int enzyme_dup;
extern int enzyme_out;
extern int enzyme_const;

template
void __enzyme_autodiff(void*, Args...);

using Inner = codi::RealForward;
//using Inner = double;

//using Data = int;
using Data = codi::ExternalFunctionUserData;

void func2_prim(Inner const* x, size_t m, Inner* y, size_t n, Data* d) {
y[0] = 42.0 * x[0] * x[0];
}

void test() {
Inner tx[1] = {1.0};
Inner tx_b[1] = {0.0};
Inner ty[1] = {0.0};
Inner ty_b[1] = {0.0};
__enzyme_autodiff(
(void*) func2_prim ,
enzyme_dup, &tx, tx_b,
enzyme_const, (size_t)1,
enzyme_dup, ty, ty_b,
enzyme_const, (size_t)1,
enzyme_const, (Data*)NULL);

}
```

It works when using the double type. I tried to reproduce this with a simple forward type implementation but this did not trigger the bug.

Clang: `clang version 14.0.0`
Enzyme: 61332add5 `v0.0.71`

The output of the crash report: [out.txt.zip](https://github.com/EnzymeAD/Enzyme/files/11891623/out.txt.zip)
Full cpp file: [e2-33883a.cpp.txt](https://github.com/EnzymeAD/Enzyme/files/11891650/e2-33883a.cpp.txt)
Command line: [e2-33883a.sh.txt](https://github.com/EnzymeAD/Enzyme/files/11891651/e2-33883a.sh.txt)

Contributor guide

Open the contributing guide

Research direction

Start by reading related issue #142, then reproduce the hang with the supplied e2-33883a.cpp.txt and e2-33883a.sh.txt files. Compare the codi::RealForward case with the double case and inspect out.txt.zip for the stopping point. Done means identifying the cause of the non-termination and documenting a verified fix or regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.