Skip to content

Conversation

@rniczh
Copy link
Contributor

@rniczh rniczh commented Oct 14, 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: [mlir] Reland Move InitAll*** implementation into static library llvm/llvm-project#151150
  • To bufferize custom tensors into custom buffers. The upstream PR [mlir][bufferization] Return BufferLikeType in BufferizableOpInterface 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. [MLIR][Linalg] Remove elemwise_unary and elemwise_binary 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: [mlir] Reland Move InitAll*** implementation into static library 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: [mlir][tblgen] add concrete create methods llvm/llvm-project#147168.
    Take linalg.abs as an example:
    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. [mlir][python] automatic location inference llvm/llvm-project#151246

TODO:

Benefits:

Possible Drawbacks:

Related GitHub Issues:
[sc-100911]
[sc-100912]

@rniczh rniczh marked this pull request as draft October 14, 2025 19:23
@rniczh rniczh marked this pull request as ready for review October 24, 2025 21:10
@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@rniczh rniczh marked this pull request as draft October 24, 2025 21:11
@rniczh rniczh marked this pull request as ready for review October 28, 2025 13:52
@rniczh rniczh requested a review from a team October 28, 2025 14:44
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.43%. Comparing base (0537811) to head (232ca6c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2122      +/-   ##
==========================================
- Coverage   97.44%   97.43%   -0.01%     
==========================================
  Files          93       93              
  Lines       10571    10583      +12     
  Branches     1003     1004       +1     
==========================================
+ Hits        10301    10312      +11     
- Misses        211      212       +1     
  Partials       59       59              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rniczh rniczh mentioned this pull request Oct 28, 2025
@paul0403 paul0403 self-requested a review October 28, 2025 21:12
@rniczh rniczh merged commit 38469e4 into main Nov 5, 2025
38 checks passed
@rniczh rniczh deleted the rniczh/update-llvm-version-20251009 branch November 5, 2025 14:39
@rniczh rniczh mentioned this pull request Nov 5, 2025
rniczh added a commit that referenced this pull request Nov 5, 2025
**Context:**

Latest LLVM update #2122
requires `nanobind>=2.9`


**Description of the Change:**

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**
rniczh added a commit that referenced this pull request Nov 11, 2025
**Context:**

**Description of the Change:**


Add missing llvm update change log for
#2122

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**

[sc-100911]
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.

4 participants