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

Dataflow Bug #355

Merged
merged 7 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/util/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,25 @@ function (ctx::MarkDead)(ex, res)
delete!(ctx.refs, lhs)
rhs = ctx(rhs, res)
return Expr(f, lhs, rhs)
#elseif @capture ex :for(:(=)(~i, ~ext), ~body)
# body_2 = body
# while true
# ctx_2 = copy(ctx)
# body_2 = ctx(body, false)
# ctx == ctx_2 && break
# end
# ext = ctx(ext, iseffectful(body_2))
# return Expr(:for, Expr(:(=), i, ext), body_2)
elseif @capture ex :for(:(=)(~i, ~ext), ~body)
body_2 = body
while true
ctx_2 = copy(ctx)
body_2 = ctx(body, false)
ctx_3 = branch(ctx)
body_2 = ctx_3(body, false)
meet!(ctx, ctx_3)
ext = ctx(ext, iseffectful(body_2))
ctx == ctx_2 && break
end
ext = ctx(ext, iseffectful(body_2))
return Expr(:for, Expr(:(=), i, ext), body_2)
elseif @capture ex :while(~cond, ~body)
body_2 = body
Expand Down Expand Up @@ -531,4 +542,4 @@ Base.@propagate_inbounds function scansearch(v, x, lo::T, hi::T)::T where T<:Int
end
end
return hi
end
end
23 changes: 23 additions & 0 deletions test/test_issues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,27 @@ using CIndices
@test B isa Array
@test B == A
end

#https://github.com/willow-ahrens/Finch.jl/issues/339
let
Output = Fiber(SparseList(Dense(Element(0),1),10))
Point = Fiber(SparseList(Element{0}([1]), 10, [1,2], [1]))
Kernel = Fiber(SparseList(Dense(Element{0}([1]),1), 10, [1,2], [2]))

eval(@finch_kernel function test(Output, Point, Kernel)
Output .= 0
for x = _
for xx = _
for m = _
Output[m,x] += Point[x] * Kernel[m,xx]
end
end
end
end)

test(Output, Point, Kernel)
Ans = Fiber(SparseList{Int64}(Dense{Int64}(Element{0, Int64, Int64}([1]), 1), 10, [1, 2], [1]))
@test Ans == Output
end

end
Loading