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-118095: Use broader specializations in tier 1, for better tier 2 support of calls.#118322

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
markshannon merged 19 commits intopython:mainfromfaster-cpython:tier-2-call
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
19 commits
Select commitHold shift + click to select a range
0b157ab
Add CALL_PY_GENERAL and CALL_BOUND_METHOD_GENERAL call specializations.
markshannonApr 26, 2024
2262f98
Add CALL_NON_PY_GENERAL call specialization
markshannonApr 26, 2024
4af43c2
Remove CALL_PY_WITH_DEFAULTS specialization
markshannonApr 26, 2024
b7795e3
Fix JIT build
markshannonApr 26, 2024
e5c7dce
Use CALL_NON_PY_GENERAL in more cases when otherwise failing to speci…
markshannonApr 30, 2024
61abb3b
Delete unused code
markshannonMay 2, 2024
b49bc86
Make sure that function version number is checked when tracing throug…
markshannonMay 3, 2024
f42519d
whitespace
markshannonMay 3, 2024
3294632
Merge branch 'main' into tier-2-call
markshannonMay 3, 2024
1a2dcfe
Check verion on function, not method
markshannonMay 3, 2024
62ff43c
Lower WASI C recursion limit again
markshannonMay 3, 2024
71c6d41
Get test passing on wasi
markshannonMay 3, 2024
0b40773
Lower WASI C recursion limit again
markshannonMay 3, 2024
02cdf2f
Yet another attempt to get the WASI build to work
markshannonMay 3, 2024
1831eb3
Skip test for WASI
markshannonMay 3, 2024
7819b1c
Skip another test for WASI
markshannonMay 3, 2024
857d152
Address some review comments
markshannonMay 4, 2024
839d16e
Use _SAVE_RETURN_OFFSET in general call instructions
markshannonMay 4, 2024
1d5c0a7
Merge branch 'main' into tier-2-call
markshannonMay 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Remove CALL_PY_WITH_DEFAULTS specialization
  • Loading branch information
@markshannon
markshannon committedMay 2, 2024
commit4af43c2bcdee8853ffbe6df293319764e0af3316
8 changes: 1 addition & 7 deletionsInclude/internal/pycore_opcode_metadata.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

1 change: 0 additions & 1 deletionInclude/internal/pycore_uop_ids.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

89 changes: 44 additions & 45 deletionsInclude/opcode_ids.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

90 changes: 44 additions & 46 deletionsLib/_opcode_metadata.py
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

35 changes: 0 additions & 35 deletionsPython/bytecodes.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3041,7 +3041,6 @@ dummy_func(
family(CALL, INLINE_CACHE_ENTRIES_CALL) = {
CALL_BOUND_METHOD_EXACT_ARGS,
CALL_PY_EXACT_ARGS,
CALL_PY_WITH_DEFAULTS,
CALL_TYPE_1,
CALL_STR_1,
CALL_TUPLE_1,
Expand DownExpand Up@@ -3323,40 +3322,6 @@ dummy_func(
_SAVE_RETURN_OFFSET +
_PUSH_FRAME;

inst(CALL_PY_WITH_DEFAULTS, (unused/1, func_version/2, callable, self_or_null, args[oparg] -- unused)) {
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, this isn't worth specializing anymore? I forget exactly why it can't be converted to tier two (I'm guessing that there's more than one reason, since the use ofthis_instr can be easily worked around).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Two reasons:

  1. Because this loops over both arguments and defaults, it probably isn't much faster thanCALL_PY_GENERAL for tier 1. It is almost certainly slower in the JIT because of its size.CALL_PY_GENERAL calls a help function, so is more compact.
  2. We expect that, for 3.14, the tier 2 optimizer will convert them both to the same optimal sequence of operations.

DEOPT_IF(tstate->interp->eval_frame);
int argcount = oparg;
if (self_or_null != NULL) {
args--;
argcount++;
}
DEOPT_IF(!PyFunction_Check(callable));
PyFunctionObject *func = (PyFunctionObject *)callable;
DEOPT_IF(func->func_version != func_version);
PyCodeObject *code = (PyCodeObject *)func->func_code;
assert(func->func_defaults);
assert(PyTuple_CheckExact(func->func_defaults));
int defcount = (int)PyTuple_GET_SIZE(func->func_defaults);
assert(defcount <= code->co_argcount);
int min_args = code->co_argcount - defcount;
DEOPT_IF(argcount > code->co_argcount);
DEOPT_IF(argcount < min_args);
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize));
STAT_INC(CALL, hit);
_PyInterpreterFrame *new_frame = _PyFrame_PushUnchecked(tstate, func, code->co_argcount);
for (int i = 0; i < argcount; i++) {
new_frame->localsplus[i] = args[i];
}
for (int i = argcount; i < code->co_argcount; i++) {
PyObject *def = PyTuple_GET_ITEM(func->func_defaults, i - min_args);
new_frame->localsplus[i] = Py_NewRef(def);
}
// Manipulate stack and cache directly since we leave using DISPATCH_INLINED().
STACK_SHRINK(oparg + 2);
frame->return_offset = (uint16_t)(next_instr - this_instr);
DISPATCH_INLINED(new_frame);
}

inst(CALL_TYPE_1, (unused/1, unused/2, callable, null, arg -- res)) {
assert(oparg == 1);
DEOPT_IF(null != NULL);
Expand Down
2 changes: 0 additions & 2 deletionsPython/executor_cases.c.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

46 changes: 0 additions & 46 deletionsPython/generated_cases.c.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionPython/opcode_targets.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 0 additions & 2 deletionsPython/optimizer_cases.c.h
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.


[8]ページ先頭

©2009-2025 Movatter.jp