Skip to content
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

Tier 1 code generator doesn't track used values if named unused #121784

Closed
markshannon opened this issue Jul 15, 2024 · 1 comment
Closed

Tier 1 code generator doesn't track used values if named unused #121784

markshannon opened this issue Jul 15, 2024 · 1 comment
Labels
3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@markshannon
Copy link
Member

markshannon commented Jul 15, 2024

Bug report

Bug description:

The _INIT_CALL_BOUND_METHOD_EXACT_ARGS uop definition requires explicit code to force the function and self to be written to memory, or the values are lost.
This is because following uops do not use those values, so when they are used they are loaded from memory.

This can be fixed in one of two ways:

  • Raise an error if a value that is cached is marked as unused forcing it to be explicitly named.
  • Implicitly name unused but cached values in the code generator, so that they are tracked properly.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

@markshannon markshannon added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.14 new features, bugs and security fixes labels Jul 15, 2024
@markshannon
Copy link
Member Author

I've opted for generating an error, rather than renaming the variable.
The fix is much simpler, and adding meaningful names is harmless at worse and can improve comprehension.

markshannon added a commit that referenced this issue Jul 18, 2024
…`unused`, but is used and thus cached in a prior uop. (#121788)

* Reject uop definitions that declare values as 'unused' that are already cached by prior uops

* Track which variables are defined and only load from memory when needed

* Support explicit `flush` in macro definitions. 

* Make sure stack is flushed in where needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant