Enzyme
Enzyme copied to clipboard
Attributor adds infinite alignment in intermediate function
here's a repo of the reproducer:
https://github.com/samuelpmish/neohookean_enzyme_test/tree/6a6cff7ec7eddc258959ea84613fd3c462576231
To summarize: compiling this example project with the flags -fno-vectorize -fno-unroll-loops
on the M1 mac seems to make the executable segfault on the first call to __enzyme_autodiff
. Adding those same flags to the Ubuntu 20.04 build does not result in a segfault (but the code is considerably slower!).
the script build.sh
has the specific compilation commands I've tested on an M1 mac and an x86_64 Ubuntu 20.04 machine.
potentially relevant information about the mac:
it uses enzyme 0.0.25 installed through homebrew
sam@Sams-Air neohookean_test_enzyme % brew info enzyme
enzyme: stable 0.0.25 (bottled), HEAD
High-performance automatic differentiation of LLVM
https://enzyme.mit.edu
/opt/homebrew/Cellar/enzyme/0.0.25 (9 files, 5.6MB) *
Poured from bottle on 2021-12-15 at 09:50:19
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/enzyme.rb
License: Apache-2.0 with LLVM-exception
==> Dependencies
Build: cmake ✘
Required: llvm ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 61 (30 days), 180 (90 days), 423 (365 days)
install-on-request: 61 (30 days), 180 (90 days), 423 (365 days)
build-error: 0 (30 days)
it uses the clang compiler installed by homebrew as part of enzyme's dependencies
sam@Sams-Air neohookean_test_enzyme % echo $CXX
/opt/homebrew/Cellar/llvm/13.0.0_2/bin/clang++
What precise enzyme version are you using on macos. Can you use brew install enzyme --HEAD
Can you also get the clang version for the relevant installations.
Can you also get the clang version for the relevant installations.
sam@Sams-Air neohookean_test_enzyme % $CXX --version
Homebrew clang version 13.0.0
Target: arm64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/13.0.0_2/bin
enzyme was on the 0.0.25 release, I tried updating with brew install enzyme --HEAD
, but the segfault is still there.
how did you build benchmark?
Reproduced and confirmed source as the post-AD attributor optimizaation setting alignment to something huge like 2^29.
Temporary workaround is setting -mllvm -enzyme-attributor=0
See https://github.com/wsmoses/Enzyme/blob/attr/enzyme/test/Integration/ReverseMode/attributor2.c for a minimal triggering test.
Note this requires 13+