Uh oh!
There was an error while loading. Please reload this page.
gh-115758: Optimizer constant propagation for 64-bit ints and doubles - #117396
gh-115758: Optimizer constant propagation for 64-bit ints and doubles#117396Fidget-Spinner wants to merge 12 commits into
Conversation
Fidget-Spinner
commented
Mar 31, 2024
For the following code: Main with uops: 2.726s |
| def test_float_add_constant_propagation(self): | ||
| def testfunc(n): | ||
| a = 1.0 |
There was a problem hiding this comment.
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.
Fidget-Spinner
commented
Apr 1, 2024
@brandtbucher Windows builds are complaining there's no |
brandtbucher
commented
Apr 1, 2024
Yeah, sorry. You're gonna need to get rid of The problem is that the C compiler wants to assume that |
gvanrossum
commented
Apr 1, 2024
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. |
brandtbucher
commented
Apr 1, 2024
Hm, okay, I'll try to dig into that a bit today. Sorry for the friction! |
brandtbucher
commented
Apr 1, 2024
It looks like non-JIT 32-bit Windows is failing too, though. Is it because you're trying to cram a 64-bit |
brandtbucher
commented
Apr 1, 2024
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.
brandtbucher
commented
Apr 1, 2024
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. |
Fidget-Spinner
commented
Apr 1, 2024
Ok WASI now passes. So there is indeed a bug in 32-bit JIT builds. |
markshannon
commented
Apr 18, 2024
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. |
brandtbucher
commented
Oct 4, 2024
Is this still something we want to do right now, or should it wait for the partial evaluation pass? |
Fidget-Spinner
commented
Oct 5, 2024
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. |
Fidget-Spinner
commented
Jan 16, 2025
Doing this in the PE instead. |
Uh oh!
There was an error while loading. Please reload this page.