-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-115758: Optimizer constant propagation for 64-bit ints and doubles #117396
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
gh-115758: Optimizer constant propagation for 64-bit ints and doubles #117396
Conversation
For the following code:
Main with uops: 2.726s |
@@ -792,48 +792,44 @@ def testfunc(n): | |||
|
|||
def test_float_add_constant_propagation(self): | |||
def testfunc(n): | |||
a = 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a limitation of loop-based traces. We should start projecting traces from function entries as well, but I'll leave that for Mark or someone else to do in the future.
@brandtbucher Windows builds are complaining there's no |
Yeah, sorry. You're gonna need to get rid of The problem is that the C compiler wants to assume that |
TIL. :-) What is it that makes it work for C API functions? Are they always nearby, or do we always do an extra indirection? And why would the C compiler "know" that |
We always do the indirection. If it turns out that they are in range, we rewrite the jump to a more efficient one at runtime.
Because the default "small" code model assumes that all code lives within 31 bits of each other. We want this code model so the (common) jumps between instructions are efficent, at the cost of a layer of indirection between the (ideally less common) function calls. So basically, all function calls have to be |
@brandtbucher I'm getting assertion failure on the JIT debug build of 32-bit Win. Specifically the failing assertion is
from Jit.c (at least, this is all I can decode anyways because the error logs has special broken characters. Also failing WASI, but that seems to be a floating point issue. |
Hm, okay, I'll try to dig into that a bit today. Sorry for the friction! |
It looks like non-JIT 32-bit Windows is failing too, though. Is it because you're trying to cram a 64-bit |
WASI is 32 bits also. I think that's the issue. |
WAIT I forgot it casts to 32-bit pointer. Ahh thanks so much for that! So sorry for the noise! |
This reverts commit 6de675c.
FWIW, I think 32-bit JIT builds only have a 32-bit operand for uops. This is by accident, not by design, but I just don't think we've noticed since we never stick anything wider than a pointer in there. |
Ok WASI now passes. So there is indeed a bug in 32-bit JIT builds. |
The stats show a very small reduction in the number of An optimization like this could make sense when combined with another to pass to more effectively eliminated dead values, but I'd be surprised if that were worth the effort. At least until the tier 2 optimization is much more capable. |
Is this still something we want to do right now, or should it wait for the partial evaluation pass? |
I have a feeling we might want a pre-processing step in the specializer/eedundancy eliminator pass first before passing it to the partial evaluator. But either ways works. So lets wait and see. |
Doing this in the PE instead. |
Uh oh!
There was an error while loading. Please reload this page.