Skip to content

Conversation

Wulian233
Copy link
Contributor

@Wulian233 Wulian233 commented Nov 5, 2024

This is my first time PR for part C, which looks like it might be a small improvement, hopefully I'm not doing anything wrong🙂

About 0.5% faster? (from issue)

Comment on lines 1228 to 1229
static int uop_optimize_initialized = 0;
static int uop_optimize_flag = 0;
Copy link
Member

Choose a reason for hiding this comment

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

This isn't thread safe or subinterpreter safe. You might want to store the value in a PyThreadState / PyInterpreterState in pylifecycle.c instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I gave it a try, but it didn’t work out in the end. I guess I don’t have enough experience yet. I'm really sorry, I might not be able to handle this on my own. Maybe someone else could take it, or maybe you could help improve what I have so far :(

@Wulian233 Wulian233 marked this pull request as draft November 5, 2024 12:44
@Fidget-Spinner
Copy link
Member

@mdboom did you have a change planned for this?

@mdboom
Copy link
Contributor

mdboom commented Nov 6, 2024

@mdboom did you have a change planned for this?

No, I don't have a plan. Thanks to @Wulian233 for taking this on.

@Wulian233 Wulian233 marked this pull request as ready for review April 29, 2025 11:14
initialize_uops_optimize_flag(void) {
if (!uops_optimize_initialized) {
PyInterpreterState *interp = _PyInterpreterState_GET();
char *env_var = Py_GETENV("PYTHON_UOPS_OPTIMIZE");
Copy link
Member

@Fidget-Spinner Fidget-Spinner Apr 29, 2025

Choose a reason for hiding this comment

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

Can you please do this instead at where we check for PYTHON_JIT ? So in pylifecycle.c.

Set the thread state/interp state there as well.

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.

4 participants