[Mlir-commits] [mlir] [MLIR][Python] Support `has_trait` for operations (PR #188492)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Mar 25 20:32:12 PDT 2026


================
@@ -651,6 +651,10 @@ MlirContext mlirOperationGetContext(MlirOperation op) {
   return wrap(unwrap(op)->getContext());
 }
 
+bool mlirOperationHasTrait(MlirOperation op, MlirTypeID traitTypeID) {
+  return unwrap(op)->getName().hasTrait(unwrap(traitTypeID));
----------------
PragmaTwice wrote:

I'm good to have `OperationName` bind because sometimes we can avoid to pass a context then. `OperationName` itself isn't bound to a context, but now we need a MLIR context to lookup an `OperationName` via the name string.

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


More information about the Mlir-commits mailing list