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

Fix check for redundant loop priority #895

Merged
merged 3 commits into from
Dec 4, 2024
Merged

Fix check for redundant loop priority #895

merged 3 commits into from
Dec 4, 2024

Conversation

kaushikcfd
Copy link
Collaborator

@kaushikcfd kaushikcfd commented Dec 4, 2024

Closes #890.

The attached regression fails on main.

/cc @connorjward

Co-authored-by: Connor Ward <c.ward20@imperial.ac.uk>
@@ -862,10 +863,14 @@ def _update_nesting_constraints(
.ancestors(inner_iname_nest))
ancestors_of_outer_iname = (loop_nest_tree
.ancestors(outer_iname_nest))
if outer_iname in ancestors_of_inner_iname:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would have been nice if mypy could tell us our comparison types are incompatible. We were checking "InameStr in tuple[InameStrSet, ...]" which would always return False.

Copy link
Owner

Choose a reason for hiding this comment

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

I agree. But __contains__ is typed for object: https://github.com/python/typeshed/blob/d70fad09dd7012bd43304e1c67b7599558b90c39/stdlib/typing.pyi#L575

😢

To their credit, the Python types people have discussed it: python/typeshed#8219

@kaushikcfd kaushikcfd requested a review from inducer December 4, 2024 15:52
@connorjward
Copy link
Contributor

Thanks!

Copy link
Owner

@inducer inducer left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! A minor nit below, otherwise LGTM!

loopy/schedule/tools.py Outdated Show resolved Hide resolved
loopy/schedule/tools.py Outdated Show resolved Hide resolved
@@ -862,10 +863,14 @@ def _update_nesting_constraints(
.ancestors(inner_iname_nest))
ancestors_of_outer_iname = (loop_nest_tree
.ancestors(outer_iname_nest))
if outer_iname in ancestors_of_inner_iname:
Copy link
Owner

Choose a reason for hiding this comment

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

I agree. But __contains__ is typed for object: https://github.com/python/typeshed/blob/d70fad09dd7012bd43304e1c67b7599558b90c39/stdlib/typing.pyi#L575

😢

To their credit, the Python types people have discussed it: python/typeshed#8219

@inducer
Copy link
Owner

inducer commented Dec 4, 2024

FYI: Firedrake failures are expected for the time being, see #894.

loopy/schedule/tools.py Outdated Show resolved Hide resolved
@inducer inducer merged commit 56936b1 into main Dec 4, 2024
17 of 18 checks passed
@inducer inducer deleted the fix_loop_prio branch December 4, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Understanding loop_priority
3 participants