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

Fwddiff ret_activity canonicalizations #2271

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

vimarsh6739
Copy link
Member

@vimarsh6739 vimarsh6739 commented Mar 29, 2025

Simplifies return activity whenever legal.

  • dup --> dupnoneed
  • dup --> const
  • dupnoneed --> constnoneed
  • const --> constnoneed

tagging @jhueckelheim

@vimarsh6739 vimarsh6739 requested a review from wsmoses March 29, 2025 22:49
@vimarsh6739 vimarsh6739 changed the title Fwddiff ret_activity canonicalization Fwddiff ret_activity canonicalizations Mar 30, 2025
@vimarsh6739 vimarsh6739 marked this pull request as draft March 30, 2025 00:10
@vimarsh6739 vimarsh6739 self-assigned this Mar 30, 2025
@vimarsh6739 vimarsh6739 marked this pull request as ready for review March 30, 2025 11:22
class FwdRetDupNNToConstNN final : public OpRewritePattern<ForwardDiffOp> {
public:
using OpRewritePattern<ForwardDiffOp>::OpRewritePattern;

Copy link
Member

Choose a reason for hiding this comment

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

can we simplify this by having one pattern that does all of these, and not needing to create all the separate prologue/epilogues?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could do that, but i.m.o. the epilogue part becomes hairy (especially if we want to handle dup --> constnoneed - you are eliminating 2 return values as compared to 1). All transforms here strictly reduce number of args by 1.

I'll still give it a go.

@@ -19,6 +19,7 @@ target_link_libraries(enzymemlir-translate
MLIRSPIRVDialect
MLIRTranslateLib
MLIRSupport
"ZLIB::ZLIB"
Copy link
Member

Choose a reason for hiding this comment

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

is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

cmake build fails without that, so for now I just added it as a quick fix

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.

2 participants