-
-
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
layout optimization internal changes (support pointers inlining/unboxing into parents/codegen) [disabled] #33886
Conversation
57ad49d
to
a301cf9
Compare
I would vote for merging all the code, with stack allocation of temporaries enabled, but new memory layouts disabled. That can be enabled in a separate commit, to make it easier to revert if it is too breaking. |
Very cool! :) I look forward to trying this out. Can I ask - what are "first-class aggregates"? Would this include
This is interesting. How do you know if a given struct might contain
Just gonna say... this is going to pessimize some |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan |
IIUC, it shouldn't be worse than it is currently. |
No, of course - I didn't mean to imply otherwise, but was just musing over common patterns like iteration and |
This is currently inferred during lowering by taking the minimum of the number of arguments to |
a301cf9
to
149dc3a
Compare
Includes codegen support for immutable objects that contain pointers appearing on stack (well, in registers, since LLVM support of non-integral addrspace pointers inside aggregates in memory is poor), and includes layout support, so that most (non-self-referential) immutable objects can be stored inline inside their parent allocation. Currently fully disabled, aside from some optimizations and improvements to object_id / isa tests. Co-Authored-By: Oscar Blumberg <[email protected]>
149dc3a
to
5949e8c
Compare
return jl_islayout_inline(eltype, &fsz, &al); | ||
} | ||
|
||
// whether this type is unique'd by pointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// whether this type is unique'd by pointer | |
// whether instances of this type can use pointer comparison for `===` |
So... I seem to remember being able to put |
Nah, that’s always been unsafe and inadvisable. |
@@ -177,14 +177,20 @@ false | |||
isbitsunion(u::Union) = allocatedinline(u) | |||
isbitsunion(x) = false | |||
|
|||
function _unsetindex!(A::Array{T}, i::Int) where {T} | |||
@inbounds function _unsetindex!(A::Array{T}, i::Int) where {T} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does @inbounds
on a function do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supposed to be @inline
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #34127
Includes codegen support for immutable objects that contain pointers appearing on stack (well, in registers, since LLVM support of non-integral addrspace pointers inside aggregates in memory is poor), and includes layout support, so that most (non-self-referential) immutable objects can be stored inline inside their parent allocation. Currently fully disabled, aside from some optimizations and improvements to object_id / isa tests. Co-Authored-By: Oscar Blumberg <[email protected]>
This includes fairly general support for pointers inside immutable structs appearing in first class aggregates (FCA) throughout the system (e.g. gc, codegen, layout). Currently it's also pretty widely enabled, although we may want to disable it for the initial merge, then slowly enable larger pieces of it as we gain understanding of the effects on the ecosystem.
This replaces #18632. It solves the "fundamental problems" described in that PR with the following rules (these need to be added to the docs and NEWs):
references_name
), and thus couldn't qualify forisbits
, it also doesn't qualify for inlining. This solves the problem with cycles.Union{T, S}
will not inline ("union-split") if either T or S contains a pointer (wouldn't be legal to codegen this, and somewhat hard to describe to the gc)I'm interested in folks thoughts on how they'd like to see this land. Should I merge the support for each component in a separate commit (without users until all is done), or just land this as one big commit but disabled? One PR or several? And specific pieces you'd like to see land first?
@nanosoldier
runbenchmarks(ALL, vs=":master")