Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enzyme cannot deduce type error on Oceananigans script #2112

Open
jlk9 opened this issue Nov 21, 2024 · 1 comment
Open

Enzyme cannot deduce type error on Oceananigans script #2112

jlk9 opened this issue Nov 21, 2024 · 1 comment
Assignees

Comments

@jlk9
Copy link
Collaborator

jlk9 commented Nov 21, 2024

Running this script:

https://github.com/glwagner/Enzymanigans.jl/blob/main/dynamical_core/autodiff_double_gyre.jl

with loose type analysis produces the attached error. I am using the latest main branch of Enzyme.jl and Oceananigans#glw/autodiff-hydrostatic-turbulence. If the use of a flux BC is removed (i.e. commenting out lines 7, 8, and 63) then the code runs with autodiff.

double_gyre_current_loose_error.txt

@wsmoses
Copy link
Member

wsmoses commented Nov 21, 2024

  %.fca.3.extract = extractvalue [4 x {} addrspace(10)*] %0, 3, !dbg !50



  %5 = addrspacecast {} addrspace(10)* %.fca.3.extract to { { { i64, i64, i64, i64, i64, i64, double, double, double, double, double, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, double, double, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, double, double, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, double }, { {} addrspace(10)*, [3 x i64] }, {} addrspace(10)* } } addrspace(11)*, !dbg !57


  %.unpack.unpack79.unpack263.elt267 = getelementptr inbounds { { { i64, i64, i64, i64, i64, i64, double, double, double, double, double, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, double, double, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, double, double, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, double }, { {} addrspace(10)*, [3 x i64] }, {} addrspace(10)* } }, { { { i64, i64, i64, i64, i64, i64, double, double, double, double, double, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, double, double, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { { [2 x double], [2 x double], i64, i64 }, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, double, double, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, { {} addrspace(10)*, [1 x i64] }, double }, { {} addrspace(10)*, [3 x i64] }, {} addrspace(10)* } } addrspace(11)* %5, i64 0, i32 0, i32 1, i32 1, i64 2, !dbg !21: {[-1]:Pointer}, intvals: {}


  %.unpack.unpack79.unpack263.unpack268 = load i64, i64 addrspace(11)* %.unpack.unpack79.unpack263.elt267, align 8, !dbg !21, !tbaa !32, !alias.scope !36, !noalias !39: {}, intvals: {}


  %.unpack.unpack79.unpack263269 = insertvalue [3 x i64] %92, i64 %.unpack.unpack79.unpack263.unpack268, 2, !dbg !21: {}, intvals: {}

  %90 = insertvalue { {} addrspace(10)*, [3 x i64] } undef, {} addrspace(10)* %.unpack.unpack79.unpack, 0, !dbg !21: {[0]:Pointer, [8]:Anything, [9]:Anything, [10]:Anything, [11]:Anything, [12]:Anything, [13]:Anything, [14]:Anything, [15]:Anything, [16]:Anything, [17]:Anything, [18]:Anything, [19]:Anything, [20]:Anything, [21]:Anything, [22]:Anything, [23]:Anything, [24]:Anything, [25]:Anything, [26]:Anything, [27]:Anything, [28]:Anything, [29]:Anything, [30]:Anything, [31]:Anything}, intvals: {}

%.unpack.unpack79264 = insertvalue { {} addrspace(10)*, [3 x i64] } %90, [3 x i64] %.unpack.unpack79.unpack263269, 1, !dbg !21 size: 24 TT: {}

So one thing is that absint isn't type propagating for that extract for some reason, and also insertvalue isn't forwarding the pointer for the end state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants