-
Notifications
You must be signed in to change notification settings - Fork 191
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
isbits Fields and FieldSets #163
Comments
Related to this, I wanted to point something out: julia> struct Test
a::Array{Float64, 1}
end
julia> import Base: getindex
julia> getindex(t::Test, inds...) = getindex(t.a, inds...)
getindex (generic function with 196 methods)
julia> t = Test(rand(4))
Test([0.502462, 0.632246, 0.585965, 0.845577])
julia> @code_lowered t.a[2]
CodeInfo(
731 1 ─ %1 = (Base.arrayref)($(Expr(:boundscheck)), A, i1) │
└── return %1 │
)
julia> @code_lowered t[2]
CodeInfo(
1 1 ─ %1 = (Base.getproperty)(t, :a) │
│ %2 = (Core.tuple)(%1) │
│ %3 = (Core._apply)(Main.getindex, %2, inds) │
└── return %3 │
)
julia> @code_lowered @inbounds t.a[2]
CodeInfo(
538 1 ─ nothing │
│ %2 = (Base.Expr)(:inbounds, true) │
│ %3 = (Base.esc)(blk) │
│ %4 = (Base.Expr)(:(=), :val, %3) │
│ %5 = (Base.Expr)(:local, %4) │
│ %6 = (Base.Expr)(:inbounds, :pop) │
│ %7 = (Base.Expr)(:block, %2, %5, %6, :val) │
└── return %7 │
)
julia> @code_lowered @inbounds t[2]
\CodeInfo(
538 1 ─ nothing │
│ %2 = (Base.Expr)(:inbounds, true) │
│ %3 = (Base.esc)(blk) │
│ %4 = (Base.Expr)(:(=), :val, %3) │
│ %5 = (Base.Expr)(:local, %4) │
│ %6 = (Base.Expr)(:inbounds, :pop) │
│ %7 = (Base.Expr)(:block, %2, %5, %6, :val) │
└── return %7 │
) Note that the lowered code for an inbounds |
Another thing I noticed is that Specifically I'm referring to patterns like the RHS calculation for u, which is In other words, we only need one A separate issue with |
I propose we abandon this goal. We probably want to use shared memory in the future, which means that all of our functions need to operate on arrays --- and that renders the purpose of |
Hmmm, yeah I'll close it for now as we haven't discussed it in forever. The way the Which is fine, as long as the user interface is clean. |
Would be good to adapt our
Field
structs to beisbits
for CUDA kernels.Same with
FieldSet
structs, althoughFieldVector
s might be a good choice here. We would have to adaptFieldVector
ourselves though.See this PR for an example on how to adapt: JuliaArrays/OffsetArrays.jl#57
The text was updated successfully, but these errors were encountered: