EnzymeAD / EnzymeAD/Enzyme

Leak in forward-over-reverse AD through stack-array loop

Open
#2,914 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
LLVM
Stars
1.7k
Forks
188
Avg merge
2d 4h
Merged PRs (30d)
22

Description

I’m seeing a memory leak in Enzyme-generated code when using forward-over-reverse AD through a function that uses small stack arrays. Here is a codex-generated simplified reproducer: https://tinyurl.com/2chgfdv3. The reproducer has no explicit heap allocation in the reported function, but LSan reports leaked malloc allocations attributed to that function. I am also seeing `freeing without malloc` messages during compilation that may be related.

Contributor guide

Open the contributing guide

Research direction

Start with the codex-generated reproducer at https://tinyurl.com/2chgfdv3 and run it under LSan, then inspect the Enzyme-generated code associated with the reported function. Done means the stack-array forward-over-reverse case produces no leaked malloc allocations and no related “freeing without malloc” messages during compilation.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.