Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[mlir] Add Python bindings to enable default passmanager timing#149087

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

maerhart
Copy link
Member

No description provided.

@llvmbot
Copy link
Member

@llvm/pr-subscribers-mlir

Author: Martin Erhart (maerhart)

Changes

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

3 Files Affected:

  • (modified) mlir/include/mlir-c/Pass.h (+4)
  • (modified) mlir/lib/Bindings/Python/Pass.cpp (+6)
  • (modified) mlir/lib/CAPI/IR/Pass.cpp (+4)
diff --git a/mlir/include/mlir-c/Pass.h b/mlir/include/mlir-c/Pass.hindex 8fd8e9956a65a..0d2e19ee7fb0a 100644--- a/mlir/include/mlir-c/Pass.h+++ b/mlir/include/mlir-c/Pass.h@@ -88,6 +88,10 @@ MLIR_CAPI_EXPORTED void mlirPassManagerEnableIRPrinting( MLIR_CAPI_EXPORTED void mlirPassManagerEnableVerifier(MlirPassManager passManager, bool enable);+/// Enable pass timing.+MLIR_CAPI_EXPORTED void+mlirPassManagerEnableTiming(MlirPassManager passManager);+ /// Nest an OpPassManager under the top-level PassManager, the nested /// passmanager will only run on operations matching the provided name. /// The returned OpPassManager will be destroyed when the parent is destroyed.diff --git a/mlir/lib/Bindings/Python/Pass.cpp b/mlir/lib/Bindings/Python/Pass.cppindex 858c3bd5745fe..8d84864b9db4d 100644--- a/mlir/lib/Bindings/Python/Pass.cpp+++ b/mlir/lib/Bindings/Python/Pass.cpp@@ -112,6 +112,12 @@ void mlir::python::populatePassManagerSubmodule(nb::module_ &m) {             mlirPassManagerEnableVerifier(passManager.get(), enable);           },           "enable"_a, "Enable / disable verify-each.")+      .def(+          "enable_timing",+          [](PyPassManager &passManager) {+            mlirPassManagerEnableTiming(passManager.get());+          },+          "Enable pass timing.")       .def_static(           "parse",           [](const std::string &pipeline, DefaultingPyMlirContext context) {diff --git a/mlir/lib/CAPI/IR/Pass.cpp b/mlir/lib/CAPI/IR/Pass.cppindex 883b7e8bb832d..3c499c3e4974d 100644--- a/mlir/lib/CAPI/IR/Pass.cpp+++ b/mlir/lib/CAPI/IR/Pass.cpp@@ -75,6 +75,10 @@ void mlirPassManagerEnableVerifier(MlirPassManager passManager, bool enable) {   unwrap(passManager)->enableVerifier(enable); }+void mlirPassManagerEnableTiming(MlirPassManager passManager) {+  unwrap(passManager)->enableTiming();+}+ MlirOpPassManager mlirPassManagerGetNestedUnder(MlirPassManager passManager,                                                 MlirStringRef operationName) {   return wrap(&unwrap(passManager)->nest(unwrap(operationName)));

Copy link
Contributor

@maksleventalmakslevental left a comment

Choose a reason for hiding this comment

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

Should we havedisable too? Or is that unneccessary for some reason that I can't think of right now?

@maerhart
Copy link
MemberAuthor

Should we havedisable too? Or is that unneccessary for some reason that I can't think of right now?

Enabling timing adds an instrumentation and AFAIK we don't even have a way to remove instrumentations in the C++ implementation of the passmanager, so it would be more than just a CAPI and Python bindings change.
Also, I never had the need to disable timing again after enabling it. Usually it's enough to just not enable it in the first place. However, if the need arises, we can always add it later on.

makslevental reacted with thumbs up emoji

@maerhartmaerhart merged commit616e4c4 intomainJul 16, 2025
11 checks passed
@maerhartmaerhart deleted the users/maerhart/mlir-passmanager-timing-python branchJuly 16, 2025 14:45
seldridge pushed a commit to llvm/circt that referenced this pull requestJul 16, 2025
Preparing this week's bump to get*llvm/llvm-project#149087*llvm/llvm-project#139694Changes:* Remove ambiguous builder in SV
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@maksleventalmaksleventalmakslevental approved these changes

@rkayaithrkayaithAwaiting requested review from rkayaith

@joker-ephjoker-ephAwaiting requested review from joker-eph

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@maerhart@llvmbot@makslevental

[8]ページ先頭

©2009-2025 Movatter.jp