Skip to content
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

Building master branch crashes on Apple M1 #44107

Closed
fingolfin opened this issue Feb 10, 2022 · 33 comments · Fixed by #44279
Closed

Building master branch crashes on Apple M1 #44107

fingolfin opened this issue Feb 10, 2022 · 33 comments · Fixed by #44279
Labels
system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips
Milestone

Comments

@fingolfin
Copy link
Member

is building current Julia master crashing for anyone else? (i.e. commit aae68a5, on : macOS 12.2 (21D49) on Apple M1 Max, Xcode 13.2.1).

It builds fine for me on Ubuntu x86.

    JULIA usr/lib/julia/sys-o.a
Generating REPL precompile statements... 36/36
Executing precompile statements... 1962/2006
Precompilation complete. Summary:
Total ───────  71.210485 seconds
Generation ──  52.778831 seconds 74.1167%
Execution ───  18.431653 seconds 25.8833%
LLVM ERROR: failed to perform tail call elimination on a call site marked musttail

signal (6): Abort trap: 6
in expression starting at none:0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 158165722 (Pool: 158088219; Big: 77503); GC: 157
/bin/sh: line 1: 62460 Abort trap: 6           JULIA_BINDIR=/Users/mhorn/Projekte/Julia/julia.master/usr/bin WINEPATH="/Users/mhorn/Projekte/Julia/julia.master/usr/bin;$WINEPATH" /Users/mhorn/Projekte/Julia/julia.master/usr/bin/julia -O3 -C "apple-a12" --output-o /Users/mhorn/Projekte/Julia/julia.master/usr/lib/julia/sys-o.a.tmp --startup-file=no --warn-overwrite=yes --sysimage /Users/mhorn/Projekte/Julia/julia.master/usr/lib/julia/sys.ji /Users/mhorn/Projekte/Julia/julia.master/contrib/generate_precompile.jl 1
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [/Users/mhorn/Projekte/Julia/julia.master/usr/lib/julia/sys-o.a] Error 1
make: *** [julia-sysimg-release] Error 2
@theabhirath
Copy link
Contributor

theabhirath commented Feb 10, 2022

Facing the same issue on an M1 MacBook Air, macOS 12.2. XCode 13.2 as well.

@gbaraldi
Copy link
Member

Got the same issue and am bisecting, there were also a bunch of warnings added that weren't present before so let's see.

@gbaraldi
Copy link
Member

gbaraldi commented Feb 10, 2022

f090992 is the guilty commit according to bisect from #43852. Also a bunch of

./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
       struct {
       ^

warnings appeared.

@giordano giordano added the system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips label Feb 10, 2022
@giordano
Copy link
Contributor

That's not a segfault though, is it?

@fingolfin fingolfin changed the title Building master branch segfaults on Apple M1 Building master branch crashes on Apple M1 Feb 10, 2022
@fingolfin
Copy link
Member Author

Indeed it isn't

@ngam
Copy link

ngam commented Feb 12, 2022

@fingolfin nice to see you here too :)

I am wondering if this is by design or a rule of thumb about building julia on new hardware (e.g. M1 Macs) or in general --- 1.7.2 works fine (a lot of tests still fail if you attempt run "all"... ) but master branch bombs (I think the error I get is identical to the above)

@ngam
Copy link

ngam commented Feb 12, 2022

f090992 is the guilty commit according to bisect from #43852. Also a bunch of

