[Mlir-commits] [mlir] [mlir] Clone attrs of unregistered dialect ops (PR #151847)

Boyana Norris llvmlistbot at llvm.org
Mon Aug 4 07:36:22 PDT 2025


brnorris03 wrote:

> I wonder if the fix shouldn't be instead:
> 
> ```
> diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
> index 06ec1c85fb4d..2d5381d43f86 100644
> --- a/mlir/lib/IR/MLIRContext.cpp
> +++ b/mlir/lib/IR/MLIRContext.cpp
> @@ -884,6 +884,8 @@ int OperationName::UnregisteredOpModel::getOpPropertyByteSize() {
>  void OperationName::UnregisteredOpModel::initProperties(
>      OperationName opName, OpaqueProperties storage, OpaqueProperties init) {
>    new (storage.as<Attribute *>()) Attribute();
> +  if (init)
> +    *storage.as<Attribute *>() = *init.as<Attribute *>();
>  }
>  void OperationName::UnregisteredOpModel::deleteProperties(
>      OpaqueProperties prop) {
> ```

Thank you! Yes, that is a much better fix (which I couldn't quite figure out when I tried to fix op creation), assuming there is no reason to keep unregistered ops' properties opaque deliberately.

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


More information about the Mlir-commits mailing list