-
-
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
code_native broken on official macOS binaries #28046
Comments
FWIW, it's printed by Julia: Line 409 in 3791357
|
@nalimilan Interesting; can't believe I didn't think to just grep through the Julia sources for that message. But this does confirm a couple things for me:
Looking through the source file you linked, it appears that the warning refers to not being able to either look up or determine the size of the requested function. I'm somewhat confused as to why this is a WARNING instead of an ERROR (or better yet a Julia exception), since As for the issue being experienced on macOS, it looks like that would have to be occurring in |
It just occurred to me to try disassembling |
Also, perhaps this deserves a separate issue, but on either of my setups, running
And if I try to set a CPU with a misspelled name, I get 7 identical error messages:
|
Ignore that; thought the "Close and comment" button was a "Close comment" button. |
It usually means that the debug info is stripped or not installed.
Fixed on master. Not going to be fixed on 0.6. |
Also fixed on master and not backportable. |
@yuyichao Okay, that's good to know.
So then does that mean that most of the official Linux binaries don't include debug symbols in the system image? I have both |
Judging from the package name these are NOT official Linux binaries. The official ones are the ones you can download from julialang.org. |
@yuyichao Okay, that actually makes a lot more sense then. The So that demystifies the |
If I build Julia 0.6.4 from source on macOS, I get a system image with debug symbols and 64-bit assembly outputs. This solves the issue for me personally, since I'm okay with building from source, but it's strange that I get such different results from the official binary. I'm changing the name of the issue to reflect what it now seems to be. |
This issue prevents me from using tools like |
@ikirill take a look at https://github.com/vchuravy/IACA.jl, I would be delighted to see a PR that adds support for |
@vchuravy Is IACA.jl working now? I remember trying and failing to get it working a while ago. Basic support for llvm-mca is really easy: https://github.com/ikirill/LlvmMca.jl/blob/master/LlvmMca.jl#L21 (no LLVM.jl dependency or needing a source build or anything like that). |
Yes I fixed IACA.jl for 1.0, if you find anything that doesn't work please report it. The reason why I use LLVM.jl is because the output of code_native is not required to be stable, and IACA.jl also no longer needs a source-build. The README is just outdated |
Just FYI, LLVM.jl doesn't require a source build anymore. |
julia> big_addition(x) = x + 0x123456789abcdef0
big_addition (generic function with 1 method)
julia> code_native(big_addition, (UInt64,); syntax=:intel)
.section __TEXT,__text,regular,pure_instructions
; Function big_addition {
; Location: REPL[1]:1
; Function +; {
; Location: REPL[1]:1
dec eax
mov eax, 2596069104
js 0x58
xor al, 18
dec eax
add eax, edi
;}
ret
nop
;} |
This might be because the LLVM disassembler is using the wrong hardware architecture. Julia determines this setting by calling If that's the case, the solution would be for the code generator to store the target information (if it doesn't already do so), and for the disassembler to use this, instead of asking LLVM to look at the host hardware and guess from there. |
It's stored in the global variable |
This sounds as if it was worthwhile trying to replace the statements std::string TripleName = sys::getDefaultTargetTriple();
Triple TheTriple(Triple::normalize(TripleName)); by std::string TripleName = jl_TargetMachine->getTargetTriple();
Triple TheTriple(TripleName); in |
This sounds like an issue I had with macOS binaries: maleadt/LLVM.jl#122 (comment), where the default triple comes from the system where libLLVM was built on instead. |
which is really just printing out the configuration:
so it seems like the build script is configuring the distributed binaries incorrectly. tracing back further through the log files (e.g. https://build.julialang.org/#/builders/1/builds/330/steps/4/logs/stdio), it appears to be a build issue: we're missing setting the custom |
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
I'm still seeing this issue with Julia 1.1.1 on linux with binaries built from source. As far as I can tell, the fix PR #30554 made it in to 1.1.1. |
broken by their move to cmake causing a switch away from the standard --host/--build autoconf fix #28046
This issue stems from a discussion I started on the Julia Discourse forum.
In short, the
code_native()
introspection function seems to work inconsistently (and sometimes break completely) on both Linux and macOS, based on results from several macOS and Linux setups with several Julia versions. I'll be giving theversioninfo()
for the two setups I used (macOS 10.13.5 on Apple hardware, Fedora 28 inside a Docker container), along with the results of severalcode_native()
calls to demonstrate the issue. My macOS setup is running the just-released Julia 0.6.4 as of writing this issue, but I experienced the exact same behavior on macOS with Julia 0.6.3.macOS
versioninfo()
Fedora
versioninfo()
Fedora Behavior
As a very simple test case, let's dump the assembly for
+(::Int, ::Int)
:That's strange. If we try wrapping it in another function:
That works, but I see no reason why dumping code for
+
should fail. I also wonder if theWARNING
being displayed in place of an assembly printout is text emitted from external code (i.e. not Julia), since I can't think of what the "Could not determine size of symbol" would mean in Julia.macOS Behavior
Repeating the same initial test as before:
This time we get an assembly printout, but it's completely wrong. We're seeing only 32-bit instructions, though the actual code is of course 64-bit. Additionally, we've got needless
dec eax
instructions interspersed, which I suspect aren't actually in the generated code. We can try wrapping+
in a function again, but we still get the broken ASM.To show that this problem is limited to
code_native
, we can trycode_llvm
, which always gives identical (and correct) output:While I used the
+
case as a minimal example, nocode_native
call I've tried has produced correct (i.e. 64-bit) assembly on my macOS setup. Another user (by the username Per in the discussion linked above) was able to getcode_native
working correctly with a source-built Julia 0.7.0-beta.214 on macOS High Sierra (10.13.x), but experienced the same macOS behavior I did with a downloaded 0.7.0-beta.0 and a downloaded 0.6.3 on macOS Sierra (10.12.x). Finally, with a locally-rebuilt system image in Julia 0.6.3 and macOS Sierra, Per was able to reproduce theWARNING
output I experienced on Fedora.The text was updated successfully, but these errors were encountered: