[Mlir-commits] [mlir] [mlir][Transforms] Dialect Conversion: Fix folder implementation (PR #150775)

Tom Natan llvmlistbot at llvm.org
Fri Aug 8 02:56:04 PDT 2025


tomnatan30 wrote:

Thanks for the quick response!

The race is a read of `MLIRContext *getContext() { return location->getContext(); }` vs a write in `void setLoc(Location loc) { location = loc; }`. It could be the case, for instance, that the new location being written has a pointer to the same context. In which case there is a true race on location, but there's no observable difference.

> Accessing the parent op (ModuleOp) in a pass that operates on a nested op (function, etc.)
This definitely makes sense, but we are accessing it in the verify method of an op, not in the pass directly. 

> And does the verifier run during the dialect conversion? 
I'm not sure about this TBH, the pass is [here](https://github.com/openxla/xla/blob/main/xla/mlir_hlo/mhlo/transforms/chlo_legalize_to_hlo/chlo_legalize_to_hlo_pass.cc)

Using `SymbolUserOpInterface` does solve the problem, and might actually be more efficient. See PR: https://github.com/openxla/shardy/pull/659

However, as I mentioned above, we can't do this for verification of `TensorShardingAttr` as a discardable attr: see [SdyDialect::verifyOperationAttribute](https://github.com/openxla/shardy/blob/main/shardy/dialect/sdy/ir/verifiers.cc#L1552). Maybe that's fine as that is invoked differently to `OpTy::verify`?

https://github.com/llvm/llvm-project/pull/150775


More information about the Mlir-commits mailing list