[Mlir-commits] [mlir] [MLIR][Python] Support `has_trait` for operations (PR #188492)
Rolf Morel
llvmlistbot at llvm.org
Wed Mar 25 12:47:01 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));
----------------
rolfmorel wrote:
I think from this we can tell that determining whether an op _kind_ has a trait does not require an instance of the op. Namely we just need a way to get the `OperationName` and ask it `hasTrait`.
I know we haven't nano-bound `OperationName` yet, so it's a bit of a hassle. (We have come up against that before though, so maybe it's time.)
https://github.com/llvm/llvm-project/pull/188492
More information about the Mlir-commits
mailing list