Skip to content

gh-131798: optimize through keyword and bound method calls in the JIT#148466

Merged
Fidget-Spinner merged 7 commits intopython:mainfrom
kumaraditya303:jit-calls
Apr 13, 2026
Merged

gh-131798: optimize through keyword and bound method calls in the JIT#148466
Fidget-Spinner merged 7 commits intopython:mainfrom
kumaraditya303:jit-calls

Conversation

@kumaraditya303
Copy link
Copy Markdown
Contributor

@kumaraditya303 kumaraditya303 commented Apr 12, 2026


def test_call_kw(self):
def func(a):
return 42 * a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should be checking that we optimize through the trace. So the best way is to put a global (e.g. range) here and check if it gets promoted in the tests below. See for example test_init_resolves_callable which does self.assertNotIn("_LOAD_GLOBAL_BUILTINS", uops). Same for the other test.

@Fidget-Spinner
Copy link
Copy Markdown
Member

It's not optimizing through the bound method because we're missing _EXPAND_METHOD_KW in the JIT. I think you can just copy whatever _EXPAND_METHOD has and place it under there.

@Fidget-Spinner Fidget-Spinner changed the title gh-131798: optimize CALL_KW_PY in the JIT gh-131798: optimize through keyword and bound method calls in the JIT Apr 13, 2026
Copy link
Copy Markdown
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

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

Thanks! This should be a pretty decent win.

@Fidget-Spinner Fidget-Spinner merged commit 88e378c into python:main Apr 13, 2026
78 checks passed
@kumaraditya303 kumaraditya303 deleted the jit-calls branch April 13, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants