Skip to content

[MLIR][Python] Add missing peel_front argument to LoopPeelOp's extension class #81424

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

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

rolfmorel
Copy link
Contributor

While PR 74015 added support for peeling an iteration from the front of a loop, it did not update the (non-automatically generated) part of the Python interface that exposes the op.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@rolfmorel rolfmorel marked this pull request as ready for review February 11, 2024 18:04
@llvmbot llvmbot added mlir:python MLIR Python bindings mlir labels Feb 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Feb 11, 2024

@llvm/pr-subscribers-mlir

Author: Rolf Morel (rolfmorel)

Changes

While PR 74015 added support for peeling an iteration from the front of a loop, it did not update the (non-automatically generated) part of the Python interface that exposes the op.


Full diff: https://github.com/llvm/llvm-project/pull/81424.diff

1 Files Affected:

  • (modified) mlir/python/mlir/dialects/transform/loop.py (+6)
diff --git a/mlir/python/mlir/dialects/transform/loop.py b/mlir/python/mlir/dialects/transform/loop.py
index 3bdd9ca3b22f07..c4770b1c4067e4 100644
--- a/mlir/python/mlir/dialects/transform/loop.py
+++ b/mlir/python/mlir/dialects/transform/loop.py
@@ -55,6 +55,7 @@ def __init__(
         remainder_loop_type: Type,
         target: Union[Operation, Value],
         *,
+        peel_front: Union[bool, BoolAttr] = False,
         fail_if_already_divisible: Union[bool, BoolAttr] = False,
         ip=None,
         loc=None,
@@ -63,6 +64,11 @@ def __init__(
             main_loop_type,
             remainder_loop_type,
             _get_op_result_or_value(target),
+            peel_front=(
+                peel_front
+                if isinstance(peel_front, BoolAttr)
+                else BoolAttr.get(peel_front)
+            ),
             fail_if_already_divisible=(
                 fail_if_already_divisible
                 if isinstance(fail_if_already_divisible, BoolAttr)

@rolfmorel
Copy link
Contributor Author

@ftynse, @makslevental, @matthias-springer, as you guys worked on this file, could you maybe help with review? Thanks.

@makslevental
Copy link
Contributor

@rolfmorel can you add a test?

@makslevental makslevental self-requested a review February 12, 2024 00:47
@rolfmorel rolfmorel force-pushed the looppeelop_peel_front_py_fix branch 2 times, most recently from 96e778c to b3a1001 Compare February 12, 2024 15:07
Copy link

github-actions bot commented Feb 12, 2024

✅ With the latest revision this PR passed the Python code formatter.

@rolfmorel
Copy link
Contributor Author

@makslevental Added a test.

Note that this change is just about exposing an option in Python. Whether the implementation of the option works as intended is covered by tests for the C++ code.

…ion class

While PR 74015 added support for peeling an iteration from the front of a loop,
it did not update the (non-automatically generated) part of the Python
interface that exposes the op.
@rolfmorel rolfmorel force-pushed the looppeelop_peel_front_py_fix branch from b3a1001 to 33a0c28 Compare February 12, 2024 15:12
@makslevental
Copy link
Contributor

makslevental commented Feb 12, 2024

Note that this change is just about exposing an option in Python. Whether the implementation of the option works as intended is covered by tests for the C++ code.

Yea sure I just wanted to make sure this option is kept in sync with ODS (currently there's no logical connection between these wrappers and the canonical ODS).

If you need me to merge after the test passes, let me know.

@rolfmorel
Copy link
Contributor Author

Thanks for the explanation, @makslevental

I believe the tests have now passed. If you could merge the PR, that would be great!

Copy link
Contributor

@makslevental makslevental left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for filling in a missing piece.

@makslevental makslevental merged commit 4c654b7 into llvm:main Feb 12, 2024
Copy link

@rolfmorel Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested
by our build bots. If there is a problem with a build, you may recieve a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself.
This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:python MLIR Python bindings mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants