-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hot patch for win64 alignment error segfault
this makes the taggedvalue struct a multiple of 16-bytes (on 64-bit platforms) so that the 16-byte gc-alignment is maintained, until we can fix the gc to hand out better aligned pointers
- Loading branch information
Showing
2 changed files
with
22 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0d8cec3
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.
@vtjnash
Heard about this yesterday. What are the precise alignment requirements ?
Is the 16-byte thing only for BLAS due to SSE constraints ?
If I'm not mistaken the GC will hand out 16-aligned addresses as long as the pool's object size is a multiple of 16 (since pool pages are 16k aligned). The GC itself only needs 4-byte alignment to use the 2 low bits of the type tag.
0d8cec3
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.
The gc was recently changed to offset the values it hands out by the size of a jl_taggedtype_t. In some cases, the compiler will assume that a struct is aligned to some larger boundary (up to some platform-defined limit -- on most modern platforms that limit being 16-bytes) and emit vmovsd or similar instructions accordingly
0d8cec3
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.
When compiling the C runtime or julia code ?
I'm not sure I understand why it only happens on windows.
Anyway, if we can't explain this 8 mod 16 alignment to the compiler we could still offset it in the gc. It would only waste a page (the first one) of committed memory but for some reason it feels wrong to me.
0d8cec3
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.
the jmp_buf for windows needs to save a lot more registers, including MMX. in linux, it only needs long int alignment to save a few registers. on darwin, it only demands int alignment.
this doesn't seem like it should waste a full page, just
16 - (sizeof(jl_taggedvalue_t) % 16)
bytes at the beginning0d8cec3
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.
Wouldn't this also waste a full page because of data at the end ? For e.g. a lot of 8 x 2k objects (gc) pages you'd either have to restrict every one of those to 7 objects or waste (most of) the last (vm) page right ?
Could we just treat the jmp_buf as a special case ?
0d8cec3
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.
we might want to shrink the objects by (2048-sizeof(jl_taggedvalue_t)) to accomodate
not really, since we want to be able to use avx/altivec instructions on any arbitrary type, such as 4xFloat32 tuples
0d8cec3
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.
We're not using vector type ABIs yet, so other types aren't a concern. So is it possible just to align jmp_bufs?