-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir][core] NFC update builder create API usage #147311
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
Closed
makslevental
wants to merge
5
commits into
llvm:main
from
makslevental:makslevental/update-create-api
Closed
[mlir][core] NFC update builder create API usage #147311
makslevental
wants to merge
5
commits into
llvm:main
from
makslevental:makslevental/update-create-api
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99616f1 to
0aeb797
Compare
837374a to
5881ed8
Compare
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
5881ed8 to
b69c5b8
Compare
2 tasks
rniczh
added a commit
to PennyLaneAI/catalyst
that referenced
this pull request
Nov 5, 2025
**Context:** Update llvm, stablehlo and enzyme, 2025 Q4 The latest pair of good versions, indicated by stablehlo, is openxla/stablehlo@0a4440a ``` stablehlo=0a4440a5c8de45c4f9649bf3eb4913bf3f97da0d llvm=113f01aa82d055410f22a9d03b3468fa68600589 ``` For Enzyme, we go to the latest release https://github.com/EnzymeAD/Enzyme/releases/tag/v0.0.203 ``` enzyme=v0.0.203 ``` with commit `476c8e3193a8577ba24ff845ae2294109225f83a` **Description of the Change:** - `llvm-project/mlir/include/mlir/InitAllPasses.h` header no longer includes individual pass headers. To incorporate specific passes, you now need to include either `mlir/Conversion/Passes.h` or the header for each dialect pass. This change stems from the upstream cleanup of `mlir/InitAllDialects.h`, which previously handled these includes. Following the decision from the owner (as seen in this pull request comment: https://github.com/ftynse/water/pull/16/files#r2259526343), we will specifically include each required header, faster compilation (no unnecessary headers). For further context, refer to this PR: llvm/llvm-project#151150 - To bufferize custom tensors into custom buffers. The upstream PR llvm/llvm-project#144867 changed the the return type of `bufferization::detail::defaultGetBufferType` to be `BufferLikeType` instead of `BaseMemRefType`. We aligned the behaviour with the upstream PR, return the BufferLikeType from our `getBufferType()` implementation as well. - `elemwise_unary` and `elemwise_binary` of `linalg` have been deprecated from the upstream, replaced with `elementwise`. llvm/llvm-project#147082. Follow this PR, using `linalg.add` directly. register_all_dialects/passes/extension` should now be configured as a static library in CMake, refer to this PR: llvm/llvm-project#151150 - An opt-in feature (`{op}::create` method) be added to support the same behaviour of `rewriter.create` method. But it provides a meaningful message when using this new opt-in feature compared to `rewrite.create`. Since the new generated `create` function will call the `build` function, it requires us to define the instance of the builder (`GraidentOps.td`). Refer to the PR: llvm/llvm-project#147168. **Take `linalg.abs` as an example:** ```cpp void AbsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, ValueRange outputs, ArrayRef<NamedAttribute> attributes) { buildStructuredOp(odsBuilder, odsState, std::nullopt, inputs, outputs, attributes, AbsOp::getRegionBuilder()); } AbsOp AbsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ValueRange inputs, ValueRange outputs, ArrayRef<NamedAttribute> attributes) { ::mlir::OperationState __state__(location, getOperationName()); build(builder, __state__, inputs, outputs, attributes); auto __res__ = ::llvm::dyn_cast<AbsOp>(builder.create(__state__)); assert(__res__ && "builder didn't return the right type"); return __res__; } AbsOp AbsOp::create(::mlir::ImplicitLocOpBuilder &builder, ValueRange inputs, ValueRange outputs, ArrayRef<NamedAttribute> attributes) { return create(builder, builder.getLoc(), inputs, outputs, attributes); } ``` - Changed `EnzymeStatic-21` to `EnzymeStatic-22` - Mock `_ods_cext.globals.register_traceback_file_exclusion` due to API conflicts between Catalyst's MLIR version and the MLIR version used by JAX. The current JAX version we used has not yet updated to the latest MLIR, causing compatibility issues. This workaround will be removed once JAX updates to a compatible MLIR version. llvm/llvm-project#151246 TODO: - [x] Update .dep_version - [ ] Change all `rewrite.create` to `{op}::create` Even it’s compatible to the current `rewrite.create` method, we don’t need to change all `rewrite.create` to `{op}::create` right away, but this new feature provides more friendly development experience. Just for an example: llvm/llvm-project#147311 **Benefits:** **Possible Drawbacks:** **Related GitHub Issues:** [sc-100911] [sc-100912] --------- Co-authored-by: David Ittah <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #147168
TODO: update ops that use "custom"
buildmethods (likearith::ConstantIndexOp)