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

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 22:44:12 PST 2020


mehdi_amini added inline comments.
Herald added a reviewer: nicolasvasilache.


================
Comment at: mlir/include/mlir/IR/OpBase.td:1333
+def Broadcastable :
+  NativeOpTrait<"BroadcastableTwoOperandsOneResultWithSameElementType">;
+// Op supports operand broadcast behavior.
----------------
jpienaar wrote:
> 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
The Numpy link is using terminology like ` “broadcastable” to the same shape`. I'd still like an explicit name to avoid confusion and possible error by misuse: what about `ShapeBroadcastable`? 


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