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

error in nodecayed_phis #1031

Closed
motabbara opened this issue Aug 27, 2023 · 7 comments
Closed

error in nodecayed_phis #1031

motabbara opened this issue Aug 27, 2023 · 7 comments
Labels

Comments

@motabbara
Copy link
Contributor

Private repo but nodecayed_phis doesn't handle bitcastinst and fails here as in log. Repo code in question involves dynamic dispatch of the form

`
function f(objs::Vector{SomeAbstractType}, output::Vector{Float32})
for o in objs
g(o, output)
end
end

`

out.txt

@wsmoses
Copy link
Member

wsmoses commented Sep 1, 2023

Does this help? #1038

(hard to check without a test)

@motabbara
Copy link
Contributor Author

Does this help? #1038

(hard to check without a test)

Segfault in getindex on an expression of the form if t < ts[1] where t is Float32 and ts is Float32[], nonempty. Not sure how that segfaults but happens in both 1.9x and 1.10x. This was on aarch64 so will try on x86_64.

@wsmoses
Copy link
Member

wsmoses commented Sep 3, 2023

Can you post a reproducer?

@motabbara
Copy link
Contributor Author

This segfaults for me

enzyme.txt

@wsmoses
Copy link
Member

wsmoses commented Sep 13, 2023

using Enzyme

Enzyme.API.printall!(true)

function f(q)
    total = 0.0f0
    v = Vector{Float32}()
    for i in 1:100
		push!(v, q)
    end
    first(v[v .> -1000000000.0f0])
end

f(1.0f0)

@show autodiff(Enzyme.ReverseWithPrimal, f, Active, Active(1.0f0))

@wsmoses
Copy link
Member

wsmoses commented Sep 17, 2023

using Enzyme

Enzyme.API.printall!(true)

@inline function iterate(mask, N, c)
    Bc = mask
    Bi = 1
    while c == 0
        Bi >= N && return nothing
        c = @inbounds Bc[Bi+=1]
    end
    c = Base._blsr(c)
    return c # (i1 - tz, c)
end


function f(dest, I, N)
	state = iterate(I, N, 0xffffffff)
	tot = 0.0f0
    while true
        tot += dest
        state = iterate(I, N, state)
        if state === nothing
            return tot
        end
    end
    return tot
end

num = 64
I = UInt64[0xffffffff]

dest = Vector{Float32}(undef, num)
ddest = Vector{Float32}(undef, num)

f(1.0f0, I, 1)

fwd, rev = autodiff_thunk(Enzyme.ReverseSplitWithPrimal, Const{typeof(f)}, Active, Active{Float32}, Const{typeof(I)}, Const{Int})
res = fwd(Const(f), Active(1.0f0), Const(I), Const(1))

rev(Const(f), Active(1.0f0), Const(I), Const(1), 1.0f0, res[1])

@wsmoses
Copy link
Member

wsmoses commented Oct 8, 2023

This should now be fixed. The nodecayed phis by #1088 and the segfault by the earlier jll bump

@wsmoses wsmoses closed this as completed Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants