EnzymeAD / EnzymeAD/Enzyme

Failed to deduce type of memset with optimization level > 0

Open
#1,245 4 comments 0 reactions 0 assignees View on GitHub
bug needs more information
Dominant language
LLVM
Stars
1.7k
Forks
188
Avg merge
1d 22h
Merged PRs (30d)
26

Description

Hi team,

I get the following error as long as I set a non-zero optimization level:

```
/root/.freetensor/BDqwP0/run.cpp:83:48: error: Enzyme: failed to deduce type of memset call void @llvm.memset.p0i8.i64(i8* nonnull align 16 dereferenceable(40000) getelementptr inbounds ([304640 x i8], [304640 x i8]* @_ZZ3runE13__sharedStack, i64 0, i64 160384), i8 0, i64 40000, i1 false) #12, !dbg !1710
_y__4[((_i__31 * 5) + _i__32)] = 0;
^
```

Here, `_y__4` is defined as `auto &&_y__4 = ((double*)(&__sharedStack[160384]));`, and `__sharedStack` is a raw buffer, which is always cast to pointer-to-double to use.

This zeroing statement is in a loop. I guess it is optimized to be a integer `memset` with optimization levels, and Enzyme failed to recognize it.

The full error message is attached, because it has reached the limit of GitHub comments. [log.txt](https://github.com/EnzymeAD/Enzyme/files/11620723/log.txt)

Sorry I don't have a minimal reproduction. I can attach `/tmp/run-11a9c9.cpp` and `/tmp/run-11a9c9.sh` prepared by Clang if you need.

Tested with Enzyme 0.0.66 and Clang 12, with ClangEnzyme.

Thanks in advance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.