-
-
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
Segmentation faults with NTuple{2,NTuple{N,Core.VecElement{T}}}, but not NTuple{2N,Core.VecElement{T}} #30426
Comments
Sounds similar to #21959, although I thought were were handling that at the codegen level in most cases now. |
@vtjnash , could it at all be related to this: julia> @noinline function foo(a)
v = ntuple(Val(8)) do w Core.VecElement(Float64(w)) end
a, (v, (a,(1<<10,1<<20)))
end
foo (generic function with 1 method)
julia> foo(1)
(4607182418800017408, ((VecElement{Float64}(3.0), VecElement{Float64}(4.0), VecElement{Float64}(5.0), VecElement{Float64}(6.0), VecElement{Float64}(7.0), VecElement{Float64}(8.0), VecElement{Float64}(5.0e-324), VecElement{Float64}(5.06e-321)), (1048576, (14690820581056367, 140697086305440))))
julia> reinterpret(Float64, 4607182418800017408)
1.0
julia> reinterpret.(Float64,(1,1<<10))
(5.0e-324, 5.06e-321)
julia> 1<<20
1048576 ? The memory layout Julia uses for constructing the tuple looks different from what what it uses to deconstruct it. The first The last two elements of the tuple are filled with junk. Any idea about the cause or fix? |
Seems like a new issue: it looks like we're specifying the wrong sort of vector to LLVM for our desired alignment for Julia. |
Code in first post seems to work now. Can this be closed? @chriselrod |
Yes. |
when
N * sizeof(T) == 64
.I am showing results on a (4-day-old) master below, but I see the same behaviour on Julia 1.0.3:
When I use a tuple of 2 8-length (64-total-byte) vectors I get a segmentation fault.
When I use a tuple of 2 4-length (32-total-byte) vectors I get no segmentation fault.
It is the number of bytes that matters. When using
Float32
, I can reproduce with no-segfault (but incorrectly reported allocations) NTuple{32,...}, but segfault on NTuple{2,NTuple{16,...}}.I can reproduce the segmentation faults on both Ryzen and Skylake-X. I can try Haswell later.
Although this is obviously of more interest on Skylake-X (and other avx-512) architectures: because tuples of 32-byte vectors don't cause segfaults, I'd just not construct these tuples.
The workaround -- concatenating and then sub-setting larger vectors -- is a little awkward.
The text was updated successfully, but these errors were encountered: