Skip to content

[tuner] retire op_matchers.py through IREE python bindings #1264

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 3 commits into from
Apr 18, 2025

Conversation

bangtianliu
Copy link
Contributor

@bangtianliu bangtianliu commented Apr 15, 2025

This PR offloads the op_matcher.py logic to the IREE compiler through exposed python bindings as shown below:

  • root_op_list = iree_codegen.get_tuner_root_ops(input_module)
  • linalg::isaContractionOpInterface and linalg::inferContractionDims
  • linalg::isaConvolutionOpInterface and linalg::inferConvolutionDims

Issue:
#1110
#814
#https://github.com/nod-ai/playbook/issues/74

@bangtianliu bangtianliu force-pushed the retire_op_matcher branch 2 times, most recently from a84f7f3 to c910188 Compare April 15, 2025 13:58
@bangtianliu bangtianliu requested review from kuhar and Max191 April 15, 2025 13:59
Copy link
Contributor

@Max191 Max191 left a comment

Choose a reason for hiding this comment

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

Nice work so far! A couple of higher level comments:

The python bindings are a bit more general than the matching we previously had, so they will be able to handle more operation types than we used to (named ops, different conv layouts, etc.). I think it is probably better to keep this PR largely NFC in terms of op support, so lets restrict the parsers to only the types of ops that we were originally supporting. Then, as a followup, support can be added for more types of contraction/convolution ops.

This way, we keep the PRs smaller, and we can land this without needing to solve any issues with additional op support.

@bangtianliu bangtianliu force-pushed the retire_op_matcher branch 3 times, most recently from dc79168 to 643dc1a Compare April 16, 2025 17:24
@bangtianliu bangtianliu requested a review from Max191 April 16, 2025 17:25
Copy link
Contributor

@Max191 Max191 left a comment

Choose a reason for hiding this comment

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

Looks good! It's awesome to be able to remove the op_matchers file now :)

@bangtianliu
Copy link
Contributor Author

cc @kuhar

Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

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

LGTM. I love seeing all the deleted code in red.

@bangtianliu bangtianliu merged commit 0886ba7 into nod-ai:main Apr 18, 2025
39 of 40 checks passed
bangtianliu added a commit that referenced this pull request Apr 21, 2025
Per suggestion from this comment
#1264 (comment),
this PR mainly removes the todo comment and adds tests for named ops.

---------

Signed-off-by: Bangtian Liu <[email protected]>
bangtianliu added a commit that referenced this pull request Apr 22, 2025
As llvm/llvm-project#136054 is landed, the
Python binding for `linalgOp.getIndexingMaps` can be used for tuner
according to the comment
#1264 (comment).

Signed-off-by: Bangtian Liu <[email protected]>
IanNod pushed a commit to IanNod/SHARK-Platform that referenced this pull request May 3, 2025
Per suggestion from this comment
nod-ai#1264 (comment),
this PR mainly removes the todo comment and adds tests for named ops.

---------

Signed-off-by: Bangtian Liu <[email protected]>
IanNod pushed a commit to IanNod/SHARK-Platform that referenced this pull request May 3, 2025
)

As llvm/llvm-project#136054 is landed, the
Python binding for `linalgOp.getIndexingMaps` can be used for tuner
according to the comment
nod-ai#1264 (comment).

Signed-off-by: Bangtian Liu <[email protected]>
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.

3 participants