From 4b7077d5354ef9a4f9726d0dbc9a89545a44d10a Mon Sep 17 00:00:00 2001 From: mofeing <15837247+mofeing@users.noreply.github.com> Date: Mon, 30 Dec 2024 00:14:27 +0000 Subject: [PATCH] Regenerate MLIR Bindings --- src/mlir/Dialects/Enzyme.jl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/mlir/Dialects/Enzyme.jl b/src/mlir/Dialects/Enzyme.jl index 9ebd8211b9..f922304da3 100755 --- a/src/mlir/Dialects/Enzyme.jl +++ b/src/mlir/Dialects/Enzyme.jl @@ -92,6 +92,33 @@ function batch( ) end +""" +`broadcast` + +Broadcast the operand by adding extra dimensions with sizes provided by the `shape` attribute to the front. +For scalar operands, ranked tensor is created. + +NOTE: Only works for scalar and *ranked* tensor operands for now. +""" +function broadcast(input::Value; output::IR.Type, shape, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("shape", shape),] + + return create_operation( + "enzyme.broadcast", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + function fwddiff( inputs::Vector{Value}; outputs::Vector{IR.Type},