Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-131798: Small improvements toremove_unneeded_uops#134554

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Fidget-Spinner merged 1 commit intopython:mainfromtomasr8:jit-remove-uops
May 23, 2025

Conversation

tomasr8
Copy link
Member

@tomasr8tomasr8 commentedMay 22, 2025
edited by bedevere-appbot
Loading

  • Add_CHECK_PERIODIC to the list of skipped instructions. I believe this is safe to do since this instruction does not modify the stack. It is also relatively common so I think it's worth it to skip it.
  • Add an extra guard to the optimizer.

@@ -617,7 +618,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
while (op_skip[last->opcode]) {
last--;
}
if (op_without_push[last->opcode]) {
if (op_without_push[last->opcode]&&op_without_pop[opcode]) {
last->opcode=op_without_push[last->opcode];
opcode=buffer[pc].opcode=op_without_pop[opcode];
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

When we are here, we know thatop_without_pop[opcode] || op_without_pop_null[opcode] is true. But we should also make sure thatop_without_pop[opcode] itself is true, otherwise it is possible to accidentally write0 as the opcode.

@Fidget-Spinner
Copy link
Member

  • Add_CHECK_PERIODIC to the list of skipped instructions. I believe this is safe to do since this instruction does not modify the stack. It is also relatively common so I think it's worth it to skip it.

I read the code but just checking that I understand it right:op_skip means the instruction is still emitted, just that we "skip" it when trying to optimize away redundant push/pops right? If so that's ok the PR LGTM.

@tomasr8
Copy link
MemberAuthor

  • Add_CHECK_PERIODIC to the list of skipped instructions. I believe this is safe to do since this instruction does not modify the stack. It is also relatively common so I think it's worth it to skip it.

I read the code but just checking that I understand it right:op_skip means the instruction is still emitted, just that we "skip" it when trying to optimize away redundant push/pops right? If so that's ok the PR LGTM.

Yes, that's exactly the case! This allows us to optimize for instance:

_LOAD_CONST_CHECK_PERIODIC_POP_TOP

into just

_NOP_CHECK_PERIODIC_NOP

@Fidget-SpinnerFidget-Spinner merged commit71dea74 intopython:mainMay 23, 2025
61 checks passed
@tomasr8tomasr8 deleted the jit-remove-uops branchMay 23, 2025 13:04
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbotAMD64 Fedora Stable Refleaks 3.x (tier-1) has failed when building commit71dea74.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/320/builds/2497) and take a look at the build logs.
  4. Check if the failure is related to this commit (71dea74) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/320/builds/2497

Failed tests:

  • test.test_multiprocessing_fork.test_processes

Failed subtests:

  • test_interrupt - test.test_multiprocessing_fork.test_processes.WithProcessesTestProcess.test_interrupt

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line320, in_bootstrapself.run()~~~~~~~~^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line108, inrunself._target(*self._args,**self._kwargs)~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line518, in_sleep_some_event    time.sleep(100)~~~~~~~~~~^^^^^KeyboardInterruptkTraceback (most recent call last):  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line588, intest_interrupt    exitcode=self._kill_process(multiprocessing.Process.interrupt)  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line570, in_kill_processself.assertEqual(join(),None)~~~~^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line250, in__call__returnself.func(*args,**kwds)~~~~~~~~~^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line156, injoin    res=self._popen.wait(timeout)  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line44, inwaitreturnself.poll(os.WNOHANGif timeout==0.0else0)~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line28, inpoll    pid, sts= os.waitpid(self.pid, flag)~~~~~~~~~~^^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line566, inhandlerraiseRuntimeError('join took too long:%s'% p)RuntimeError:join took too long: <Process name='Process-3' pid=1325402 parent=1325398 started daemon>Traceback (most recent call last):  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line320, in_bootstrapself.run()~~~~~~~~^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line108, inrunself._target(*self._args,**self._kwargs)~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line517, in_sleep_some_event    event.set()~~~~~~~~~^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/synchronize.py", line344, insetwithself._cond:^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/synchronize.py", line242, in__exit__returnself._lock.__exit__(*args)~~~~~~~~~~~~~~~~~~~^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/synchronize.py", line100, in__exit__returnself._semlock.__exit__(*args)~~~~~~~~~~~~~~~~~~~~~~^^^^^^^KeyboardInterruptkTraceback (most recent call last):  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line588, intest_interrupt    exitcode=self._kill_process(multiprocessing.Process.interrupt)  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line570, in_kill_processself.assertEqual(join(),None)~~~~^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line250, in__call__returnself.func(*args,**kwds)~~~~~~~~~^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/process.py", line156, injoin    res=self._popen.wait(timeout)  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line44, inwaitreturnself.poll(os.WNOHANGif timeout==0.0else0)~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line28, inpoll    pid, sts= os.waitpid(self.pid, flag)~~~~~~~~~~^^^^^^^^^^^^^^^^  File"/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line566, inhandlerraiseRuntimeError('join took too long:%s'% p)RuntimeError:join took too long: <Process name='Process-1706' pid=1247987 parent=1230274 started daemon>
brandtbucher reacted with thumbs down emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

@brandtbucherbrandtbucherAwaiting requested review from brandtbucher

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@tomasr8@Fidget-Spinner@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp