-
-
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
Int vs float comparisons in Julia #9030
Conversation
Oo, nice code reduction. |
Maybe we should declare these |
This is very nice. |
Declaring |
To be more specific, while these functions are inlineable as-is, I worry that a large function with many calls to these could hit a size threshold that prevents further inlining. |
I generally recommend against forcing inlining. Our current heuristic is pretty generous already, so when you hit that limit you probably really want to stop inlining. One case where that might be false is when you have a large if statement that you know will rarely be triggered and the speed of that code is highly critical. Of the user has redefined some of these internal functions to be large, it is possible that we don't actually want to be inlining here at all. In addition to the size penalty in the AST and resulting code, my understanding is that some of the llvm passes are O(n^2) in the lines of code, so it is best not to make things excessively large |
What's the call here: to |
I tend to use How many machine instructions are generated from the comparison functions? If it's fewer than for a function call, then we should use |
Int vs float comparisons in Julia
Can always add it later :) |
The first commit (a5de252) implements
Int64
/UInt64
vsFloat32
/Float64
comparisons in pure Julia, removing the C++ code from src/intrinisics.cpp. From what I can tell, this should emit identical LLVM code as before forFloat64
; forFloat32
, the methods should now work without promotion toFloat64
.The second commit (62828b7) makes a small modification to fix #9021. Any comparisons with constant integers (e.g.
x > 0
) should now be inlined into a single float comparison. Is there anyway I could craft this into a test?