-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add static codegen for jl_is_leaf_type and jl_subtype #7088
Conversation
Failure is linalg-test-threshold-related. |
Nice, I was hoping somebody would get around to adding this. |
add static codegen for jl_is_leaf_type and jl_subtype
Regarding
prints
So why should |
Is the
still spits out a lot more code than it should. |
OT: test failure should be addressed by 454d307. |
You will need to try |
But yes, we are being too conservative in the |
Sweet! Hanging out with Julians makes me feel like I've got a whole flock of fairy godmothers making my life better. Let's see, what have they done today? Faster regex, better static codegen, improved SIMD, more special functions, lifetime supply of jellybeans, better reduction functions...hmm, all in all, a pretty good day. |
You should tweet that! |
What's a tweet? 😄 When it comes to social media, email is about as sophisticated as I get. |
@stevengj For method_exists, I guess it probably wouldn't hurt to evaluate it at compile time, but it does change current behavior which some programs may rely on. If it is not deemed too breaking, I can probably make that change too. @timholy Am I the only one not aware of the jellybeans thing ?! :-) |
@carnaval, just checking to see if anyone noticed. |
One option would be to evaluate |
Also for
the |
Was this meant to "fix" this? julia> f{T}(x::T) = T <: Real ? 1 : 2.0
julia> @code_warntype f(1.0)
Variables:
x::Float64
Body:
begin # none, line 1:
unless T <: Main.AbstractFloat::Bool goto 0
return 1
0:
return 2.0
end::Union{Float64,Int64} Is there any good way to do what I am trying to do here? I am wrapping a library where the function calls will look very similar except that I need to change the type of a parameter depending on the type of the input. Basically I want to do : for t in (:StridedVector, :StridedMatrix)
@eval begin
function f{T}(B::$t(){T})
# bunch of stuff same for vector and matrix
if T <: StridedVector
C = zeros(10) # vector
else
C = zeros(10, 10) # matrix
end
ccall(blah blah, C, ..)
end
end
end and have it be type stable. |
solves some part of #7060. I'm not so sure about method_exists because you can add methods after codegen.