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

Warning with Flux.Bilinear #1341

Closed
CarloLucibello opened this issue Mar 11, 2024 · 5 comments
Closed

Warning with Flux.Bilinear #1341

CarloLucibello opened this issue Mar 11, 2024 · 5 comments

Comments

@CarloLucibello
Copy link
Collaborator

CarloLucibello commented Mar 11, 2024

When executing the following code

using Enzyme, Flux
loss(model, x) = sum(model(x))
model = Flux.Bilinear(2 => 3)
x = randn(Float32, 2, 4)
d_model = Flux.fmap(model) do x
    x isa Array ? zero(x) : x
end
Enzyme.autodiff(Reverse, loss, Active, Duplicated(model, d_model), Const(x))

I get the Warning (only showing a tiny part)

│ 
│ Stacktrace:
│  [1] getproperty
│    @ ./Base.jl:37
│  [2] _wait2
│    @ ./condition.jl:87
└ @ Enzyme.Compiler ~/.julia/packages/GPUCompiler/U36Ed/src/utils.jl:59
┌ Warning: TypeAnalysisDepthLimit
│ LLVM.StoreInst(store atomic {} addrspace(10)* %getfield14, {} addrspace(10)* addrspace(11)* %18 release, align 8, !dbg !171, !tbaa !142, !alias.scope !146, !noalias !174)
│ {[]:Pointer, [0]:Pointer, [0,0]:Pointer, [0,0,0]:Pointer, [0,0,0,0]:Pointer, [0,0,0,0,0]:Pointer, [0,0,0,8]:Pointer, [0,0,0,8,0]:Pointer, [0,0,0,8,0,0]:Pointer,
...

I haven't had time to reduce it yet, but the culprit could be the NNlib.batched_mul operation here

@wsmoses
Copy link
Member

wsmoses commented Mar 11, 2024

So that trace doesnt actually show the error on the inside. Can you post the full error log?

@CarloLucibello
Copy link
Collaborator Author

Here is the full output
out.txt

@wsmoses
Copy link
Member

wsmoses commented Mar 13, 2024

I don't see any error messages in your trace either -- just warnings.

You can silcence them with Enzyme.API.typeWarning!(false) right after importing Enzyme.

@CarloLucibello
Copy link
Collaborator Author

Ok. Should Enzyme.API.typeWarning!(false) be the default then?

@wsmoses
Copy link
Member

wsmoses commented Mar 13, 2024

Yeah that's something I've been leaning towards recently as we've added more type info regardless.

The point of that warning is to let the user know that we've hit a cut off for how much type information Julia is going to provide, which could lead to Enzyme not being able to differentiate a function at all (or as performantly).

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