-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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-118095: Add dynamic exit support and FOR_ITER_GEN support to tier 2 #118279
Conversation
markshannon
commented
Apr 25, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Increase the number of micro-ops that we can handle in tier 2 #118095
Python/bytecodes.c
Outdated
assert(next_instr - this_instr + oparg <= UINT16_MAX); | ||
frame->return_offset = (uint16_t)(next_instr - this_instr + oparg); | ||
DISPATCH_INLINED(gen_frame); | ||
frame->return_offset = (uint16_t)(2 + oparg); |
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.
What does 2
stand for? Can you add a comment?
Python/bytecodes.c
Outdated
// The 'unused' output effect represents the return value | ||
// (which will be pushed when the frame returns). | ||
// It is needed so CALL_PY_EXACT_ARGS matches its family. |
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 comment is outdated -- I suggest just deleting it.
@@ -87,6 +87,7 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, PyObject **stack_pointer, PyThreadState * | |||
PATCH_VALUE(_PyExecutorObject *, current_executor, _JIT_EXECUTOR) | |||
int oparg; | |||
int uopcode = _JIT_OPCODE; | |||
_Py_CODEUNIT *next_instr; |
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.
I'd like to know what @brandtbucher thinks of this.
Python/bytecodes.c
Outdated
if (!backoff_counter_triggers(exit->temperature)) { | ||
GOTO_TIER_ONE(target); |
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 doesn't advance the temperature. From _SIDE_EXIT
, it looks like the correct idiom is
_Py_BackoffCounter temperature = exit->temperature;
if (!backoff_counter_triggers(temperature)) {
exit->temperature = advance_backoff_counter(temperature);
GOTO_TIER_ONE(target);
}
@@ -4222,6 +4258,7 @@ dummy_func( | |||
GOTO_UNWIND(); | |||
} | |||
|
|||
|
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.
Stray blank line?
The usual four failures. |
|
@markshannon I now get this warning:
That's in here: case _FOR_ITER_GEN_FRAME: {
_PyInterpreterFrame *gen_frame;
gen_frame = sym_new_not_null(ctx);
if (gen_frame == NULL) goto out_of_space;
stack_pointer[0] = (_Py_UopsSymbol *)gen_frame;
stack_pointer += 1;
break;
} Apparently generated by the generator using the default code generation strategy. We may need to add a dummy case for (@Fidget-Spinner Or is there another way to fix this?) |
The optimizer bytecodes shouldnt even use the cast. I should fix that because ifs interfering with tagged ptrs too |
For now, we can just override it I think as a hotfix. |