Skip to content

Large lazy trees with heterogenous values causes inference overflow in Dagger #72

Open
@DrChainsaw

Description

@DrChainsaw

MWE:

largetree = maketree("root" => [string(i) for i in 1:600]);

# All values of same type seem to be ok
FileTrees.load(largetree; lazy=true) do file
       "AAA"
end |> exec;

FileTrees.load(largetree; lazy=true) do file
       isodd(parse(Int, name(file))) ? "AAA" : 13
end |> exec;
# Internal error: stack overflow in type inference of  (::Dagger.var"#85#86"{FileTrees.var"#165#169", Tuple{Dagger.Chunk{Array{String, 1}, etc...
# This might be caused by recursion over very long tuples or argument lists.

# Small(ish) trees are always ok it seems 
smalltree = maketree("root" => [string(i) for i in 1:300]);

FileTrees.load(smalltree; lazy=true) do file
       isodd(parse(Int, name(file))) ? "AAA" : 13
end |> exec;

I suppose it is this line which happens to get a nice signature when everything has the same type.

Possible solution is to use assocreduce (or at least the same strategy) here. I will experiment with this in a PR, but other suggestions are welcome in the meantime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions