EnzymeAD / EnzymeAD/Enzyme

Derived cache issue

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

Description

```llvm
define ptr addrspace(10) @retv(double %arg, ptr addrspace(10) %arg1) {
bb:
ret ptr addrspace(10) %arg1
}

; Function Attrs: nofree norecurse nosync nounwind speculatable willreturn memory(argmem: read)
declare noundef nonnull ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) nocapture noundef nonnull readnone, ptr noundef nonnull readnone) local_unnamed_addr #1

define double @ifn(ptr addrspace(11) %arg, ptr addrspace(10) %arg1) {
bb:
%i7 = load ptr addrspace(10), ptr addrspace(11) %arg, align 8
%i8 = addrspacecast ptr addrspace(10) %i7 to ptr addrspace(11)
%i31 = load ptr, ptr addrspace(11) %i8, align 8, !enzyme_nocache !14

%i32 = getelementptr inbounds { ptr, ptr addrspace(10) }, ptr addrspace(11) %i8, i64 0, i32 1
%i33 = load ptr addrspace(10), ptr addrspace(11) %i32, align 8

%i50 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) noundef %i33, ptr noundef %i31)

%i51 = load double, ptr addrspace(13) %i50, align 8

%i52 = call ptr addrspace(10) @retv(double %i51, ptr addrspace(10) %arg1)

ret double %i51
}

declare void @__enzyme_autodiff(...)

define void @dsquare(double %arg) {
bb:
tail call void (...) @__enzyme_autodiff(ptr @ifn, metadata !"enzyme_runtime_activity", metadata !"enzyme_dup", ptr addrspace(11) undef, ptr addrspace(11) undef, metadata !"enzyme_dup", ptr addrspace(10) undef, ptr addrspace(10) undef)
ret void
}

attributes #1 = { nofree norecurse nosync nounwind speculatable willreturn memory(argmem: read) "enzyme_nocache" "enzyme_shouldrecompute" "enzymejl_world"="26726" }

!14 = !{}

```

https://fwd.gymni.ch/w8PrhG

Contributor guide

Open the contributing guide

Research direction

Start with the LLVM IR reproducer in the issue and inspect the linked reproduction at https://fwd.gymni.ch/w8PrhG. Determine what behavior is incorrect around the derived cache and the @julia.gc_loaded call, then identify the relevant compiler entry point and a regression test. Done means the reproducer behaves correctly with coverage for the regression.

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
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.