GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-131798: Use `sym_new_type` instead of `sym_new_not_null` for `_BUILD_LIST`, `_BUILD_SLICE`, and `_BUILD_MAP` by Zheaoli · Pull Request #132434 · python/cpython

Conversation

@Zheaoli

@Zheaoli Zheaoli commented Apr 12, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: Better uop coverage in the JIT optimizer #131798

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot mentioned this pull request Apr 12, 2025
Better uop coverage in the JIT optimizer #131798
Open
@TeamSpen210

TeamSpen210 commented Apr 12, 2025

Copy link
Copy Markdown

_BUILD_MAP returns a dict not a map() object.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner approved these changes Apr 12, 2025
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

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.

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added the awaiting merge label Apr 12, 2025
@Zheaoli

Zheaoli commented Apr 12, 2025

Copy link
Copy Markdown
Contributor Author

@Fidget-Spinner I think I still have some work for this PR

A few days ago, In #132289, @brandtbucher setup optimization path for _GUARD_NOS_DICT/_GUARD_NOS_LIST, But after using sym_new_type instead of sym_new_not_null, the _GUARD_NOS_DICT/_GUARD_NOS_LIST is not existed in the final generate result. So the test failed here https://github.com/python/cpython/actions/runs/14419426452/job/40440141201?pr=132434#step:4:1788

I'm not sure this is what we want to get(I guess it's, so maybe we just need to patch the test?)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher brandtbucher changed the title gh-131798: Use sym_new_type instead of sym_new_not_null for _BUILD_LIST, _BUILD_SET, _BUILD_MAP gh-131798: Use sym_new_type instead of sym_new_not_null for _BUILD_LIST, _BUILD_SLICE, _BUILD_MAP Apr 12, 2025
@brandtbucher brandtbucher changed the title gh-131798: Use sym_new_type instead of sym_new_not_null for _BUILD_LIST, _BUILD_SLICE, _BUILD_MAP gh-131798: Use sym_new_type instead of sym_new_not_null for _BUILD_LIST, _BUILD_SLICE, and _BUILD_MAP Apr 12, 2025
@brandtbucher

brandtbucher commented Apr 12, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@Zheaoli, that's actually a good thing! The additional information that you've added to the optimizer for _BUILD_MAP and _BUILD_LIST means that the JIT is able to remove those guard instructions. You should just update the tests to check for 0 instead of 1, since these guard instructions shouldn't be present at all anymore.

(I don't think writing a test for the _BUILD_SLICE change is going to be very helpful, given how this instruction is used right now. So don't worry about that one.)

Zheaoli reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Zheaoli

Zheaoli commented Apr 12, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

that's actually a good thing! The additional information that you've added to the optimizer for _BUILD_MAP and _BUILD_LIST means that the JIT is able to remove those guard instructions. You should just update the tests to check for 0 instead of 1, since these guard instructions shouldn't be present at all anymore.

Yes, I guess the _GUARD_NOS_DICT is not needed here(just for the test) when we setup extra information for ops when I see the failed test. You confirmed my guess. Updating the PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Zheaoli
Zheaoli marked this pull request as ready for review April 12, 2025 15:34
@bedevere-app bedevere-app Bot added awaiting review and removed awaiting merge labels Apr 12, 2025
@Zheaoli
Zheaoli force-pushed the manjusaka/build-tuple-set-map-list branch from 5101fc8 to 1e69348 Compare April 12, 2025 15:35
Fidget-Spinner
Fidget-Spinner reviewed Apr 14, 2025
View reviewed changes
Comment thread Lib/test/test_capi/test_opt.py
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertEqual(uops.count("_GUARD_NOS_LIST"), 1)
self.assertEqual(uops.count("_GUARD_NOS_LIST"), 0)

@Fidget-Spinner Fidget-Spinner Apr 14, 2025

Copy link
Copy Markdown
Member

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.

Can you please update the comment above and change Guarded to Unguarded. The guard has now been removed.

Same for test_remove_guard_for_known_type_dict

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Zheaoli reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Zheaoli added 5 commits April 16, 2025 22:02
@Zheaoli
pythongh-131798: Use sym_new_type instead of sym_new_not_null for…
9be0d7f
… _BUILD_LIST, _BUILD_SET, _BUILD_MAP

Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Fix review idea
c3d7c33
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Fix review idea
a724d89
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Update the test
0e12c85
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
fix review idea
839a749
Signed-off-by: Manjusaka <[email protected]>
@Zheaoli
Zheaoli force-pushed the manjusaka/build-tuple-set-map-list branch from 8d55bc4 to 839a749 Compare April 16, 2025 14:02
@Fidget-Spinner

Fidget-Spinner commented Apr 16, 2025

Copy link
Copy Markdown
Member

@Zheaoli please don't force push, just normal push so we can see the commit diff. We will squash and merge at the end as one commit. Thanks!

Zheaoli reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner approved these changes Apr 16, 2025
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

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.

Thanks again! Great job.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Apr 16, 2025
@Fidget-Spinner
Fidget-Spinner merged commit b9e88ff into python:main Apr 16, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Zheaoli @TeamSpen210 @brandtbucher @Fidget-Spinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.