-
Notifications
You must be signed in to change notification settings - Fork 150
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
World-age failure in M * v with Colors #109
Comments
Ahh... yeah... this is a big problem at the moment. Sorry Tim! StaticArrays is totally broken on v0.6 for any types defined after The cause of the problem you are seeing is that our function generators call functions like I can see two solutions:
I didn't start work on option 2 yet because... it is a lot of work! And I have really being enjoying the flexibility of OTOH option 1 will clearly be a fair amount of work for somebody who probably isn't me (I'm not super qualified to judge; also @vtjnash has even argued that it is impossible, but I can't yet see that this is true). To make my intentions clear - I can accept rewriting this package if that is the consensus view. I'm going to ping a bunch of people in the hope for some friendly guidance on the way forward: cc: @c42f @SimonDanisch @StefanKarpinski @JeffBezanson (and of course I'd very much appreciate hearing views from Jameson and Tim). (sorry for bothering everyone but sorting this out seems important to me). |
I ran into a few While I'm here, let me just say that if support for |
Bump. Any feedback? |
For what it's worth, I think the new behavior of generated (and pure) is inconsistent with other functions in a way that wasn't nearly as visible in 0.5, and I don't think it should be the job of packages to work around this. That's not much help coming from me, I know :-) If I can find some time I'll help out with a rewrite if necessary. |
Given Jameson's reservations, I've put quite a bit of effort into expunging But echoing @ajkeller34 and @andyferris, it's also the case that currently there isn't a way to get rid of them entirely and still be able to do everything we want to do. @vtjnash's work on improving efficiency for type-unstable code is a huge step in a promising direction (it reduces the importance of inferrability, which is the main remaining motivation for using |
I do admit that weeding down the generated functions in StaticArrays to a much smaller number could be quite good for code clarity. A package like this one really needs
|
@andyferris you beat me to it :-) I was just about to submit the following saying more or less the same thing: @timholy absolutely agreed - I was just discussing this with @andyferris again, and we agreed that a useful step would be to identify the patterns of code generation which are used in this package, and attempt to centralize them into a minimal number of generated functions. After doing this we might be able to identify which minimum set of language extensions would be required to get rid of If this worked out I think it would be a useful step regardless of what happens to |
OK, preliminary results show that using a "central" generated function (a bit like If we can't improve that, I guess we'll need lots of thunks and lots of generated functions... |
Can you post what you tried somehow? (branch or gist) I doubt I'd see any improvements you didn't already try, but I'd be happy to peek. |
This is something generated functions are really good at right now. I suspect we could define something in base like
This is something generated functions were never intended for and are thus now really bad at. Traits and |
The branch is called "julia-v0.6"... lets discuss on this gist. I'd really appreciate another set of eyes on this, so thanks for the offer :) |
Yep, we're definitely using more traits and |
I get good codegen from this gist. |
@timholy I'd love to just use lispy recursion, and I think a great deal of StaticArrays is easily formatted in this way. But if |
Yes, that is a problem. We could work around this by nesting the tuples (too horrible to contemplate), and it probably wouldn't be too hard to add a I updated my gist with a variant that seems to work OK (but it does use a generated function). The only difference from your variant is that |
I just started to play with this here but ran into this. And yes, it could become a bit horrible...
This would certainly solve the problem. It would be interesting to see what you can't write (efficiently) without a generated function (I'm thinking
I'm beginning to wonder if constructing the closure might have something to do with the the extra stuff in the codegen that I was seeing? |
FYI related problem: Ferrite-FEM/Tensors.jl#7 |
So instead of: @generated function f{N,T}(x::NTuple{N,T})
exp = :(zero(T))
return exp
end You would do: @generated function f{N,T}(x::NTuple{N,T})
exp = :(o)
return quote
o = zero(T)
$exp
end
end Have I understood that correctly? |
those are both the same as: what is wrong is attempting to do: |
Working around |
Thanks, I get it now! (famous last words) |
This is a very good point. Of course, the real tool you want for StaticArrays is |
Yes, JuliaLang/julia#11902 and JuliaLang/julia#17115 seemed to be stalled looking for more analysis of the how they'll interact with generic code and make it more/less error-prone/descriptive |
Yeah, depending on how far you take it (e.g. interprocedurally), the escape/reference analysis problem seems like it could potentially become an entire, new "inference" system... Do you think (at least a basic version of) these are reasonably expected in v1.0? |
I think this is fixed by #121 |
* switch to DataAPI * tests for refvalue
I noticed this while trying to get Images to pass tests on 0.6.
Suppressing depwarns from StaticArrays:
May be related to ongoing discussions about
@pure
in #95? I'm on e6d7387. CC @vtjnash.The text was updated successfully, but these errors were encountered: