Build issue: Build with Enzyme fails
Open
@nkoukpaizan is already working on this.
Since Jan 18, 2026.
bug
cmake
enzyme
- Dominant language
- C++
- Stars
- 27
- Forks
- 11
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 23
Description
Build error message(s)
I am getting error message "Illegal remaining use" when trying to build GridKit with Enzyme enabled. Truncated output is below:
In file included from /Users/55y/src/gridkit/GridKit/GridKit/Model/PhasorDynamics/Branch/BranchEnzyme.cpp:7:
/Users/55y/src/gridkit/GridKit/GridKit/AutomaticDifferentiation/Enzyme/SparseWrapper.hpp:585:21: error: Enzyme: Illegal remaining use ( call fastcc void @fwddiffe_ZN7GridKit6Enzyme6Sparse7WrapperINS_14PhasorDynamics6BranchIdlEELNS1_15MemberFunctionsE3EdE4evalEPS5_PdS9_S9_S9_(ptr %0, ptr %31, ptr %32)) of todense ( %31 = call noundef ptr (ptr, ...) @_ZN7GridKit6Enzyme6Sparse16__enzyme_todenseIPdEET_Pvz(ptr noundef nonnull @_ZN7GridKit6Enzyme6SparseL10ident_loadIdEET_mm, ptr noundef nonnull @_ZN7GridKit6Enzyme6SparseL11ident_storeIdEEvT_mm, i64 noundef %30) #25) in function ; Function Attrs: mustprogress noinline optnone ssp uwtable(sync)
define linkonce_odr void @_ZN7GridKit6Enzyme6Sparse11BusJacobianINS_14PhasorDynamics6BranchIdlEELNS1_15MemberFunctionsE3EdlE4evalEPS5_mmRKNSt3__13mapIllNS9_4lessIlEENS9_9allocatorINS9_4pairIKllEEEEEESK_PdSL_SL_RNS_13LinearAlgebra10COO_MatrixIdlEE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef nonnull align 8 dereferenceable(89) %8) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
%10 = alloca %"class.std::__1::vector.178", align 8
%11 = alloca %"class.std::__1::vector", align 8
%12 = alloca double, align 8
%13 = alloca %"class.std::__1::vector.16", align 8
%14 = alloca %"class.std::__1::vector.16", align 8
%15 = alloca %"class.std::__1::vector", align 8
%16 = alloca %"class.std::__1::__wrap_iter.229", align 8
%17 = alloca %"class.std::__1::__wrap_iter.229", align 8
%18 = alloca i64, align 8
%19 = alloca i64, align 8
%20 = alloca %"class.std::__1::vector.16", align 8
%21 = alloca %"class.std::__1::vector.16", align 8
%22 = alloca %"class.std::__1::vector", align 8
%23 = icmp ne i64 %1, 0
%24 = icmp ne i64 %2, 0
%25 = and i1 %23, %24
br i1 %25, label %26, label %111
26: ; preds = %9
%27 = call noundef ptr @_ZNSt3__16vectorIN7GridKit6Enzyme6Sparse6TripleIdEENS_9allocatorIS5_EEEC1B8ne180100Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #24
%28 = invoke noundef ptr @_ZNSt3__16vectorIdNS_9allocatorIdEEEC1Em(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %1)
to label %29 unwind label %39
GridKit™ version
develop at 61b657b80f825808add689df40f45f3ea808802c
System and environment details
- Enzyme v0.0.206
- Compiler: clang 18 from MacPorts
- MacOS v15
- ARM M4 CPU
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.