[PATCH] D72559: [mlir] Add trait for staging update of broadcastable trait

Jacques Pienaar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 07:54:29 PST 2020


jpienaar marked an inline comment as done.
jpienaar added inline comments.
Herald added a subscriber: liufengdb.


================
Comment at: mlir/include/mlir/IR/OpBase.td:1333
+def Broadcastable :
+  NativeOpTrait<"BroadcastableTwoOperandsOneResultWithSameElementType">;
+// Op supports operand broadcast behavior.
----------------
mehdi_amini wrote:
> To me `Broadcastable` implying element type seem fairly intuitive, have you looked into introducing a "BroadcastableDimensions" instead?
Broadcastable is only about shape* not element type: comparison operators have broadcasting behavior but boolean element type. Broadcastable should be the base and if we want to specialize it, it should get further constraints (e.g., BroadcastableWithSameElement is specialization of Broadcastable and clear from the name) rather than have specializations be more generic (e.g., BroadcastableDimensions is not Broadcastable).

* https://docs.scipy.org/doc/numpy/reference/ufuncs.html#broadcasting


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72559/new/

https://reviews.llvm.org/D72559





More information about the llvm-commits mailing list