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

static_parameter expr #175

Merged
merged 12 commits into from
Oct 22, 2024
Merged

static_parameter expr #175

merged 12 commits into from
Oct 22, 2024

Conversation

KDr2
Copy link
Member

@KDr2 KDr2 commented Oct 22, 2024

Fix #174

@KDr2 KDr2 changed the title Compat 1.11 statis_parameter expr Oct 22, 2024
@yebai
Copy link
Member

yebai commented Oct 22, 2024

@penelopeysm @willtebbutt, can you help review this PR? The failing Turing integration tests are due to Mooncake, so they can be ignored.

@yebai yebai marked this pull request as ready for review October 22, 2024 09:34
Copy link
Member

@willtebbutt willtebbutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. You'll need to bump the version number before merging though so that we can tag a release.

@penelopeysm
Copy link
Member

Yes, it does fix the examples in #174! To be precise, the first one still gives an error, but it now gives another error that isn't due to Libtape (it's a meaningless model after all).

@penelopeysm
Copy link
Member

penelopeysm commented Oct 22, 2024

@KDr2 I think this might be useful in writing a test 😄 it fails on master and runs correct on this PR.

using Libtask
function f()
    r = (a = 1)
    return nothing
end
tf = Libtask.TapedFunction(f)
r = tf()

I'm still trying to work out the RandomMeasures example. Will update if I get it.

@KDr2
Copy link
Member Author

KDr2 commented Oct 22, 2024

I think this might be useful in writing a test

Thanks, do you have any clue about how to reproduce the second one with a simple function (not a Turing model)?

@penelopeysm
Copy link
Member

Haha, sorry, I just edited the comment (probably after you saw it) to say that I hadn't worked that one out yet. I'm looking at it now!

Thank you for looking into this so quickly!!

@KDr2 KDr2 changed the title statis_parameter expr static_parameter expr Oct 22, 2024
@penelopeysm
Copy link
Member

penelopeysm commented Oct 22, 2024

@KDr2 I think it's the ::Type{T} that makes this fail on master (but is fixed on this PR):

using Libtask
function g(::Type{T}) where {T}
    a = zeros(T, 10)
end
tf = Libtask.TapedFunction(g, Float64)

#= on master
┌ Error: Unknown Expression:
│   typeof(var) = Core.SSAValue
│   var = :(%1)
│   typeof(line) = Expr
│   line = :($(Expr(:static_parameter, 1)))
└ @ Libtask ~/.julia/packages/Libtask/0vMZ5/src/tapedfunction.jl:443
=#

@penelopeysm
Copy link
Member

using Libtask
function g(::Type{T}) where {T}
    a = zeros(T, 10)
end
tf = Libtask.TapedFunction(g, Float64)

The above seems fine, but then subsequently calling r = tf(Float64) fails, at least on <=1.10. This isn't a regression introduced by this PR, it's also on master.

@KDr2
Copy link
Member Author

KDr2 commented Oct 22, 2024

This isn't a regression introduced by this PR, it's also on master.

Fixed, but what happened to the Integeration test? It passes now...

@penelopeysm
Copy link
Member

It's probably because of Hong's commit which bumped the minor version, and Turing.jl's compat entry for Libtask doesn't allow it to be tested with this.

I'm curious as to whether we can keep 1.7 compat here, if you don't mind, I'll test it out :)

@KDr2
Copy link
Member Author

KDr2 commented Oct 22, 2024

we can keep 1.7 compat

We can keep both 1.7 and 1.10 in the CI unit tests.

@penelopeysm penelopeysm merged commit 6264afd into master Oct 22, 2024
@penelopeysm penelopeysm deleted the compat-1.11 branch October 22, 2024 12:17
@penelopeysm
Copy link
Member

Thank you again to all of you who contributed here ❤️

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

Successfully merging this pull request may close these issues.

Unknown expression / IR code typeof(var) = Core.SSAValue
4 participants