-
Notifications
You must be signed in to change notification settings - Fork 149
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
Code rewrite for Julia v0.6 #113
Comments
In the branch I made it so that Any feedback on this decision? |
That seems very reasonable to me. Thanks for tackling this! I'd plunge in to help except that I'm a little swamped by other things (among other things, I've been working for nearly 2 weeks on trying to get the JuliaImages organization packages working on 0.6), but if you have difficult design choices don't hesitate to ask. |
That's OK Tim - the brainstorming was very useful to me :) |
You might already be on top on this but the promotion mechanism in Line 2 in e24e1d8
julia> using StaticArrays
julia> using ForwardDiff
julia> function foo()
x = @SMatrix zeros(ForwardDiff.Dual{0,Float64}, 3, 3)
y = @SVector zeros(ForwardDiff.Dual{0,Float64}, 3)
x\y
end
foo (generic function with 1 method)
julia> foo()
ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type ForwardDiff.Dual{0,Float64}
The applicable method may be too new: running in world age 21498, while current world is 21504.
This may have arisen from a call to the constructor ForwardDiff.Dual{0,Float64}(...),
since type constructors fall back to convert methods.
Stacktrace:
[1] zero(::Type{ForwardDiff.Dual{0,Float64}}) at ./number.jl:131
[2] zeros(::Type{T} where T, ::Int64, ::Int64) at ./array.jl:252
[3] zeros(...) at /Users/andreasnoack/.julia/v0.6/StaticArrays/src/arraymath.jl:82
[4] foo() at ./REPL[3]:2 |
Thanks. That's ok, it's easy to put the |
Are there any reason why the reductions are using For example: @inline function reduce(op, v0, a::StaticArray)
if length(a) == 0
return v0
else
s = v0
@inbounds @simd for j = 1:length(a)
s = op(s, a[j])
end
return s
end
end unrolls to the same code as the generated one when the array is small enough but also transitions to SIMD when LLVM thinks it is necessary. |
The answer would be "magical thinking" - or more precisely, making assumptions rather than measuring things. :) I bet this case is particularly dependent on |
I've fixed the strange slowdown here, @c42f. It turned out that |
Last "hard" file will be |
Thank you so much for your effort! My package would be dead without StaticArrays! |
Yes, many of ours too... |
Done! :) Follow #121 for updates. |
Much of the code needs revamping for Jula v0.6 (see e.g. #109). I've made a start on the
julia-0.6
branch, but more work remains. This is a tracking issue.The requirement is to replace all calls to
size
(orSize
) from within a@generated
function generator to outside of the generator, such as in the generated body, or by using an outer function which callsSize
and another@generated
one which unrolls expressions, etc (given the relevant sizes as an input).Here's a list of all the files/remaining tasks. Completed files should use v0.6 syntax/dispatch rules/etc (no Compat):
The text was updated successfully, but these errors were encountered: