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

dialects: (transform) Add some transform dialect operations #2973

Merged
merged 19 commits into from
Aug 6, 2024

Conversation

JonasCrols
Copy link
Contributor

Adds 7 operations of the transform dialect (SequenceOp, YieldOp, TileOp, TileToForallOp, SelectOp, NamedSequenceOp, CastOp), as well as 4 new types (OperationType, ParamType, TypeParamType,TransformHandleType). All with tests and filecheck

@JonasCrols
Copy link
Contributor Author

@jorendumoulin @JosseVanDelm please sort out reviewers

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.84%. Comparing base (3543d82) to head (9c8e75a).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2973      +/-   ##
==========================================
- Coverage   89.86%   89.84%   -0.02%     
==========================================
  Files         409      410       +1     
  Lines       51085    51315     +230     
  Branches     7923     7955      +32     
==========================================
+ Hits        45905    46106     +201     
- Misses       3926     3942      +16     
- Partials     1254     1267      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 106 to 109
# TODO: Find out how to also use the enum FailurePropagationModeAttr as well as AnyIntegerAttr

body = region_def("single_block")
failure_propagation_mode = prop_def(AnyIntegerAttr)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why does it need to be anyintegerattr? can it not just be failureproagationmodeattr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both IntegerAttr and FailurePropagationModeAttr are supported. for most use cases, it looks like the IntegerAttr is used so I just used this until FailurePropagationModeAttr was also completed

Copy link
Collaborator

@JosseVanDelm JosseVanDelm left a comment

Choose a reason for hiding this comment

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

Thank you @JonasCrols! This is a very cool PR!

I made a few nit comments on:

  • Adding docstrings to certain ops.
  • Support other inits (e.g. also support a list of integers instead of just a DenseArrayAttr).
    I think some more refactoring could make that easily possible, although I don't think this is essential for this PR.

My biggest issue is that currently it is not very clear which version of the transform dialect we would be supporting.
I think this is an important discussion to have first, especially since it seems quite unstable (as you have noticed). I'm curious what you and others think about this.

I think it would be nice/important(?) if we could also add transform interop tests to this PR.

tests/dialects/test_transform.py Show resolved Hide resolved
@@ -1,13 +1,49 @@
// RUN: XDSL_ROUNDTRIP
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure which version of MLIR we are supporting now.
Should we not also include interoperability tests? Or maybe this is okay for a next PR?
@JonasCrols let me know if you need help in adding the interoperability test!
(Essentially you would be "round-tripping" between xdsl-opt and mlir-opt, instead of just xdsl-opt and xdsl-opt)

Copy link
Member

Choose a reason for hiding this comment

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

It's in the readme, I would say that we want to match the syntax 1:1 with the version of MLIR in that commit, and not the latest MLIR, and if there's a reason to update the MLIR version then we can do that also.

tests/dialects/test_transform.py Show resolved Hide resolved
xdsl/dialects/transform.py Show resolved Hide resolved
xdsl/dialects/transform.py Outdated Show resolved Hide resolved
@JosseVanDelm JosseVanDelm requested review from math-fehr and qaco August 1, 2024 14:30
Copy link
Collaborator

@AntonLydike AntonLydike left a comment

Choose a reason for hiding this comment

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

I don't know much about the transform dialect, so this is more xDSL level feedback, but it looks pretty promising already! Looking forward to having this in!

xdsl/dialects/transform.py Outdated Show resolved Hide resolved
xdsl/dialects/transform.py Outdated Show resolved Hide resolved
xdsl/dialects/transform.py Outdated Show resolved Hide resolved
Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

Really fantastic to see this, thank you!

@superlopuh
Copy link
Member

Please reach out on the Zulip if you need any help with the tests


body = region_def("single_block")
failure_propagation_mode: Property = prop_def(
T # pyright: ignore[reportArgumentType]
Copy link
Member

Choose a reason for hiding this comment

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

please remove this pyright ignore

Copy link
Member

Choose a reason for hiding this comment

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

I'm currently trying to refactor some things for the newer Pyright version to be happy, but for the time being please use make pyright as the source of truth

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

What's your plan for this? Are you interested in implementing an interpreter for the dialect in xDSL, or are you planning to use the MLIR transforms directly?

Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
@JonasCrols
Copy link
Contributor Author

Looks great, thank you!

What's your plan for this? Are you interested in implementing an interpreter for the dialect in xDSL, or are you planning to use the MLIR transforms directly?

We'll be using this to automatically tile all matmul operations. As of now, our plan is to use the mlir --transform-interpreter pass directly as it works fine for our goals. we're not currently planning on adding the interpreter to xDSL

@superlopuh superlopuh merged commit 04bdfc0 into xdslproject:main Aug 6, 2024
10 checks passed
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.

5 participants