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

Avoid BoundSymbol repeating itself in its subsymbols after functionalization #802

Merged
merged 3 commits into from
Jul 23, 2024

Conversation

crcrpar
Copy link
Collaborator

@crcrpar crcrpar commented Jul 18, 2024

What does this PR do?

Fixes #801.

For some in-place ops, functionalization would create a new boundsymbol whose first subsymbol is identical. As in the linked issue, this redundant nest seems to bother nvfuser region creation. This PR adds a simple check and edit to avoid such situation.

@crcrpar crcrpar changed the title Avoid BoundSymbol repeating itself in its subsymbols Avoid BoundSymbol repeating itself in its subsymbols after functionalization Jul 18, 2024
@crcrpar crcrpar force-pushed the crpa/no-redundant-bsym-in-subsymbols branch 2 times, most recently from a5bf901 to 4777056 Compare July 19, 2024 08:23
@crcrpar crcrpar force-pushed the crpa/no-redundant-bsym-in-subsymbols branch from 4777056 to f9c5120 Compare July 19, 2024 18:53
@@ -848,6 +848,12 @@ def computation(x):
new_bsyms.append(new_functional_bsym)
bsym_inplace_to_functional[new_bsym] = new_functional_bsym

if (
len(new_functional_bsym.subsymbols) == 1
and new_functional_bsym.rhs == new_functional_bsym.subsymbols[0].rhs
Copy link
Contributor

@nikitaved nikitaved Jul 22, 2024

Choose a reason for hiding this comment

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

Could you please explain why name/id/other description not involving explicit construction of BoundSymbolRHS is not sufficient? My rationale: I am biased in favor of using as less of hash(BoundSymbol...) as possible...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I might be just paranoid but I want to make sure args/kwargs are the same, not only sym of them.

Copy link
Contributor

@nikitaved nikitaved left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you, @crcrpar ! Do not want to block you any longer :)

@crcrpar crcrpar force-pushed the crpa/no-redundant-bsym-in-subsymbols branch from f9c5120 to 7703887 Compare July 22, 2024 15:35
crcrpar and others added 3 commits July 23, 2024 13:56
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Co-authored-by: nikitaved <nikitaved@users.noreply.github.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
@crcrpar crcrpar force-pushed the crpa/no-redundant-bsym-in-subsymbols branch from 7703887 to fe97811 Compare July 23, 2024 04:57
@t-vi t-vi merged commit e4c6970 into main Jul 23, 2024
34 of 36 checks passed
@t-vi t-vi deleted the crpa/no-redundant-bsym-in-subsymbols branch July 23, 2024 07:28
@t-vi
Copy link
Collaborator

t-vi commented Jul 23, 2024

Thank you @crcrpar @nikitaved

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.

functionalize_inplace_ops could produce a BoundSymbol whose first BoundSymbol is identical
3 participants