./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
       struct {
       ^

warnings appeared.

Oh noooo, @Keno 😢 I actually tried to build the master branch just to test this PR 😆

@giordano
Copy link
Contributor

I am wondering if this is by design or a rule of thumb about building julia on new hardware (e.g. M1 Macs) or in general

This platforms is currently in Tier 3 of support, this means there is currently no CI for aarch64-apple-darwin, so the failure couldn't be caught during the review of the pull request.

@ngam
Copy link

ngam commented Feb 12, 2022

I am wondering if this is by design or a rule of thumb about building julia on new hardware (e.g. M1 Macs) or in general

This platforms is currently in Tier 3 of support, this means there is currently no CI for aarch64-apple-darwin, so the failure couldn't be caught during the review of the pull request.

No, no I understand that --- to clarify, I meant: usually the "tagged" items are like guaranteed, but master isn't it exactly like that since it is not a release. Or do we consider master stable enough as almost like a pseudo-release?

@ngam
Copy link

ngam commented Feb 12, 2022

Then again M1 shouldn't be considered stable at all, I guess. But in general for other hardware, master vis-a-vis tags?

@giordano
Copy link
Contributor

Then again M1 shouldn't be considered stable at all, I guess

Who said otherwise?

But in general for other hardware, master vis-a-vis tags?

Not sure what that means.

@ngam
Copy link

ngam commented Feb 12, 2022

Then again M1 shouldn't be considered stable at all, I guess

Who said otherwise?

But in general for other hardware, master vis-a-vis tags?

Not sure what that means.

Don't worry about it 😄 I am glad it wasn't just me, hopefully we will be able to test that PR soon since it seemed pretty impressive!

@vchuravy vchuravy added this to the 1.8 milestone Feb 12, 2022
@truedichotomy
Copy link

truedichotomy commented Feb 13, 2022

I see many more warnings with the latest commit on master (6c16f71).

(base) gong@mac julia % make
    PERL base/pcre_h.jl
    PERL base/errno_h.jl
    PERL base/build_h.jl.phony
    PERL base/features_h.jl
    PERL base/features_h.jl
    PERL base/features_h.jl
    PERL base/file_constants.jl
    PERL base/uv_constants.jl
    PERL base/version_git.jl.phony
    CC cli/loader_exe.o
    CC cli/loader_lib.o
    CC cli/loader_trampolines.o
    LINK usr/lib/libjulia.1.8.dylib
    LINK usr/lib/libjulia.dylib
    LINK usr/bin/julia
    FLISP src/julia_flisp.boot
    FLISP src/julia_flisp.boot.inc
    CC src/jloptions.o
    CC src/runtime_ccall.o
In file included from /Users/gong/GitHub/julia/src/runtime_ccall.cpp:10:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/rtutils.o
    CC src/jltypes.o
    CC src/gf.o
    CC src/typemap.o
    CC src/smallintset.o
    CC src/ast.o
    CC src/builtins.o
    CC src/module.o
    CC src/interpreter.o
    CC src/symbol.o
    CC src/dlload.o
    CC src/sys.o
    CC src/init.o
    CC src/task.o
    CC src/array.o
    CC src/dump.o
    CC src/staticdata.o
/Users/gong/GitHub/julia/src/staticdata.c:1709:33: warning: incompatible function pointer types passing 'void (jl_methtable_t *, void *)' (aka 'void (struct _jl_methtable_t *, void *)') to parameter of type 'int (*)(jl_methtable_t *, void *)' (aka 'int (*)(struct _jl_methtable_t *, void *)') [-Wincompatible-function-pointer-types]
    jl_foreach_reachable_mtable(set_nroots_sysimg_, NULL);
                                ^~~~~~~~~~~~~~~~~~
./julia_internal.h:615:39: note: passing argument to parameter 'visit' here
int jl_foreach_reachable_mtable(int (*visit)(jl_methtable_t *mt, void *env), void *env);
                                      ^
1 warning generated.
    CC src/toplevel.o
    CC src/jl_uv.o
    CC src/datatype.o
    CC src/simplevector.o
    CC src/runtime_intrinsics.o
    CC src/precompile.o
    CC src/threading.o
    CC src/partr.o
    CC src/stackwalk.o
    CC src/gc.o
    CC src/gc-debug.o
    CC src/gc-pages.o
    CC src/gc-stacks.o
    CC src/gc-alloc-profiler.o
In file included from /Users/gong/GitHub/julia/src/gc-alloc-profiler.cpp:3:
In file included from ./gc-alloc-profiler.h:6:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/method.o
    CC src/jlapi.o
    CC src/signal-handling.o
/Users/gong/GitHub/julia/src/signal-handling.c:117:15: warning: unused function 'jl_safe_read_mem' [-Wunused-function]
static size_t jl_safe_read_mem(const volatile char *ptr, char *out, size_t len)
              ^
1 warning generated.
    CC src/safepoint.o
    CC src/timing.o
    CC src/subtype.o
    CC src/crc32c.o
'++crc' is not a recognized feature for this target (ignoring feature)
'++crc' is not a recognized feature for this target (ignoring feature)
    CC src/APInt-C.o
In file included from /Users/gong/GitHub/julia/src/APInt-C.cpp:10:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/processor.o
In file included from /Users/gong/GitHub/julia/src/processor.cpp:10:
In file included from ./processor.h:5:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
In file included from /Users/gong/GitHub/julia/src/processor.cpp:847:
./processor_arm.cpp:1815:40: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
    asm volatile("mrs %0, fpcr" : "=r"(fpcr));
                                       ^
./processor_arm.cpp:1815:23: note: use constraint modifier "w"
    asm volatile("mrs %0, fpcr" : "=r"(fpcr));
                      ^~
                      %w0
./processor_arm.cpp:1821:40: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
    asm volatile("msr fpcr, %0" :: "r"(fpcr));
                                       ^
./processor_arm.cpp:1821:29: note: use constraint modifier "w"
    asm volatile("msr fpcr, %0" :: "r"(fpcr));
                            ^~
                            %w0
4 warnings generated.
    CC src/ircode.o
    CC src/opaque_closure.o
    CC src/codegen-stubs.o
    CC src/coverage.o
In file included from /Users/gong/GitHub/julia/src/coverage.cpp:13:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    LINK usr/lib/libjulia-internal.1.8.dylib
    LINK usr/lib/libjulia-internal.1.dylib
    LINK usr/lib/libjulia-internal.dylib
    CC src/codegen.o
In file included from /Users/gong/GitHub/julia/src/codegen.cpp:169:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-ptls.o
In file included from /Users/gong/GitHub/julia/src/llvm-ptls.cpp:26:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/jitlayers.o
In file included from /Users/gong/GitHub/julia/src/jitlayers.cpp:30:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
/Users/gong/GitHub/julia/src/jitlayers.cpp:1016:4: warning: #warning is a language extension [-Wpedantic]
#  warning "JIT debugging (GDB integration) not available on LLVM < 14.0 (for JITLink)"
   ^
/Users/gong/GitHub/julia/src/jitlayers.cpp:1016:4: warning: "JIT debugging (GDB integration) not available on LLVM < 14.0 (for JITLink)" [-W#warnings]
4 warnings generated.
    CC src/aotcompile.o
In file included from /Users/gong/GitHub/julia/src/aotcompile.cpp:60:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/debuginfo.o
In file included from /Users/gong/GitHub/julia/src/debuginfo.cpp:25:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/disasm.o
In file included from /Users/gong/GitHub/julia/src/disasm.cpp:111:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-simdloop.o
    CC src/llvm-muladd.o
In file included from /Users/gong/GitHub/julia/src/llvm-muladd.cpp:22:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-final-gc-lowering.o
In file included from /Users/gong/GitHub/julia/src/llvm-final-gc-lowering.cpp:14:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-pass-helpers.o
In file included from /Users/gong/GitHub/julia/src/llvm-pass-helpers.cpp:15:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-late-gc-lowering.o
In file included from /Users/gong/GitHub/julia/src/llvm-late-gc-lowering.cpp:31:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-lower-handlers.o
In file included from /Users/gong/GitHub/julia/src/llvm-lower-handlers.cpp:22:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-gc-invariant-verifier.o
In file included from /Users/gong/GitHub/julia/src/llvm-gc-invariant-verifier.cpp:28:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-propagate-addrspaces.o
In file included from /Users/gong/GitHub/julia/src/llvm-propagate-addrspaces.cpp:25:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-multiversioning.o
In file included from /Users/gong/GitHub/julia/src/llvm-multiversioning.cpp:28:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-alloc-opt.o
In file included from /Users/gong/GitHub/julia/src/llvm-alloc-opt.cpp:29:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-alloc-helpers.o
In file included from /Users/gong/GitHub/julia/src/llvm-alloc-helpers.cpp:5:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/cgmemmgr.o
In file included from /Users/gong/GitHub/julia/src/cgmemmgr.cpp:7:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-remove-addrspaces.o
In file included from /Users/gong/GitHub/julia/src/llvm-remove-addrspaces.cpp:15:
In file included from ./codegen_shared.h:9:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-remove-ni.o
In file included from /Users/gong/GitHub/julia/src/llvm-remove-ni.cpp:10:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-julia-licm.o
In file included from /Users/gong/GitHub/julia/src/llvm-julia-licm.cpp:14:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    CC src/llvm-demote-float16.o
    CC src/llvm-cpufeatures.o
In file included from /Users/gong/GitHub/julia/src/llvm-cpufeatures.cpp:26:
./julia.h:397:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:406:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
    LINK usr/lib/libjulia-codegen.1.8.dylib
    LINK usr/lib/libjulia-codegen.1.dylib
    LINK usr/lib/libjulia-codegen.dylib
    JULIA usr/lib/julia/corecompiler.ji
Core.Compiler ──── 28.319 seconds
    JULIA usr/lib/julia/sys.ji
coreio.jl
exports.jl
essentials.jl
ctypes.jl
gcutils.jl
generator.jl
reflection.jl
options.jl
promotion.jl
tuple.jl
expr.jl
pair.jl
traits.jl
range.jl
error.jl
bool.jl
number.jl
int.jl
operators.jl
pointer.jl
refvalue.jl
refpointer.jl
checked.jl
strings/lazy.jl
indices.jl
array.jl
abstractarray.jl
subarray.jl
views.jl
baseext.jl
ntuple.jl
abstractdict.jl
iddict.jl
idset.jl
iterators.jl
namedtuple.jl
./build_h.jl
./version_git.jl
hashing.jl
rounding.jl
div.jl
float.jl
twiceprecision.jl
complex.jl
rational.jl
multinverses.jl
abstractarraymath.jl
arraymath.jl
simdloop.jl
reduce.jl
reshapedarray.jl
reinterpretarray.jl
bitarray.jl
bitset.jl
multimedia.jl
some.jl
dict.jl
abstractset.jl
set.jl
char.jl
strings/basic.jl
strings/string.jl
strings/substring.jl
osutils.jl
c.jl
io.jl
iobuffer.jl
intfuncs.jl
strings/strings.jl
strings/search.jl
strings/unicode.jl
strings/util.jl
strings/io.jl
regex.jl
pcre.jl
./pcre_h.jl
parse.jl
shell.jl
show.jl
compiler/ssair/show.jl
arrayshow.jl
methodshow.jl
cartesian.jl
multidimensional.jl
broadcast.jl
missing.jl
version.jl
sysinfo.jl
libc.jl
./errno_h.jl
libdl.jl
logging.jl
linked_list.jl
condition.jl
threads.jl
threadingconstructs.jl
atomics.jl
locks-mt.jl
lock.jl
channels.jl
task.jl
threads_overloads.jl
weakkeydict.jl
env.jl
binaryplatforms.jl
cpuid.jl
./features_h.jl
libuv.jl
./uv_constants.jl
asyncevent.jl
iostream.jl
stream.jl
filesystem.jl
path.jl
stat.jl
file.jl
./file_constants.jl
cmd.jl
process.jl
ttyhascolor.jl
secretbuffer.jl
randomdevice.jl
floatfuncs.jl
math.jl
special/cbrt.jl
special/exp.jl
special/hyperbolic.jl
special/trig.jl
special/rem_pio2.jl
special/log.jl
reducedim.jl
accumulate.jl
permuteddimsarray.jl
ordering.jl
sort.jl
fastmath.jl
Enums.jl
gmp.jl
ryu/Ryu.jl
ryu/utils.jl
ryu/shortest.jl
ryu/fixed.jl
ryu/exp.jl
mpfr.jl
combinatorics.jl
irrationals.jl
mathconstants.jl
meta.jl
stacktraces.jl
experimental.jl
opaque_closure.jl
deepcopy.jl
download.jl
summarysize.jl
errorshow.jl
initdefs.jl
threadcall.jl
uuid.jl
pkgid.jl
toml_parser.jl
loading.jl
timing.jl
util.jl
asyncmap.jl
deprecated.jl
docs/basedocs.jl
client.jl
docs/Docs.jl
docs/bindings.jl
docs/utils.jl
Base  ───────────── 14.178758 seconds
ArgTools  ─────────  2.531217 seconds
Artifacts  ────────  0.063541 seconds
Base64  ───────────  0.061001 seconds
CRC32c  ───────────  0.005136 seconds
FileWatching  ─────  0.065909 seconds
Libdl  ────────────  0.002190 seconds
Logging  ──────────  0.022526 seconds
Mmap  ─────────────  0.050645 seconds
NetworkOptions  ───  0.068903 seconds
SHA  ──────────────  0.108535 seconds
Serialization  ────  0.158214 seconds
Sockets  ──────────  0.192383 seconds
Unicode  ──────────  0.044128 seconds
DelimitedFiles  ───  0.061432 seconds
LinearAlgebra  ────  5.266818 seconds
Markdown  ─────────  0.439116 seconds
Printf  ───────────  0.088090 seconds
Random  ───────────  0.733423 seconds
Tar  ──────────────  0.166660 seconds
Dates  ────────────  0.909628 seconds
Distributed  ──────  0.440892 seconds
Future  ───────────  0.004470 seconds
InteractiveUtils  ─  0.240830 seconds
LibGit2  ──────────  0.816253 seconds
Profile  ──────────  0.274617 seconds
SparseArrays  ─────  1.947869 seconds
UUIDs  ────────────  0.010143 seconds
REPL  ─────────────  2.122485 seconds
SharedArrays  ─────  0.291869 seconds
Statistics  ───────  0.113225 seconds
SuiteSparse  ──────  0.901692 seconds
TOML  ─────────────  0.042251 seconds
Test  ─────────────  0.191280 seconds
LibCURL  ──────────  0.239219 seconds
Downloads  ────────  0.194281 seconds
Pkg  ──────────────  2.692248 seconds
LazyArtifacts  ────  0.002312 seconds
Stdlibs total  ──── 21.570620 seconds
Sysimage built. Summary:
Total ───────  35.750053 seconds 
Base: ───────  14.178758 seconds 39.6608%
Stdlibs: ────  21.570620 seconds 60.3373%
    JULIA usr/lib/julia/sys-o.a
Generating REPL precompile statements... 36/36
Executing precompile statements... 1966/2010
Precompilation complete. Summary:
Total ───────  64.233143 seconds
Generation ──  47.976136 seconds 74.6906%
Execution ───  16.257007 seconds 25.3094%
LLVM ERROR: failed to perform tail call elimination on a call site marked musttail

signal (6): Abort trap: 6
in expression starting at none:0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 158354666 (Pool: 158277106; Big: 77560); GC: 159
/bin/sh: line 1: 18314 Abort trap: 6           JULIA_BINDIR=/Users/gong/GitHub/julia/usr/bin WINEPATH="/Users/gong/GitHub/julia/usr/bin;$WINEPATH" /Users/gong/GitHub/julia/usr/bin/julia -O3 -C "apple-a12" --output-o /Users/gong/GitHub/julia/usr/lib/julia/sys-o.a.tmp --startup-file=no --warn-overwrite=yes --sysimage /Users/gong/GitHub/julia/usr/lib/julia/sys.ji /Users/gong/GitHub/julia/contrib/generate_precompile.jl 1
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [/Users/gong/GitHub/julia/usr/lib/julia/sys-o.a] Error 1
make: *** [julia-sysimg-release] Error 2

@staticfloat
Copy link
Member

Looking into this a bit, I used lldb to figure out that we're crashing while compiling/running this eval in boot.jl. While googling around, I found this old commit, and that made me suspect the ccall() in the code chunk currently being compiled. This made me look into the musttail annotation that gets applied to ccall() invocations, and so I tried turning that off, which worked around the error:

diff --git a/src/ccall.cpp b/src/ccall.cpp
index 332c057afa..72b0536025 100644
--- a/src/ccall.cpp
+++ b/src/ccall.cpp
@@ -233,8 +233,8 @@ static GlobalVariable *emit_plt_thunk(
     else {
         // musttail support is very bad on ARM, PPC, PPC64 (as of LLVM 3.9)
         // Known failures includes vararg (not needed here) and sret.
-#if (defined(_CPU_X86_) || defined(_CPU_X86_64_) || \
-                        defined(_CPU_AARCH64_))
+#if (defined(_CPU_X86_) || defined(_CPU_X86_64_))
+                        //defined(_CPU_AARCH64_))
         // Ref https://bugs.llvm.org/show_bug.cgi?id=47058
         // LLVM, as of 10.0.1 emits wrong/worse code when musttail is set
         if (!attrs.hasAttrSomewhere(Attribute::ByVal))

I have no idea if this is a long-term solution though, and I have no idea why this would be triggered now.

@truedichotomy
Copy link

I saw this bit about musttail in the Clang 13.0.0 release note, is it relevant for this bug?

@gbaraldi
Copy link
Member

That note is relevant, I'm just not sure why no other archs get this error, specially aarch64 linux. That ccall specifically was changed in the purity modeling PR. I wonder if it has to do with the differences in ABI that might spook LLVM out.

@ngam
Copy link

ngam commented Feb 16, 2022

@staticfloat @gbaraldi @truedichotomy would you expect this change above to matter for the tests? Running Base.runtests(["all"]; ncores=ceil(Int, Sys.CPU_THREADS)) has returned [this error for me] (#43774 (comment)) and errors in Pkg (no method matching getindex(::Nothing, ::String)) and cmdlineargs (Segmentation fault).

Looks pretty significant (in a good way; previously I had quite a few more tests failing) to me...

(edit: sorry I missed the two errors in cmdlineargs and Pkg; some bits below)
(edit: not really sure if this is an error or not: #43774 (comment))

Test Summary:                             |     Pass  Fail  Error  Broken     Total      Time
  Overall                                 | 40069323     2      2  352663  40421990  96m41.6s
    LinearAlgebra/qr                      |     4700                           4700   1m53.6s
    LinearAlgebra/schur                   |      496                            496   1m59.6s
    LinearAlgebra/dense                   |     8475                           8475   4m10.6s
    LinearAlgebra/matmul                  |     1414                           1414   4m44.8s
    LinearAlgebra/eigen                   |      512                            512     34.3s
    LinearAlgebra/special                 |     2911                           2911   1m29.8s
    LinearAlgebra/bunchkaufman            |     5688                           5688     49.2s
    LinearAlgebra/svd                     |      566                            566     50.3s
    LinearAlgebra/lapack                  |      803                            803     31.7s
    LinearAlgebra/tridiag                 |     1541                           1541   1m00.1s
    LinearAlgebra/cholesky                |     2509                           2509   2m12.7s
    LinearAlgebra/triangular              |    37894                          37894   8m47.7s
    LinearAlgebra/bidiag                  |     4736                           4736   4m55.6s
    LinearAlgebra/lu                      |     1367                           1367   1m52.0s
    LinearAlgebra/generic                 |      585                            585   1m44.1s
    LinearAlgebra/uniformscaling          |      446                            446   2m53.3s
    LinearAlgebra/lq                      |     2938                           2938   2m37.1s
    LinearAlgebra/blas                    |      832                            832   1m13.7s
    LinearAlgebra/hessenberg              |      631                            631   2m52.9s
    LinearAlgebra/diagonal                |     2872                           2872  10m44.7s
    LinearAlgebra/givens                  |     1847                           1847     21.4s
    LinearAlgebra/pinv                    |      292                            292     44.4s
    LinearAlgebra/symmetric               |     2823                           2823   8m59.9s
    LinearAlgebra/ldlt                    |        8                              8      4.0s
    LinearAlgebra/adjtrans                |      347                            347   1m55.0s
    LinearAlgebra/factorization           |       80                   16        96     16.4s
    ambiguous                             |      107                    2       109     21.2s
    compiler/validation                   |       28                             28      1.1s
    compiler/ssair                        |       40                             40      7.4s
    compiler/irpasses                     |      110                    2       112      9.2s
    compiler/codegen                      |      171                            171     44.1s
    compiler/inference                    |     1182                    2      1184   1m26.9s
    compiler/contextual                   |       12                             12      5.4s
    compiler/inline                       |      133                    1       134     27.5s
    compiler/EscapeAnalysis/interprocedural |       32                    4        36     26.5s
    compiler/EscapeAnalysis/local         |      347                   21       368     44.5s
    LinearAlgebra/structuredbroadcast     |      670                            670   3m32.5s
    strings/search                        |      876                            876     13.2s
    strings/basic                         |    87676                          87676     30.7s
    strings/io                            |    12764                          12764     25.2s
    strings/util                          |     1147                           1147     50.6s
    unicode/utf8                          |       19                             19      0.6s
    strings/types                         |  2302691                        2302691     19.8s
    worlds                                |       88                             88      9.1s
    atomics                               |     3448                           3448   1m09.5s
    keywordargs                           |      151                            151     10.2s
    core                                  |  8445917                    3   8445920   5m14.9s
    numbers                               |  1578758                    2   1578760   4m15.4s
    char                                  |     1628                           1628     11.8s
    triplequote                           |       29                             29      0.3s
    subtype                               |   337674                   19    337693     51.7s
    intrinsics                            |      301                            301     10.4s
    hashing                               |    12519                          12519     57.9s
    iobuffer                              |      209                            209      5.7s
    staged                                |       65                             65      8.9s
    dict                                  |   144420                         144420   2m33.7s
    offsetarray                           |      487                    3       490   4m05.1s
    tuple                                 |      626                            626     32.1s
    reduce                                |     8588                           8588   2m02.0s
    subarray                              |   318316                         318316  18m48.7s
    arrayops                              |     2025                    2      2027   9m44.3s
    reducedim                             |     1089                    6      1095   4m26.1s
    simdloop                              |      240                            240      8.3s
    vecelement                            |      678                            678     14.8s
    rational                              |    98639                    1     98640   1m09.5s
    intfuncs                              |   227876                         227876   1m53.9s
    copy                                  |      533                            533     19.8s
    LinearAlgebra/addmul                  |     6498                           6498  25m30.6s
    fastmath                              |      946                            946     22.5s
    functional                            |       98                             98     15.3s
    math                                  |  1722141                        1722141   1m43.7s
    operators                             |    13040                          13040     27.1s
    ordering                              |       37                             37      8.4s
    path                                  |      373                   12       385      4.7s
    ccall                                 |   165125                    1    165126   1m32.5s
    abstractarray                         |    55190                24795     79985   7m20.6s
    parse                                 |    16098                          16098     27.7s
    gmp                                   |     2357                           2357     24.2s
    loading                               |   152415                         152415   1m44.0s
    spawn                                 |      248                    4       252   1m43.9s
    iterators                             |    10164                          10164   6m43.9s
    exceptions                            |       70                             70      6.7s
    backtrace                             |       38                    1        39     19.6s
    file                                  |     1073                           1073     24.9s
    version                               |     2452                           2452      2.9s
    namedtuple                            |      216                            216     11.7s
    mpfr                                  |     1135                    1      1136     53.6s
    read                                  |     3872                           3872   3m05.3s
    sorting                               |    16099                    9     16108   6m41.4s
    floatapprox                           |       49                             49     19.5s
    reflection                            |      414                            414     36.7s
    complex                               |     8479                    2      8481   1m26.2s
    regex                                 |      130                            130      9.1s
    bitarray                              |   915582                         915582  13m35.8s
    sysinfo                               |        4                              4      1.0s
    float16                               |   762093                         762093     30.1s
    env                                   |       57                             57      2.2s
    combinatorics                         |      170                            170     26.9s
    mod2pi                                |       80                             80      3.1s
    euler                                 |       12                             12      7.0s
    rounding                              |   112720                         112720     36.3s
    client                                |        5                              5     12.8s
    errorshow                             |      237                            237     28.4s
    show                                  |   128883                    8    128891   2m59.9s
    goto                                  |       19                             19      0.2s
    llvmcall                              |       19                             19      2.5s
    llvmcall2                             |        7                              7      0.1s
    ryu                                   |    31215                          31215      4.1s
    sets                                  |     3619                    1      3620   2m06.6s
    some                                  |       72                             72      6.2s
    stacktraces                           |       48                             48      5.9s
    meta                                  |       69                             69     16.2s
    broadcast                             |      511                            511   7m21.1s
    ranges                                | 12110733               327682  12438415   3m50.8s
    docs                                  |      238                            238     29.1s
    atexit                                |       40                             40     13.1s
    binaryplatforms                       |      341                            341     21.9s
    enums                                 |       99                             99     18.1s
    interpreter                           |        3                              3      3.1s
    checked                               |     1239                           1239     21.7s
    int                                   |   524698                         524698     42.2s
    bitset                                |      195                            195     33.7s
    boundscheck                           |                                    None      6.5s
    error                                 |       32                             32      9.2s
    misc                                  |  1282248                        1282248   2m16.1s
    osutils                               |       43                             43      3.3s
    cartesian                             |      343                    3       346     57.4s
    iostream                              |       50                             50      6.1s
    secretbuffer                          |       27                             27     29.6s
    specificity                           |      175                            175      0.7s
    channels                              |      258                            258   1m09.5s
    syntax                                |     1582                    1      1583     47.7s
    corelogging                           |      231                            231     22.2s
    reinterpretarray                      |      418                            418   2m00.9s
    cmdlineargs                           |      269     1              3       273   5m14.5s
    smallarrayshrink                      |       36                             36      2.0s
    opaque_closure                        |       55                    1        56      1.2s
    filesystem                            |        6                              6      0.2s
    download                              |                                    None     31.7s
    missing                               |      574                    1       575   2m08.4s
    asyncmap                              |      307                            307   1m37.4s
    SparseArrays/higherorderfns           |     7145                    1      7146   1m51.7s
    LibGit2/online                        |       10                             10      5.6s
    floatfuncs                            |      232                            232   8m18.2s
    LibGit2/libgit2                       |      754                            754   1m34.6s
    Dates/accessors                       |  7723858                        7723858     34.3s
    Dates/adjusters                       |     3149                           3149      8.8s
    Dates/query                           |     1004                           1004      7.8s
    Dates/periods                         |      953                            953      9.3s
    Dates/rounding                        |      315                            315      1.4s
    Dates/types                           |      232                            232      1.7s
    Dates/io                              |      332                            332     10.6s
    Dates/arithmetic                      |      385                            385      6.9s
    Dates/conversions                     |      161                            161      1.2s
    ArgTools                              |      180                            180     15.3s
    Artifacts                             |     1452                           1452     13.9s
    Base64                                |     2022                           2022      5.4s
    CRC32c                                |      664                            664      1.3s
    CompilerSupportLibraries_jll          |        4                              4      3.8s
    DelimitedFiles                        |       89                             89      6.2s
    Dates/ranges                          |   350637                         350637   1m54.8s
    Downloads                             |      238                            238   1m29.6s
    Future                                |                                    None      0.0s
    GMP_jll                               |        1                              1      3.5s
    FileWatching                          |      510                            510   1m02.3s
    LLVMLibUnwind_jll                     |        7                              7      4.1s
    LazyArtifacts                         |        4                              4      7.3s
    LibCURL                               |        6                              6      2.7s
    LibCURL_jll                           |        1                              1      0.2s
    LibGit2_jll                           |        2                              2      1.3s
    LibSSH2_jll                           |                                    None      0.1s
    LibUV_jll                             |        1                              1      0.8s
    LibUnwind_jll                         |                                    None      0.4s
    InteractiveUtils                      |      279                            279     32.6s
    Libdl                                 |       76                    1        77      6.8s
    MPFR_jll                              |        1                              1      0.7s
    Logging                               |       40                             40      3.3s
    MbedTLS_jll                           |        1                              1      0.1s
    Mmap                                  |      140                            140     14.2s
    MozillaCACerts_jll                    |        1                              1      0.1s
    NetworkOptions                        |     3518                           3518      3.3s
    OpenBLAS_jll                          |        1                              1      1.4s
    OpenLibm_jll                          |        1                              1      0.4s
    PCRE2_jll                             |        2                              2      0.3s
    Markdown                              |      257                            257     45.7s
    Printf                                |     1014                           1014   1m08.8s
    Profile                               |      111                            111   2m50.6s
    REPL                                  |     1421                    3      1424   2m50.3s
    Random                                |   204291                         204291   4m08.9s
    SHA                                   |      107                            107   1m26.1s
    Serialization                         |      126                    1       127   1m26.3s
    Sockets                               |      172                            172     31.4s
    SparseArrays/sparsevector             |    10348                    4     10352  22m06.7s
    Pkg                                   |     2373     1      2       2      2378  19m46.1s
    SuiteSparse_jll                       |        1                              1      5.3s
    TOML                                  |      415                    8       423      8.2s
    Tar                                   |     3161                   11      3172     34.9s
    Test                                  |      454                   17       471     30.7s
    UUIDs                                 |     1029                           1029      0.5s
    Unicode                               |      776                            776      3.3s
    Zlib_jll                              |        1                              1      0.3s
    dSFMT_jll                             |        1                              1      0.3s
    libLLVM_jll                           |        1                              1      0.3s
    libblastrampoline_jll                 |        1                              1      0.0s
    nghttp2_jll                           |        1                              1      0.0s
    p7zip_jll                             |        1                              1      0.0s
    Statistics                            |      804                            804   7m44.2s
    SparseArrays/sparse                   |     4299                           4299  30m31.7s
    SuiteSparse                           |     1293                           1293   8m33.3s
    precompile                            |      135                    6       141     17.2s
    SharedArrays                          |      114                            114     11.4s
    threads                               |       37                             37   1m27.8s
    Distributed                           |       12                             12   1m25.3s
    stress                                |      118                            118      8.1s
    FAILURE

Test Failed ... julia/usr/share/julia/test/cmdlineargs.jl:249
  Expression: read(`$exename -p2 -t2 -e $code`, String) == "6"
   Evaluated: "6      From worker 2:\t\n      From worker 2:\tsignal (11): Segmentation fault: 11\n      From worker 2:\tin expression starting at none:0\n      From worker 2:\t\n      From worker 2:\tsignal (11): Segmentation fault: 11\n      From worker 2:\tin expression starting at none:0\n      From worker 2:\t\n 
...

Test Failed ... julia/usr/share/julia/stdlib/v1.8/Pkg/test/new.jl:2804
  Expression: meta !== nothing
   Evaluated: nothing !== nothing
...

Error During Test ... julia/usr/share/julia/stdlib/v1.8/Pkg/test/new.jl:2767
  Got exception outside of a @test
  MethodError: no method matching getindex(::Nothing, ::String)
  Stacktrace:
...

Error During Test ... julia/usr/share/julia/stdlib/v1.8/Pkg/test/artifacts.jl:323
  Got exception outside of a @test
  Package ArtifactInstallation errored during testing
  Stacktrace:
...

ERROR: LoadError: Test run finished with errors
in expression starting at ... julia/usr/share/julia/test/runtests.jl:93
...

ERROR: A test has failed. Please submit a bug report (https://github.com/JuliaLang/julia/issues)
including error messages above and the output of versioninfo():
Julia Version 1.8.0-DEV.1571
Commit 95f7ce243d* (2022-02-16 20:22 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.3.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] runtests(tests::Vector{String}; ncores::Int64, exit_on_error::Bool, revise::Bool, seed::Nothing)
   @ Base ./util.jl:596
 [3] top-level scope
   @ REPL[3]:1
...

@gbaraldi
Copy link
Member

I wouldn't be surprised if that broke ccall in some places.

@gbaraldi
Copy link
Member

I spun up an ampere instance to try it out and it built fine, and it gave none of the anonymous type warnings. I wonder if that is a difference of GCC vs clang. One thing to try out is using a different another clang instead of apple clang to build to see if it makes a difference.

@staticfloat
Copy link
Member

I think the clang thing is a red herring; LLVM is choking on Julia-generated code, not clang-generated code. I think there's something about the LLVM IR that we're generating that is causing the issue. It could be a real problem with our IR, or it could be LLVM being overly-picky, it's hard to say, as I don't know LLVM well enough to track that down.

My guess as to why it doesn't trigger on aarch64 linux is because there are a number of significant differences between the two ever since 955d427 was merged.

@gbaraldi
Copy link
Member

gbaraldi commented Feb 17, 2022

What I meant about that is that i don't get those warnings anywhere else except apple. However I saw that someone got them on an x86 build so I have no idea.
Edit: on latest master the LLVM ERROR changed to a place before what is mentioned in OP it errors in corecompiler.ji

@truedichotomy
Copy link

Has anyone tried to build Julia using LLVM 14 to see if it makes any difference?

@fingolfin
Copy link
Member Author

fingolfin commented Feb 17, 2022

The JIT code generation for Apple M1 in Julia currently uses a different code path than all other supported architectures (see PR #43664 by @dnadlinger). Most likely this contributes to the issue and is why things work fine everywhere else. The PR by @Keno which broke things must might interact differently with JITLink than with the previous code generation.

@dnadlinger
Copy link
Member

Hmm, at first glance, I'm not sure how this would relate to JITLink; the code generation itself by and large still uses the same code path, only the linker stage is different. One difference would be the code model setting, but surely that can't be related to this error? Unfortunately, I don't have the bandwidth to look into this right now.

@fingolfin
Copy link
Member Author

@dnadlinger sorry, what I wrote might be total nonsense: my main goal here was to point out that some things are very different on Apple M1, so it is not that surprising that an issue only occurs there and not elsewhere.

@dnadlinger
Copy link
Member

Oh, no, you certainly have a point, it is a significant difference and possibly related. What I meant is that it isn't exactly obvious why JITLink should cause any issue either, as it should only come in after the codegen stage. Depending on how easy the issue is to trigger, it might be interesting to disable JITLink again and see if it still breaks (don't set JL_USE_JITLINK).

@gbaraldi
Copy link
Member

After grepping llvm for the error I found https://github.com/llvm/llvm-project/blob/d1cd64ffdd832220dbe1829c2f09b880be67be31/llvm/test/CodeGen/AArch64/GlobalISel/call-translator-musttail.ll which is suspicious. I don't know llvm enough to understand if our function would fall into that case.
The llvm IR of the function that gives the problem is:

define nonnull {} addrspace(10)* @jlplt_ijl_new_codeinst_1127({} addrspace(10)* %0, {} addrspace(10)* %1, {} addrspace(10)* %2, {} addrspace(10)* %3, i32 %4, i64 %5, i64 %6, i8 zeroext %7, i8 zeroext %8, {} addrspace(10)* %9, i8 zeroext %10) {
top:
  %11 = load atomic void ()*, void ()** @ccall_ijl_new_codeinst_1126 unordered, align 8
  %12 = icmp ne void ()* %11, null
  br i1 %12, label %ccall, label %dlsym

dlsym:                                            ; preds = %top
  %13 = call void ()* @ijl_load_and_lookup(i8* null, i8* getelementptr inbounds ([17 x i8], [17 x i8]* inttoptr (i64 105553146517520 to [17 x i8]*), i32 0, i32 0), i8** @jl_RTLD_DEFAULT_handle)
  store atomic void ()* %13, void ()** @ccall_ijl_new_codeinst_1126 release, align 8
  br label %ccall

ccall:                                            ; preds = %dlsym, %top
  %14 = phi void ()* [ %11, %top ], [ %13, %dlsym ]
  %15 = bitcast void ()* %14 to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, i32, i64, i64, i8, i8, {} addrspace(10)*, i8)*
  %16 = bitcast {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, i32, i64, i64, i8, i8, {} addrspace(10)*, i8)* %15 to void ()*
  store atomic void ()* %16, void ()** @jlplt_ijl_new_codeinst_1127_got release, align 8
  %17 = musttail call nonnull {} addrspace(10)* %15({} addrspace(10)* %0, {} addrspace(10)* %1, {} addrspace(10)* %2, {} addrspace(10)* %3, i32 %4, i64 %5, i64 %6, i8 zeroext %7, i8 zeroext %8, {} addrspace(10)* %9, i8 zeroext %10)
  ret {} addrspace(10)* %17
}

and in the pipeline it gets here https://github.com/llvm/llvm-project/blob/c9b36807beaf120f4e06d9da3b7df7625e440825/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L6082 which is what throws the error.

@truedichotomy
Copy link

The error message has evolved somewhat from the original, here is the latest build error:

(base) gong@mac julia % make
fatal: bad revision '^upstream/master'
fatal: Not a valid object name upstream/master
    JULIA usr/lib/julia/corecompiler.ji
LLVM ERROR: failed to perform tail call elimination on a call site marked musttail

signal (6): Abort trap: 6
in expression starting at compiler/bootstrap.jl:10
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 836107 (Pool: 836053; Big: 54); GC: 1
/bin/sh: line 1: 89473 Abort trap: 6           /Users/gong/GitHub/julia/usr/bin/julia -C "apple-a12" --output-ji /Users/gong/GitHub/julia/usr/lib/julia/corecompiler.ji.tmp --startup-file=no --warn-overwrite=yes -g0 -O0 compiler/compiler.jl
make[1]: *** [/Users/gong/GitHub/julia/usr/lib/julia/corecompiler.ji] Error 134
make: *** [julia-sysimg-ji] Error 2

@truedichotomy
Copy link

@staticfloat your solution by removing musttail from AARCH64 in ccall.cpp works for me. Just tested it in 1.9.0-DEV.21. I wonder if it's a sufficient fix to do a PR so that Julia 1.8+ will compile on Apple Silicon macs again.

@George9000
Copy link
Contributor

I did the same as @truedichotomy: made the change in ccall.cpp and tested under macOS 12.2.1 on an M1 Max on branch 1.8.0-beta1.0 of Julia. The results were better than the one posted here.

versioninfo
% gmake --version                                                                                                                                                19:11
GNU Make 4.3
Built for arm-apple-darwin21.1.0

julia> versioninfo(;verbose=true)
Julia Version 1.8.0-beta1.0
Commit 99faadd602* (2022-02-17 07:44 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.3.0)
  uname: Darwin 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64 arm
  CPU: Apple M1 Max:
                 speed         user         nice          sys         idle          irq
       #1-10    24 MHz      90258 s          0 s      23879 s    1962420 s          0 s
  Memory: 64.0 GB (44090.890625 MB free)
  Uptime: 20990.0 sec
  Load Avg:  1.0869140625  1.45166015625  1.818359375
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 1 on 8 virtual cores
Environment:
  JULIA_EDITOR = Emacs
  XPC_FLAGS = 0x0
  PATH = /Users/foo/.pyenv/bin:/opt/homebrew/opt/grep/libexec/gnubin:/Users/foo/bin:/Users/foo/.local/bin:/opt/homebrew/bin:/Users/foo/Library/Python/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/foo/perl5/perlbrew/bin:/Users/foo/perl5/perlbrew/perls/perl-5.35.5/bin:/Users/foo/.local/bin:/opt/homebrew/opt/fzf/bin:/Users/foo/.emacs.d/bin
  TERM = xterm-256color
  HOME = /Users/foo
  PERLBREW_HOME = /Users/foo/.perlbrew
  PERLBREW_MANPATH = /Users/foo/perl5/perlbrew/perls/perl-5.35.5/man
  PERLBREW_PATH = /Users/foo/perl5/perlbrew/bin:/Users/foo/perl5/perlbrew/perls/perl-5.35.5/bin
  MANPATH = /opt/homebrew/share/man:/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/X11/share/man:/Users/foo/perl5/perlbrew/perls/perl-5.35.5/man:/Library/Apple/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:
  HOMEBREW_PREFIX = /opt/homebrew
  HOMEBREW_CELLAR = /opt/homebrew/Cellar
  HOMEBREW_REPOSITORY = /opt/homebrew
  INFOPATH = /opt/homebrew/share/info:
Test results
Test Summary:                             |     Pass  Fail  Error  Broken     Total      Time
  Overall                                 | 40069469     1      3  352663  40422136  14m15.7s
    LinearAlgebra/bunchkaufman            |     5688                           5688     31.5s
    LinearAlgebra/eigen                   |      512                            512     39.4s
    LinearAlgebra/special                 |     2911                           2911     48.4s
    LinearAlgebra/lapack                  |      803                            803     16.6s
    LinearAlgebra/qr                      |     4700                           4700     58.0s
    LinearAlgebra/svd                     |      566                            566     30.7s
    LinearAlgebra/tridiag                 |     1541                           1541     30.9s
    LinearAlgebra/schur                   |      496                            496   1m22.3s
    LinearAlgebra/cholesky                |     2509                           2509     49.4s
    LinearAlgebra/generic                 |      585                            585     19.4s
    LinearAlgebra/lu                      |     1367                           1367     56.2s
    LinearAlgebra/dense                   |     8475                           8475   2m18.9s
    LinearAlgebra/lq                      |     2938                           2938     25.4s
    LinearAlgebra/bidiag                  |     4736                           4736   1m45.6s
    LinearAlgebra/matmul                  |     1414                           1414   2m42.7s
    LinearAlgebra/uniformscaling          |      446                            446     32.2s
    LinearAlgebra/givens                  |     1847                           1847      2.2s
    LinearAlgebra/hessenberg              |      631                            631     30.1s
    LinearAlgebra/pinv                    |      292                            292      7.1s
    LinearAlgebra/ldlt                    |        8                              8      0.6s
    LinearAlgebra/blas                    |      832                            832     11.9s
    LinearAlgebra/factorization           |       80                   16        96      2.3s
    LinearAlgebra/adjtrans                |      347                            347     12.9s
    compiler/validation                   |       28                             28      0.3s
    ambiguous                             |      107                    2       109      3.0s
    compiler/ssair                        |       40                             40      1.7s
    compiler/irpasses                     |      110                    2       112      1.5s
    compiler/inline                       |      133                    1       134      2.3s
    compiler/inference                    |     1182                    2      1184      8.0s
    compiler/contextual                   |       12                             12      1.4s
    compiler/EscapeAnalysis/interprocedural |       32                    4        36      3.6s
    compiler/codegen                      |      170            1               171      9.4s
    compiler/EscapeAnalysis/local         |      347                   21       368      6.9s
    strings/search                        |      876                            876      3.1s
    LinearAlgebra/structuredbroadcast     |      670                            670     26.1s
    strings/basic                         |    87676                          87676      4.6s
    strings/io                            |    12764                          12764      1.7s
    unicode/utf8                          |       19                             19      0.1s
    strings/types                         |  2302691                        2302691      1.4s
    worlds                                |       88                             88      1.1s
    strings/util                          |     1147                           1147      5.3s
    keywordargs                           |      151                            151      0.8s
    atomics                               |     3448                           3448      7.2s
    subtype                               |   337674                   19    337693      8.4s
    char                                  |     1628                           1628      1.0s
    triplequote                           |       29                             29      0.0s
    intrinsics                            |      301                            301      1.2s
    LinearAlgebra/diagonal                |     2872                           2872   2m40.3s
    dict                                  |   144420                         144420     10.6s
    iobuffer                              |      209                            209      0.6s
    staged                                |       65                             65      1.3s
    hashing                               |    12519                          12519      7.5s
    numbers                               |  1578758                    2   1578760     31.6s
    tuple                                 |      626                            626      3.4s
    LinearAlgebra/symmetric               |     2823                           2823   2m31.7s
    core                                  |  8445917                    3   8445920     44.0s
    reduce                                |     8588                           8588     10.2s
    offsetarray                           |      487                    3       490     18.9s
    simdloop                              |      240                            240      1.0s
    vecelement                            |      678                            678      3.1s
    intfuncs                              |   227954                         227954     12.8s
    rational                              |    98639                    1     98640     11.8s
    copy                                  |      533                            533      1.1s
    LinearAlgebra/triangular              |    37894                          37894   4m23.0s
    fastmath                              |      946                            946      3.1s
    reducedim                             |     1089                    6      1095     33.1s
    functional                            |       98                             98      3.1s
    subarray                              |   318316                         318316   1m25.8s
    ordering                              |       37                             37      1.1s
    path                                  |      373                   12       385      0.6s
    operators                             |    13040                          13040      3.4s
    parse                                 |    16098                          16098      2.0s
    arrayops                              |     2025                    2      2027     52.3s
    gmp                                   |     2357                           2357      2.5s
    ccall                                 |   165125                    1    165126     12.6s
    loading                               |   155271                         155271     16.4s
    math                                  |  1722141                        1722141     30.1s
    exceptions                            |       70                             70      1.3s
    backtrace                             |       38                    1        39      1.6s
    abstractarray                         |    55220                24795     80015   1m00.3s
    file                                  |     1073                           1073      5.4s
    namedtuple                            |      216                            216      1.4s
    version                               |     2452                           2452      3.3s
    spawn                                 |      249                    4       253     19.4s
    mpfr                                  |     1135                    1      1136      8.3s
    floatapprox                           |       49                             49      0.7s
    complex                               |     8479                    2      8481      6.3s
    reflection                            |      414                            414      2.7s
    regex                                 |      130                            130      1.3s
    float16                               |   762093                         762093      2.5s
    sysinfo                               |        4                              4      0.1s
    env                                   |       92                             92      0.2s
    combinatorics                         |      170                            170      3.9s
    rounding                              |   112720                         112720      2.1s
    mod2pi                                |       80                             80      0.2s
    euler                                 |       12                             12      0.5s
    iterators                             |    10164                          10164     55.2s
    client                                |        5                              5      0.8s
    errorshow                             |      237                            237      3.4s
    show                                  |   128883                    8    128891     14.9s
    goto                                  |       19                             19      0.0s
    llvmcall                              |       19                             19      0.3s
    llvmcall2                             |        7                              7      0.0s
    ryu                                   |    31215                          31215      1.0s
    some                                  |       72                             72      0.5s
    meta                                  |       69                             69      0.5s
    stacktraces                           |       48                             48      0.7s
    sorting                               |    16099                    9     16108     54.5s
    docs                                  |      238                            238      2.0s
    sets                                  |     3619                    1      3620     11.6s
    binaryplatforms                       |      341                            341      3.0s
    ranges                                | 12110690               327682  12438372     25.0s
    enums                                 |       99                             99      1.4s
    read                                  |     3872                           3872     51.4s
    atexit                                |       40                             40      6.4s
    interpreter                           |        3                              3      1.3s
    int                                   |   524698                         524698      5.5s
    bitset                                |      195                            195      1.6s
    broadcast                             |      511                            511     48.2s
    checked                               |     1239                           1239      5.4s
    error                                 |       32                             32      1.2s
    osutils                               |       43                             43      0.1s
    boundscheck                           |                                    None      4.8s
    iostream                              |       50                             50      0.7s
    secretbuffer                          |       27                             27      0.6s
    specificity                           |      175                            175      0.1s
    cartesian                             |      343                    3       346      4.2s
    bitarray                              |   913626                         913626   1m43.3s
    syntax                                |     1582                    1      1583      4.9s
    corelogging                           |      231                            231      2.7s
    misc                                  |  1282216                        1282216     26.6s
    smallarrayshrink                      |       36                             36      0.4s
    opaque_closure                        |       55                    1        56      0.8s
    filesystem                            |        6                              6      0.1s
    reinterpretarray                      |      418                            418     11.2s
    asyncmap                              |      307                            307      6.9s
    missing                               |      574                    1       575      9.2s
    channels                              |      258                            258     21.1s
    LibGit2/online                        |       10                             10      4.4s
    LinearAlgebra/addmul                  |     5670                           5670   3m44.4s
    download                              |                                    None     31.0s
    Dates/adjusters                       |     3149                           3149      2.5s
    Dates/query                           |     1004                           1004      0.5s
    Dates/accessors                       |  7723858                        7723858      3.7s
    Dates/periods                         |      953                            953      9.5s
    Dates/ranges                          |   350637                         350637      9.4s
    Dates/rounding                        |      315                            315      1.0s
    Dates/types                           |      232                            232      1.0s
    Dates/arithmetic                      |      385                            385      4.7s
    Dates/conversions                     |      161                            161      0.5s
    Dates/io                              |      332                            332      6.3s
    Artifacts                             |     1452                           1452      4.1s
    Base64                                |     2022                           2022      1.3s
    CRC32c                                |      664                            664      0.3s
    CompilerSupportLibraries_jll          |        4                              4      0.7s
    ArgTools                              |      180                            180      7.7s
    DelimitedFiles                        |       89                             89      2.6s
    SparseArrays/higherorderfns           |     7145                    1      7146   1m06.1s
    Future                                |                                    None      0.0s
    GMP_jll                               |        1                              1      0.3s
    InteractiveUtils                      |      279                            279     13.0s
    LLVMLibUnwind_jll                     |        7                              7      0.5s
    LibGit2/libgit2                       |      754                            754   1m10.4s
    LazyArtifacts                         |        4                              4      2.6s
    LibCURL_jll                           |        1                              1      0.0s
    LibGit2_jll                           |        2                              2      0.9s
    LibSSH2_jll                           |                                    None      0.0s
    LibCURL                               |        6                              6      1.9s
    LibUV_jll                             |        1                              1      0.5s
    LibUnwind_jll                         |                                    None      0.5s
    Libdl                                 |       76                    1        77      0.9s
    MPFR_jll                              |        1                              1      0.3s
    Logging                               |       40                             40      2.0s
    MbedTLS_jll                           |        1                              1      0.0s
    Markdown                              |      257                            257      2.8s
    MozillaCACerts_jll                    |        1                              1      0.0s
    NetworkOptions                        |     3518                           3518      0.5s
    OpenBLAS_jll                          |        1                              1      0.3s
    OpenLibm_jll                          |        1                              1      0.3s
    PCRE2_jll                             |        2                              2      0.3s
    FileWatching                          |      510                            510     34.8s
    Printf                                |     1014                           1014      6.8s
    SparseArrays/sparsevector             |    10348                    4     10352   1m37.4s
    Mmap                                  |      140                            140     15.2s
    REPL                                  |     1421                    3      1424     17.1s
    Downloads                             |      238                            238   1m07.3s
    cmdlineargs                           |      270                    3       273   2m30.7s
    Serialization                         |      126                    1       127      4.1s
    Sockets                               |      172                            172      5.0s
    Random                                |   204291                         204291     30.5s
    SuiteSparse_jll                       |        1                              1      1.0s
    TOML                                  |      415                    8       423      6.3s
    Statistics                            |      804                            804     31.5s
    floatfuncs                            |      232                            232   2m56.9s
    UUIDs                                 |     1029                           1029      0.2s
    Unicode                               |      776                            776      2.2s
    Zlib_jll                              |        1                              1      0.3s
    dSFMT_jll                             |        1                              1      0.3s
    libLLVM_jll                           |        1                              1      0.2s
    libblastrampoline_jll                 |        1                              1      0.0s
    nghttp2_jll                           |        1                              1      0.0s
    p7zip_jll                             |        1                              1      0.0s
    SHA                                   |      107                            107     44.2s
    Profile                               |      111                            111   1m05.9s
    Test                                  |      454                   17       471     16.2s
    Tar                                   |     3161                   11      3172     45.0s
    SuiteSparse                           |     1293                           1293   1m05.5s
    SparseArrays/sparse                   |     4299                           4299   3m30.1s
    Pkg                                   |     2378     1      2       2      2383   6m35.6s
    precompile                            |      135                    6       141     15.9s
    SharedArrays                          |      114                            114     10.5s
    threads                               |       37                             37   1m21.0s
    Distributed                           |       12                             12   1m16.7s
    stress                                |      118                            118      7.4s
    FAILURE

The global RNG seed was 0xc41100a6e76cc1b1fe0188f1d4179db0.

Error in testset compiler/codegen:
Error During Test at /Volumes/ssd500/julia/test/compiler/codegen.jl:681
  Test threw exception
  Expression: readchomp(`$pfx/bin/$(Base.julia_exename()) -e 'print("no codegen!\n")'`) == "no codegen!"
  failed process: Process(`/var/folders/mh/d010xh0j5ss8yws8rknh568c0000gn/T/jl_7hVFoZ/bin/julia -e 'print("no codegen!\n")'`, ProcessExited(1)) [1]

  Stacktrace:
   [1] pipeline_error
     @ ./process.jl:542 [inlined]
   [2] read(cmd::Cmd)
     @ Base ./process.jl:429
   [3] read(cmd::Cmd, #unused#::Type{String})
     @ Base ./process.jl:438
   [4] readchomp
     @ ./io.jl:961 [inlined]
   [5] macro expansion
     @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:464 [inlined]
   [6] (::Main.Test63Main_compiler_codegen.var"#36#38")(pfx::String)
     @ Main.Test63Main_compiler_codegen /Volumes/ssd500/julia/test/compiler/codegen.jl:681
Error in testset Pkg:
Test Failed at /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/new.jl:2818
  Expression: meta !== nothing
   Evaluated: nothing !== nothing
Error in testset Pkg:
Error During Test at /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/new.jl:2781
  Got exception outside of a @test
  MethodError: no method matching getindex(::Nothing, ::String)
  Stacktrace:
    [1] (::Main.Test83Main_Pkg.PkgTests.NewTests.var"#714#719"{Main.Test83Main_Pkg.PkgTests.NewTests.var"#get_manifest_block#718", String, String})()
      @ Main.Test83Main_Pkg.PkgTests.NewTests /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/new.jl:2820
    [2] (::Main.Test83Main_Pkg.PkgTests.Utils.var"#6#7"{Bool, Main.Test83Main_Pkg.PkgTests.NewTests.var"#714#719"{Main.Test83Main_Pkg.PkgTests.NewTests.var"#get_manifest_block#718", String, String}})()
      @ Main.Test83Main_Pkg.PkgTests.Utils /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/utils.jl:79
    [3] withenv(::Main.Test83Main_Pkg.PkgTests.Utils.var"#6#7"{Bool, Main.Test83Main_Pkg.PkgTests.NewTests.var"#714#719"{Main.Test83Main_Pkg.PkgTests.NewTests.var"#get_manifest_block#718", String, String}}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
      @ Base ./env.jl:172
    [4] isolate(fn::Main.Test83Main_Pkg.PkgTests.NewTests.var"#714#719"{Main.Test83Main_Pkg.PkgTests.NewTests.var"#get_manifest_block#718", String, String}; loaded_depot::Bool, linked_reg::Bool)
      @ Main.Test83Main_Pkg.PkgTests.Utils /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/utils.jl:70
    [5] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/new.jl:2797 [inlined]
    [6] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
    [7] top-level scope
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/new.jl:2783
    [8] include(mod::Module, _path::String)
      @ Base ./Base.jl:422
    [9] include
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:3 [inlined]
   [10] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:51 [inlined]
   [11] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1433 [inlined]
   [12] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:33 [inlined]
   [13] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [14] (::Main.Test83Main_Pkg.PkgTests.var"#1#2")()
      @ Main.Test83Main_Pkg.PkgTests /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:33
   [15] with_logstate(f::Function, logstate::Any)
      @ Base.CoreLogging ./logging.jl:511
   [16] with_logger(f::Function, logger::Base.CoreLogging.NullLogger)
      @ Base.CoreLogging ./logging.jl:623
   [17] top-level scope
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:31
   [18] include
      @ ./Base.jl:422 [inlined]
   [19] macro expansion
      @ /Volumes/ssd500/julia/test/testdefs.jl:24 [inlined]
   [20] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [21] macro expansion
      @ /Volumes/ssd500/julia/test/testdefs.jl:23 [inlined]
   [22] macro expansion
      @ ./timing.jl:440 [inlined]
   [23] runtests(name::String, path::String, isolate::Bool; seed::UInt128)
      @ Main /Volumes/ssd500/julia/test/testdefs.jl:21
   [24] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, UInt128, Tuple{Symbol}, NamedTuple{(:seed,), Tuple{UInt128}}})
      @ Base ./essentials.jl:731
   [25] (::Distributed.var"#106#108"{Distributed.CallMsg{:call_fetch}})()
      @ Distributed /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Distributed/src/process_messages.jl:285
   [26] run_work_thunk(thunk::Distributed.var"#106#108"{Distributed.CallMsg{:call_fetch}}, print_error::Bool)
      @ Distributed /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Distributed/src/process_messages.jl:70
   [27] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Distributed/src/process_messages.jl:285 [inlined]
   [28] (::Distributed.var"#105#107"{Distributed.CallMsg{:call_fetch}, Distributed.MsgHeader, Sockets.TCPSocket})()
      @ Distributed ./task.jl:476
Error in testset Pkg:
Error During Test at /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/artifacts.jl:323
  Got exception outside of a @test
  Package ArtifactInstallation errored during testing
  Stacktrace:
    [1] pkgerror(msg::String)
      @ Pkg.Types /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
    [2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
      @ Pkg.Operations /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/Operations.jl:1789
    [3] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Cmd, test_args::Cmd, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool, kwargs::Base.Pairs{Symbol, Base.BufferStream, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.BufferStream}}})
      @ Pkg.API /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:431
    [4] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.BufferStream, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ Pkg.API /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:156
    [5] test(pkgs::Vector{Pkg.Types.PackageSpec})
      @ Pkg.API /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:146
    [6] #test#87
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined]
    [7] test
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:144 [inlined]
    [8] #test#86
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:143 [inlined]
    [9] test
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/src/API.jl:143 [inlined]
   [10] (::Main.Test83Main_Pkg.PkgTests.ArtifactTests.var"#78#85"{String})()
      @ Main.Test83Main_Pkg.PkgTests.ArtifactTests /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/artifacts.jl:338
   [11] with_pkg_env(fn::Main.Test83Main_Pkg.PkgTests.ArtifactTests.var"#78#85"{String}, path::String; change_dir::Bool)
      @ Main.Test83Main_Pkg.PkgTests.Utils /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/utils.jl:230
   [12] with_pkg_env
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/utils.jl:224 [inlined]
   [13] #77
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/artifacts.jl:328 [inlined]
   [14] mktempdir(fn::Main.Test83Main_Pkg.PkgTests.ArtifactTests.var"#77#84", parent::String; prefix::String)
      @ Base.Filesystem ./file.jl:764
   [15] mktempdir(fn::Function, parent::String) (repeats 2 times)
      @ Base.Filesystem ./file.jl:762
   [16] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/artifacts.jl:327 [inlined]
   [17] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [18] top-level scope
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/artifacts.jl:327
   [19] include(mod::Module, _path::String)
      @ Base ./Base.jl:422
   [20] include
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:3 [inlined]
   [21] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:51 [inlined]
   [22] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1433 [inlined]
   [23] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:33 [inlined]
   [24] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [25] (::Main.Test83Main_Pkg.PkgTests.var"#1#2")()
      @ Main.Test83Main_Pkg.PkgTests /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:33
   [26] with_logstate(f::Function, logstate::Any)
      @ Base.CoreLogging ./logging.jl:511
   [27] with_logger(f::Function, logger::Base.CoreLogging.NullLogger)
      @ Base.CoreLogging ./logging.jl:623
   [28] top-level scope
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Pkg/test/runtests.jl:31
   [29] include
      @ ./Base.jl:422 [inlined]
   [30] macro expansion
      @ /Volumes/ssd500/julia/test/testdefs.jl:24 [inlined]
   [31] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [32] macro expansion
      @ /Volumes/ssd500/julia/test/testdefs.jl:23 [inlined]
   [33] macro expansion
      @ ./timing.jl:440 [inlined]
   [34] runtests(name::String, path::String, isolate::Bool; seed::UInt128)
      @ Main /Volumes/ssd500/julia/test/testdefs.jl:21
   [35] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, UInt128, Tuple{Symbol}, NamedTuple{(:seed,), Tuple{UInt128}}})
      @ Base ./essentials.jl:731
   [36] (::Distributed.var"#106#108"{Distributed.CallMsg{:call_fetch}})()
      @ Distributed /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Distributed/src/process_messages.jl:285
   [37] run_work_thunk(thunk::Distributed.var"#106#108"{Distributed.CallMsg{:call_fetch}}, print_error::Bool)
      @ Distributed /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Distributed/src/process_messages.jl:70
   [38] macro expansion
      @ /Volumes/ssd500/julia/usr/share/julia/stdlib/v1.8/Distributed/src/process_messages.jl:285 [inlined]
   [39] (::Distributed.var"#105#107"{Distributed.CallMsg{:call_fetch}, Distributed.MsgHeader, Sockets.TCPSocket})()
      @ Distributed ./task.jl:476

@truedichotomy
Copy link

Just curious as a non cpp person, what's the benefit of cpp tail call optimization for Julia? Is this a critical optimization to have for performance reasons?

@George9000
Copy link
Contributor

Wondered about that, read this which led to this. Shooting in the dark, but I surmise that it becomes an issue for recursive functions and optimization of stack memory allocation. Seems like a must for Lisp. Not sure if this is simply an optimization for Julia or if it holds potential for out-of-memory errors.

@giordano giordano linked a pull request Feb 20, 2022 that will close this issue
@gbaraldi
Copy link
Member

So after a quite long session of debugging I found what causes musttail to fail, and that is https://github.com/gbaraldi/llvm-project/blob/5be8ea4bd7b0d66214c22033a7fd298544e65027/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp#L5702-L5707, the ccall fails that check and bugs out. Why does it only fail that in apple I have no idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants