GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-131798: Add `MATCH_SEQUENCE/MAPPING` to the JIT optimizer by Sacul0457 · Pull Request #148124 · python/cpython Conversation
|
| op(_MATCH_MAPPING, (subject -- subject, res)) { | ||
| if (sym_has_type(subject)) { | ||
| PyTypeObject *type = sym_get_type(subject); | ||
| int match = type->tp_flags & Py_TPFLAGS_MAPPING; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I also wonder if this logic will be broken by abc.register.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm not too sure either. I'll try to see if I can find out more
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
abc.register will change the tp_flags but don't update the type version, so JIT won't invalid the old trace
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@Fidget-Spinner Do we need call assign_version_tag when use abc.register?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why? ABC never changes the actual type flags.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
abc.register will change the tp_flags but don't update the type version, so JIT won't invalid the old trace
That sounds like a bug in abc.register. We should fix abc.register as that might affect the specializing interpreter as well.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh, I thought it already did invalidation, so yes this is a bug.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@cocolato do you mind opening an issue for abc.register separately please?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sure, i will try to create the issue and solve this :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You don't have to solve it (unless you want to of course), but just opening an issue is fine :). Thank you
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If we know the type, we can optimize the code as well as refining the type information
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyTypeObject *type = sym_get_type(subject); | ||
| if (type != NULL) { | ||
| int match = type->tp_flags & Py_TPFLAGS_MAPPING; | ||
| res = sym_new_const(ctx, match ? Py_True : Py_False); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Since we know what _MATCH_MAPPING is going to produce, we can do this:
REPLACE_OP(this_instr, _LOAD_COMMON_CONST, match? CONSTANT_TRUE : CONSTANT_FALSE, 0);
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyTypeObject *type = sym_get_type(subject); | ||
| if (type != NULL) { | ||
| int match = type->tp_flags & Py_TPFLAGS_SEQUENCE; | ||
| res = sym_new_const(ctx, match ? Py_True : Py_False); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Likewise:
REPLACE_OP(this_instr, _LOAD_COMMON_CONST, match? CONSTANT_TRUE : CONSTANT_FALSE, 0);
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again I believe mark meant |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @markshannon, @kumaraditya303: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyTypeObject *type = sym_get_type(subject); | ||
| if (type != NULL) { | ||
| int match = type->tp_flags & Py_TPFLAGS_MAPPING; | ||
| REPLACE_OP(this_instr, _LOAD_COMMON_CONSTANT, match? CONSTANT_TRUE : CONSTANT_FALSE, 0); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
you need to assign to res here as well
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
added, sorry for the wait
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| PyTypeObject *type = sym_get_type(subject); | ||
| if (type != NULL) { | ||
| int match = type->tp_flags & Py_TPFLAGS_SEQUENCE; | ||
| REPLACE_OP(this_instr, _LOAD_COMMON_CONSTANT, match? CONSTANT_TRUE : CONSTANT_FALSE, 0); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In other places, LOAD_CONST_INLINE_BORROW is used which would be faster
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is stale because it has been open for 90 days with no activity. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.