HBIR Operator Definition

hbir.abs (::mlir::hbdk::hbir::AbsOp)

HBIR tensor abs.

Return tensor after the operation, which has the same shape as the input. Traits: CommonVerifier, EltwiseLike, SameOperandsAndResultShape

Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

Effects: MemoryEffects::Effect

Operands:

OperandDescription
inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

Results:

ResultDescription
outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

Constraint:

J5 BPU

Features and AttributesConstraints
input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.add (::mlir::hbdk::hbir::AddOp)

    HBIR tensor addition.

    Applies addition operator element-wise, yi=lhsi+rhsiy_i=lhs_i+rhs_i.


    Note:

    • Our arithmetic operator support broadcast.

    Prototype: Pytorch add.

    Traits: Broadcastable, CommonVerifier, EltwiseLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16, int32, if type is int32, this hbir.add op must be fusible to a Conv op
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16, int32, if type is int32, this hbir.add op must be fusible to a Conv op
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • hbir.asin (::mlir::hbdk::hbir::AsinOp)

    HBIR tensor asin.

    Return tensor after the operation, which has the same shape as the input. Traits: CommonVerifier, LutLike, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.atan (::mlir::hbdk::hbir::AtanOp)

    HBIR tensor atan.

    Return tensor after the operation, which has the same shape as the input. Traits: CommonVerifier, LutLike, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.avg_pool2d (::mlir::hbdk::hbir::AvgPool2dOp)

    HBIR 2-D average pooling.

    Applies a 2D average pooling over input.

    In the simplest case, the output value of the operator with input size (N,H,W,C)(N, H, W, C), output (N,Hout,Wout,C)(N, H_{out}, W_{out}, C) and kernel size (kerh,kerw)(ker_{h}, ker_{w}) can be precisely described as:

    out(Ni,h,w,Cj)=1kerhkerwm=0kerh1n=0kerw1input(Ni,stride[0]×h+m,stride[1]×w+n,Cj)out(N_i, h, w, C_j) = \frac{1} { ker_h *ker_w } \sum_{m = 0} ^ { ker_h - 1 }\sum_{n = 0} ^ { ker_w - 1 } input(N_i, stride[0]\times h + m, stride[1] \times w + n, C_j)

    where h,wh,w respectively represent the size of H and W.


    Note:

    • parameters has the same manner as the Conv2D operator, the same goes for the output size.

    • ceilMode controls output's compute is mode of floor or ceil, it's default value is false.


    Shape:

    • Input: (N,Hin,Win,C)(N, H_{in}, W_{in}, C) or (Hin,Win,C)(H_{in}, W_{in}, C) or (,Hin,Win)(*, H_{in}, W_{in})

    • Output: (N,Hout,Wout,C)(N, H_{out}, W_{out}, C) or (Hout,Wout,C)(H_{out}, W_{out}, C) or (,Hout,Wout,C)(*, H_{out}, W_{out}, C), where * represents any number of dimension.

    Hout=Hin+padding[0]+padding[2]kernel[0]stride[0]+1H_{out} = \lfloor {\frac{H_{in} + padding[0] + padding[2] - kernel[0]} {stride[0]} + 1}\rfloor

    Wout=Win+padding[1]+padding[3]kernel[1]stride[1]+1W_{out} = \lfloor {\frac{W_{in} + padding[1] + padding[3] - kernel[1]} {stride[1]} + 1}\rfloor

    if ceilMode = true, please use ceil replace floor in the above output formula.


    Prototype: Pytorch avg_pool2d.

    Traits: CommonVerifier, PoolLike, StencilLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    kernel::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    stride::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    pad::mlir::ArrayAttr64-bit integer array attribute with exactly 4 elements
    dilation::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    ceilMode::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*,H,W,C]
  • output
  • Same as input
  • kernel
  • Shape: [KH,KW]
  • Dim: KH, KW ∈ [1, 256]
  • stride
  • Shape: [SH,SW]
  • Dim: SH, SW ∈ [1, 256]
  • pad
  • Shape: [PN,PH,PW,PC]
  • PN,PH,PW,PC ∈ [-3, 256]
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*,H,W,C]
  • output
  • Same as input
  • kernel
  • Shape: [KH,KW]
  • Dim: KH, KW ∈ [1, 256]
  • stride
  • Shape: [SH,SW]
  • Dim: SH, SW ∈ [1, 256]
  • pad
  • Shape: [PN,PH,PW,PC]
  • PN,PH,PW,PC ∈ [-3, 256]
  • hbir.batchnorm (::mlir::hbdk::hbir::BatchNormOp)

    Hbir Batch Normalize

    Applies Batch Normalization over each dimension of input. This compute can be precisely described as:

    y=xmean[x]Var[x]+ϵweight+biasy = \frac{x-mean[x]}{\sqrt{Var[x]+\epsilon}}*weight+bias

    This mean and standard-deviation are calculated per-dimension over the batches and weight and bias are learnable parameter vectors of the input size.


    Note:

    • eps - a value added to the denominator for numerical stability.
    • mean(x)mean(x) and Var[x]Var[x]'s shape are (C)(C).
    • weight and bias are learnable scalar.

    Shape:

    • Input: (N,H,W,C)(N,H,W,C) or (N,M,H,W,C)(N,M,H,W,C) or (H,W,C)(H,W,C) or (,H,W,C)(*,H,W,C), where * reprensent any number of dimension.
    • Output: same shape as input.

    Prototype: Pytorch BatchNorm.

    Traits: CommonVerifier, Misc, SameVariadicOperandSize

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    eps::mlir::FloatAttr64-bit float attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values
    mean1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values
    var1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values
    weight1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values
    bias1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*,H,W,C]
  • mean
  • Type: f32
  • Shape: [C]
  • var
  • Type: f32
  • Shape: [C]
  • weight
  • Type: f32
  • Shape: [C]
  • bias
  • Type: f32
  • Shape: [C]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*,H,W,C]
  • mean
  • Type: f32
  • Shape: [C]
  • var
  • Type: f32
  • Shape: [C]
  • weight
  • Type: f32
  • Shape: [C]
  • bias
  • Type: f32
  • Shape: [C]
  • output
  • Same as input
  • hbir.cast_type (::mlir::hbdk::hbir::CastTypeOp)

    elemental type cast operation

    Data are actually moved. Traits: CommonVerifier, Misc, NaiveRoiInfer, NaiveTiling, SameOperandsAndResultShape

    Interfaces: CastOpInterface, HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    forceSaturate::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16, bool8
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16, bool8
  • Shape: [*]
  • output
  • Same as input
  • hbir.clip (::mlir::hbdk::hbir::ClipOp)

    HBIR Clip Op.

    Clamps all elements in input into the range [min,max][min, max] .Assume min_value and max_value be min and max, respectively, this performs:

    yi=min(max(xi,min_valuei),max_valuei)y_i = min(max(x_i, min\_value_i), max\_value_i)


    Note:

    • min(min_value): lower-bound of the range to be clamped to
    • max(max_value): upper-bound of the range to be clamped to

    Shape:

    • Input: (*), where * means any number of dimensions.
    • Output: (*), same shape as the input.

    Prototype: Pytorch hardtanh.

    Traits: CommonVerifier, LutLike, NaiveRoiInfer, NaiveTiling, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    min::mlir::Attribute64-bit float attribute or 64-bit signless integer attribute
    max::mlir::Attribute64-bit float attribute or 64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.concat (::mlir::hbdk::hbir::ConcatOp)

    Concatenates tensors along one dimension

    Concatenates the given sequence of seq tensors in the given dimension. No elemental type conversion.


    Note:

    • dim - the dimension over which the tensors are concatenated.

    Prototype: Pytorch cat.

    Traits: CommonVerifier, MoveLike, NaiveTiling, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, Layout, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, PortAccess, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dim::mlir::IntegerAttr64-bit signless integer attribute

    Operands:

    OperandDescription
    inputsvariadic of tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    inputs
  • Arg Number: inputs number ∈ [1, 1024]
  • Dim: all dims < 131072
  • size < 2G
  • output
  • same as inputs
  • J6 BPU

    Features and AttributesConstraints
    inputs
  • Arg Number: inputs number ∈ [1, 1024]
  • Dim: all dims < 131072
  • size < 2G
  • output
  • same as inputs
  • hbir.constant (::mlir::hbdk::hbir::ConstantOp)

    HBIR constant generation op.

    Generate a constant with specified type and value Traits: CommonVerifier, Constant

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    values::mlir::ElementsAttrconstant vector/tensor attribute

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    None

    J6 BPU

    None

    hbir.conv2d (::mlir::hbdk::hbir::Conv2dOp)

    HBIR 2-D convolution.

    Applies a 2D convolution over an input signal composed of several input channels.

    In the simplest case, the output value of the layer with input size (N,Hin,Win,Cin)(N, H_{in}, W_{in}, C_{in}) and output (N,Hout,Wout,Cout)(N, H_{out}, W_{out}, C_{out}) can be precisely descibed as:

    out(Ni,Coutj)=bias(Coutj)+k=0Cin1weight(Coutj,k)input(Ni,k)out(N_i,C_{out_j}) = bias(C_{out_j}) + \sum_{k=0}^{C_{in} - 1}weight(C_{out_j},k) \star input(N_i,k)

    where \star is the valid 2D cross-correlation operation, NN is the batch size, CC denotes a number of channels, HH and WW are the size of pixels.


    Note:

    • stride controls the stride for the cross-correlation, an integer array with 2 elements, default value is (1,1).

    • padding controls the amount of padding applied to the input, an integer array with 4 elements, the padding sequences is (h_begin,w_begin,h_end,w_end), default value is (0,0,0,0).

    • dilation controls the spacing between kernel points, an integer array with 2 elements, default value is (0,0). It's harder to describe, but this link has a nice visualization of what dilation does.

    • groups controls the connections between inputs and outputs, an integer variable, default value is 1.

    • Weight: (Cout,KH,KW,Cin)(C_{out}, KH, KW, C_{in}), bias shape = CoutC_{out} where KW and KH represent kernel's height and width, respectively.


    Shape:

    • Input: (N,Hin,Win,Cin)(N,H_{in},W_{in},C_{in}) or (Hin,Win,Cin)(H_{in},W_{in},C_{in}) or (N,M,Hin,Win,Cin)(N,M,H_{in},W_{in},C_{in}) or (,Hin,Win,Cin)(*,H_{in},W_{in},C_{in}), where * represent any number of dimension.

    • Output: (N,Hout,Wout,Cout)(N,H_{out},W_{out},C_{out}) or (Hout,Wout,Cout)(H_{out},W{out},C_{out}) or (N,M,Hout,Wout,Cout)(N,M,H_{out},W_{out},C_{out}) or (,Hout,Wout,Cout)(*,H_{out},W_{out},C_{out})

    Hout=Hin+padding[0]+padding[2]dilation[0]×(kernel[0]1)1stride[0]+1H_{out}=\lfloor \frac{H_{in} + padding[0] + padding[2] - dilation[0]\times(kernel[0]-1)-1}{stride[0]}+1\rfloor Wout=Win+padding[1]+padding[3]dilation[1]×(kernel[1]1)1stride[1]+1W_{out}=\lfloor \frac{W_{in}+padding[1]+padding[3]-dilation[1]\times(kernel[1]-1)-1}{stride[1]}+1\rfloor


    Prototype: Pytorch convolution.

    Traits: CommonVerifier, ConvLike, StencilLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    stride::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    pad::mlir::ArrayAttr64-bit integer array attribute with exactly 4 elements
    dilation::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    groupNum::mlir::IntegerAttr64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    weight4D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    bias1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [*,H,W,C]
  • Dim: * ∈ [1, 4096]; H,W,C ∈ [1, 65536]
  • weight
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [N,KH,KW,C]
  • Dim: C ∈ [1, 8192]; KH,KW ∈ [1, 31]; N ∈ [1, 65536] if fout is the last layer of conv else [1, 8192]
  • Size: KH*KW*C ∈ [1, 65536]
  • bias
  • Type: f32
  • output
  • Type: int8, int16, int32
  • Other constraints: same as fin
  • stride
  • Shape: [SH,SW]
  • Dim: SH,SW ∈ [1, 256]; SH,SW ∈ 1 if dilation > 1
  • pad
  • Shape: [PN,PH,PW,PC]
  • Dim: PN,PH,PW,PC ∈ [-1, 256]
  • groupNum
  • fin.c is divisible by group number
  • dilation
  • Shape: [DH,DW]
  • Dim: DH,DW ∈ [1, 18]
  • others
  • Don't support even stride when conv is a depthwise conv
  • For each group, fin.c ∈ [1, 8192], KH*KW*fin.c ∈ [1, 65535], fin.c = C when group = 1
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [*,H,W,C]
  • Dim: * ∈ [1, 4096]; H,W,C ∈ [1, 65536]
  • weight
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [N,KH,KW,C]
  • Dim: C ∈ [1, 8192]; KH,KW ∈ [1, 31]; N ∈ [1, 65536] if fout is the last layer of conv else [1, 8192]
  • Size: KH*KW*C ∈ [1, 65536]
  • bias
  • Type: f32
  • output
  • Type: int8, int16, int32
  • Other constraints: same as fin
  • stride
  • Shape: [SH,SW]
  • Dim: SH,SW ∈ [1, 256]; SH,SW ∈ 1 if dilation > 1
  • pad
  • Shape: [PN,PH,PW,PC]
  • Dim: PN,PH,PW,PC ∈ [-1, 256]
  • groupNum
  • fin.c is divisible by group number
  • dilation
  • Shape: [DH,DW]
  • Dim: DH,DW ∈ [1, 18]
  • others
  • Don't support even stride when conv is a depthwise conv
  • For each group, fin.c ∈ [1, 8192], KH*KW*fin.c ∈ [1, 65535], fin.c = C when group = 1
  • hbir.conv2dtranspose (::mlir::hbdk::hbir::Conv2dTransposeOp)

    HBIR transposed conv2d op.

    Inverse operation of Conv2dTranspose in shape.


    Parameters:

    • input: the input tensor
    • weight: the deconvolution kernel
    • stride: same as conv2d's stride, [s_h, s_w]
    • pad: pad information for clipping output [h_top,w_left,h_bottom,w_right]
    • dilation: same as conv2d's dilation, [d_h, d_w]
    • group: same as conv2d's group

    Shape:

    • input: (,h,w,in_channel)(*, h, w, in\_channel)
    • weight: (in_channel,kh,kw,out_channel/group)(in\_channel, kh, kw, out\_channel / group)
    • output: (,ho,wo,out_channel)(*, ho, wo, out\_channel)
    • bias: out_channelout\_channel

    where:

    ho=(h1)stride[0](pad[0]+pad[2])+dilation[0](kh1)+1ho = (h - 1) * stride[0] - (pad[0] + pad[2]) + dilation[0] * (kh - 1) + 1 wo=(w1)stride[1](pad[1]+pad[3])+dilation[1](kw1)+1wo = (w - 1) * stride[1] - (pad[1] + pad[3]) + dilation[1] * (kw - 1) + 1

    Traits: CommonVerifier, ConvLike, StencilLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    stride::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    pad::mlir::ArrayAttr64-bit integer array attribute with exactly 4 elements
    dilation::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    groupNum::mlir::IntegerAttr64-bit signless integer attribute
    illegalWeight::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    weight4D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    bias1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [*,H,W,C]
  • Dim: * ∈ [1, 128]; H,W ∈ [1, 65536]; C ∈ [1, 2048]
  • weight
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [N,KH,KW,C]
  • Dim: N,C ∈ [1, 2048]; KH,KW ∈ [1, 14]
  • Size: KH*KW*C ∈ [1, 65536]
  • bias
  • Type: f32
  • output
  • Same as input, the type additionally supports int32
  • stride
  • Shape: [SH,SW]
  • Dim: SH,SW ∈ [1, 14]; SH < KH; SW < KW;
  • pad
  • Shape: [PN,PH,PW,PC]
  • Dim: PN,PH,PW,PC ∈ [0, 256]
  • dilation
  • Shape: [DH,DW]
  • Dim: DH,DW ∈ 1
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [*,H,W,C]
  • Dim: * ∈ [1, 128]; H,W ∈ [1, 65536]; C ∈ [1, 2048]
  • weight
  • Type: int8, int16; input and weight cannot both be int16
  • Shape: [N,KH,KW,C]
  • Dim: N,C ∈ [1, 2048]; KH,KW ∈ [1, 14]
  • Size: KH*KW*C ∈ [1, 65536]
  • bias
  • Type: f32
  • output
  • Same as input, the type additionally supports int32
  • stride
  • Shape: [SH,SW]
  • Dim: SH,SW ∈ [1, 14]; SH < KH; SW < KW;
  • pad
  • Shape: [PN,PH,PW,PC]
  • Dim: PN,PH,PW,PC ∈ [0, 256]
  • dilation
  • Shape: [DH,DW]
  • Dim: DH,DW ∈ 1
  • hbir.conv3d (::mlir::hbdk::hbir::Conv3dOp)

    HBIR 3-D convolution.

    Applies a 3D convolution over an input signal composed of several input planes.

    In the simplest case, the output value of the layer with input size (N,Cin,D,H,W)(N, C_{in}, D, H, W) and output (N,Cout,Dout,Hout,Wout)(N, C_{out}, D_{out}, H_{out}, W_{out}) can be precisely described as:

    out(Ni,Coutj)=bias(Coutj)+k=0Cin1weight(Coutj,k)input(Ni,k)out(N_i, C_{out_j}) = bias(C_{out_j}) + \sum_{k = 0}^{C_{in} - 1} weight(C_{out_j}, k) \star input(N_i, k)

    where \star is the valid 3D [cross-correlation] operation, NN is the batch size, CC denotes a number of channels, DD, HH and WW are the size of pixels.


    Note:

    • stride controls the stride for the cross-correlation, an integer array with 3 elements, default value is (1,1,1).

    • padding controls the amount of padding applied to the input, an integer array with 5 elements, the padding sequences is (d_begin,h_begin,w_begin,d_end,h_end,w_end), default value is (0,0,0,0,0,0).

    • dilation controls the spacing between kernel points, an integer array with 3 elements, default value is (0,0,0). It's harder to describe, but this link has a nice visualization of what dilation does.

    • groups controls the connections between inputs and outputs, an integer variable, default value is 1.

    • Weight: (Cout,KD,KH,KW,Cin)(C_{out}, KD, KH, KW, C_{in}), bias shape = CoutC_{out} where KW and KH represent kernel's height and width, respectively.


    Shape:

    • Input: (N,Din,Hin,Win,Cin)(N,D_{in},H_{in},W_{in},C_{in}) or (Din,Hin,Win,Cin)(D_{in},H_{in},W_{in},C_{in}) or (,Din,Hin,Win,Cin)(*,D_{in},H_{in},W_{in},C_{in}), where * represent any number of dimension.

    • Output: (N,Dout,Hout,Wout,Cout)(N,D_{out},H_{out},W_{out},C_{out}) or (Dout,Hout,Wout,Cout)(D_{out},H_{out},W{out},C_{out}) or (,Dout,Hout,Wout,Cout)(*,D_{out},H_{out},W_{out},C_{out}).

    Dout=Din+padding[0]+padding[3]dilation[0]×(kernel[0]1)1stride[0]+1D_{out}=\lfloor \frac{D_{in} + padding[0] + padding[3] - dilation[0]\times(kernel[0]-1)-1}{stride[0]}+1\rfloor

    Hout=Hin+padding[1]+padding[4]dilation[1]×(kernel[1]1)1stride[1]+1H_{out}=\lfloor \frac{H_{in} + padding[1] + padding[4] - dilation[1]\times(kernel[1]-1)-1}{stride[1]}+1\rfloor

    Wout=Win+padding[2]+padding[5]dilation[2]×(kernel[2]1)1stride[2]+1W_{out}=\lfloor \frac{W_{in} + padding[2] + padding[5] - dilation[2]\times(kernel[2]-1)-1}{stride[2]}+1\rfloor


    Prototype: Pytorch convolution.

    Traits: CommonVerifier, ConvLike, StencilLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    stride::mlir::ArrayAttr64-bit integer array attribute with exactly 3 elements
    pad::mlir::ArrayAttr64-bit integer array attribute with exactly 6 elements
    dilation::mlir::ArrayAttr64-bit integer array attribute with exactly 3 elements
    groupNum::mlir::IntegerAttr64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    weight5D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    bias1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8
  • Shape: [*,D,H,W,C]
  • Dim: * ∈ [1, 128]; D,H,W ∈ [1, 65536]; C ∈ [1, 4096];
  • rhs
  • Type: int8
  • Shape: [N,KD,KH,KW,C]
  • N ∈ [1, 65536]; KD,KH,KW ∈ [1, 9]; Dim: C ∈ [1, 4096];
  • Size: KD*KH*KW*C ∈ [1, 131072]
  • bias
  • Type: f32
  • output
  • The same as lhs
  • stride
  • Shape: [SD,SH,SW]
  • Dim: SD,SH,SW must be 1 or 2 and equal to each other.
  • pad
  • Shape: [PN,PD,PH,PW,PC]
  • Dim: PN,PD,PH,PW,PC ∈ [0, 256]
  • groupNum
  • fin.c is divisible by group number
  • dilation
  • Shape: [DD,DH,DW]
  • DD,DH,DW = 1 when group number more than 1
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8
  • Shape: [*,D,H,W,C]
  • Dim: * ∈ [1, 128]; D,H,W ∈ [1, 65536]; C ∈ [1, 4096];
  • rhs
  • Type: int8
  • Shape: [N,KD,KH,KW,C]
  • N ∈ [1, 65536]; KD,KH,KW ∈ [1, 9]; Dim: C ∈ [1, 4096];
  • Size: KD*KH*KW*C ∈ [1, 131072]
  • bias
  • Type: f32
  • output
  • The same as lhs
  • stride
  • Shape: [SD,SH,SW]
  • Dim: SD,SH,SW must be 1 or 2 and equal to each other.
  • pad
  • Shape: [PN,PD,PH,PW,PC]
  • Dim: PN,PD,PH,PW,PC ∈ [0, 256]
  • groupNum
  • fin.c is divisible by group number
  • dilation
  • Shape: [DD,DH,DW]
  • DD,DH,DW = 1 when group number more than 1
  • hbir.conv (::mlir::hbdk::hbir::ConvOp)

    HBIR convolution.

    Applies a convolution over an input signal composed of several input planes.

    rank in convolution is an integer greater than or equal to 1.

    In the simplest case, for 2D convolution, rank=2 the output value of the layer with input size (N,Hin,Win,Cin)(N, H_{in}, W_{in}, C_{in}) and output (N,Hout,Wout,Cout)(N, H_{out}, W_{out}, C_{out}) can be precisely descibed as:

    out(Ni,Coutj)=bias(Coutj)+k=0Cin1weight(Coutj,k)input(Ni,k)out(N_i,C_{out_j}) = bias(C_{out_j}) + \sum_{k=0}^{C_{in} - 1}weight(C_{out_j},k) \star input(N_i,k)

    where \star is the valid 2D cross-correlation operation, NN is the batch size, CC denotes a number of channels, HH and WW are the size of pixels.


    Note:

    • stride controls the stride for the cross-correlation, an integer array with rank elements, default value is (1,1,...).

    • padding controls the amount of padding applied to the input, an integer array with 2*rank elements, when rank=2, the padding sequences is (h_begin,w_begin,h_end,w_end), default value is (0,0,0,0), when n=3, the padding sequences is (d_begin,h_begin,w_begin,d_end,h_end,w_end), default value is (0,0,0,0,0,0).

    • dilation controls the spacing between kernel points, an integer array with rank elements, default value is (0,0,...). It's harder to describe, but this link has a nice visualization of what dilation does.

    • groups controls the connections between inputs and outputs, an integer variable, default value is 1.

    • Weight for 2D: (Cout,KH,KW,Cin)(C_{out}, KH, KW, C_{in}), bias shape = CoutC_{out} where KW and KH represent kernel's height and width, respectively.


    Shape for 2D:

    • Input: (N,Hin,Win,Cin)(N,H_{in},W_{in},C_{in}) or (Hin,Win,Cin)(H_{in},W_{in},C_{in}) or (N,M,Hin,Win,Cin)(N,M,H_{in},W_{in},C_{in}) or (,Hin,Win,Cin)(*,H_{in},W_{in},C_{in}), where * represent any number of dimension.

    • Output: (N,Hout,Wout,Cout)(N,H_{out},W_{out},C_{out}) or (Hout,Wout,Cout)(H_{out},W{out},C_{out}) or (N,M,Hout,Wout,Cout)(N,M,H_{out},W_{out},C_{out}) or (,Hout,Wout,Cout)(*,H_{out},W_{out},C_{out})

    Hout=Hin+padding[0]+padding[2]dilation[0]×(kernel[0]1)1stride[0]+1H_{out}=\lfloor \frac{H_{in} + padding[0] + padding[2] - dilation[0]\times(kernel[0]-1)-1}{stride[0]}+1\rfloor Wout=Win+padding[1]+padding[3]dilation[1]×(kernel[1]1)1stride[1]+1W_{out}=\lfloor \frac{W_{in}+padding[1]+padding[3]-dilation[1]\times(kernel[1]-1)-1}{stride[1]}+1\rfloor


    Prototype: Pytorch convolution.

    Traits: CommonVerifier, ConvLike, StencilLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    stride::mlir::ArrayAttr64-bit integer array attribute
    pad::mlir::ArrayAttr64-bit integer array attribute
    dilation::mlir::ArrayAttr64-bit integer array attribute
    groupNum::mlir::IntegerAttr64-bit signless integer attribute
    channelLast::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    weighttensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type
    bias1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Constraint:

    J5 BPU

    If weight's shape is [N,KD,KH,KW,C] look Conv3d's constraints, If weight's shape is [N,KH,KW,C], look Conv2d's constraints

    J6 BPU

    If weight's shape is [N,KD,KH,KW,C] look Conv3d's constraints, If weight's shape is [N,KH,KW,C], look Conv2d's constraints

    hbir.correlation (::mlir::hbdk::hbir::CorrelationOp)

    HBIR Correlation.

    Applies correlation to inputs. The correlation operator calculate the correlation of the regions of the regions of the two inputs.


    Note:

    • kernel controls correlation kernel size.
    • max_d is the max_displacement of patch2 relative to patch1.
    • stride1 is stride in lhs, it controls H and W in output.
    • stride2 is stride in rhs, it controls channels in output.
    • pad_size is the padding size.
    • is_multiply controls the operation type, true means multiplication, false means subtraction.

    Shape:

    • Input: lhs's shape is (,Hin,Win,Cin)(*,H_{in},W_{in},C_{in}), and rhs's shape should be same as lhs, where * represents any number of dimension.

    • Output: (,Hout,Wout,Cout)(*, H_{out}, W_{out}, C_{out}), * represents input batch size, HoutH_{out}, WoutW_{out} and CoutC_{out} are height, width and channel respectively.

    Hout=Hin+2pad2(max_d+k12)stride1H_{out} = \frac{H_{in} + 2pad - 2(max\_d + \frac{k - 1} {2})} {stride1}

    Wout=Win+2pad2(max_d+k12)s1W_{out} =\frac{W_{in} + 2pad - 2(max\_d +\frac{k - 1} {2})} {s1}

    Cout=(2max_dstride2+1)2C_{out} = (2 *\frac{max\_d} {stride2} + 1) ^ 2

    Traits: CommonVerifier, Misc, SameOperandsShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    kernel::mlir::IntegerAttr64-bit signless integer attribute
    max_d::mlir::IntegerAttr64-bit signless integer attribute
    stride1::mlir::IntegerAttr64-bit signless integer attribute
    stride2::mlir::IntegerAttr64-bit signless integer attribute
    pad::mlir::IntegerAttr64-bit signless integer attribute
    mode::mlir::hbdk::CorrelationModeAttrcorrelation mode

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8
  • Shape: [*,H,W,C]
  • Dim: * ∈ [1, 65535]; H,W ∈ [1, 65536]; C ∈ [1, 1024];
  • rhs
  • Same as lhs
  • kernel
  • The size of kernel must be odd
  • others
  • The H, W and C dim of the lhs and rhs of hbir.correlation must be the same
  • The inputH, inputW, kernel, max_d, stride1, stride2 and pad should satisfy : min(inputH, inputW) + (2 * pad) - (2 * (max_d / (stride2 * stride2))) - kernel + 1 >= stride1
  • output
  • Same as lhs
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8
  • Shape: [*,H,W,C]
  • Dim: * ∈ [1, 65535]; H,W ∈ [1, 65536]; C ∈ [1, 1024];
  • rhs
  • Same as lhs
  • kernel
  • The size of kernel must be odd
  • others
  • The H, W and C dim of the lhs and rhs of hbir.correlation must be the same
  • The inputH, inputW, kernel, max_d, stride1, stride2 and pad should satisfy : min(inputH, inputW) + (2 * pad) - (2 * (max_d / (stride2 * stride2))) - kernel + 1 >= stride1
  • output
  • Same as lhs
  • hbir.elu (::mlir::hbdk::hbir::ELUOp)

    HBIR ELU Op.

    Applies Elu funciton element - wise.Elu function defined as:

    Elu(x)=max(0,x)+alpha(exp(min(0,x))1)Elu(x) = max(0, x) + alpha * (exp(min(0, x)) - 1)


    Note:

    • alpha - Controls the value to which an ELU saturates for negative net inputs.

    Shape:

    • Input: (*), where * means any number of dimensions.
    • Output: (*), same shape as the input.

    Prototype: Pytorch elu.

    Traits: CommonVerifier, LutLike, NaiveRoiInfer, NaiveTiling, SameElementType, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    alpha::mlir::FloatAttr64-bit float attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.empty_like (::mlir::hbdk::hbir::EmptyLikeOp)

    Hbir sram allocation operation, but not initial the memory

    The hbir.empty_like operation allocates a region of sram on the BPU. It is similar to torch.empty_like op.

    Example:

    %0 = hbir.empty() : tensor<64x8xf32>

    Traits: CommonVerifier, Misc

    Interfaces: NoMemoryEffect (MemoryEffectOpInterface), SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dtype::mlir::TypeAttrany type attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    None

    J6 BPU

    No limits

    hbir.equal (::mlir::hbdk::hbir::EqualOp)

    HBIR tensor equal.

    Determines whether two tensors are equal element by element - wise, yi=(lhsi==rhsi)y_i = (lhs_i == rhs_i) . Traits: Broadcastable, CommonVerifier, EltwiseLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Results:

    ResultDescription
    outputtensor of values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Type: bool8
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Type: bool8
  • hbir.exp (::mlir::hbdk::hbir::ExpOp)

    HBIR tensor exp.

    Applies exponential operator element - wise, y=exy=e^{x}.


    Note:

    • Returns a new tensor with the exponential of the elements of the input tensor input.

    Traits: CommonVerifier, LutLike, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.fake_cast (::mlir::hbdk::hbir::FakeCastOp)

    fake elemental type cast operation

    Cast float32 input to specified dtype, and then cast back to float32. Traits: CommonVerifier, Misc, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dtype::mlir::TypeAttrany type attribute

    Operands:

    OperandDescription
    inputtensor of 32-bit float values or none type

    Results:

    ResultDescription
    outputtensor of 32-bit float values

    Constraint:

    J5 BPU

    Unsupported

    J6 BPU

    Unsupported

    hbir.flip (::mlir::hbdk::hbir::FlipOp)

    HBIR flip

    Reverse the order of the input tensor along given axis in dims.


    Parametes:

    • input: the input tensor.
    • dims: axis need to reverse.

    Shape:

    • input: ()(*), where * represents any dimension.
    • output: same as the input.

    Traits: CommonVerifier, MoveLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dims::mlir::ArrayAttr64-bit integer array attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    inputs
  • Type: int8
  • output
  • same as inputs
  • J6 BPU

    Features and AttributesConstraints
    inputs
  • Type: int8
  • output
  • same as inputs
  • hbir.gather (::mlir::hbdk::hbir::GatherOp)

    HBIR gather op for torch.gather.

    HBIR gather op for torch.gather. Traits: CommonVerifier, Misc

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dim::mlir::IntegerAttr64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type
    indicestensor of 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Unsupported

    J6 BPU

    Unsupported

    hbir.grid_sample (::mlir::hbdk::hbir::GridSampleOp)

    HBIR grid_sample.

    From the input and a flow-field grid, computes the output using input values and pixel locations from the grid.


    Shape:

    • input: input of shape (,Hin,Win,Cin)(*, H_{in}, W_{in}, C_{in}) , where * represent any number of dimension.
    • grid: flow - field of shape (,Hout,Wout,2)(*, H_{out}, W_{out}, 2)
    • output: (,Hout,Wout,Cin)(*, H_{out}, W_{out}, C_{in})

    Traits: CommonVerifier, Expansion, Round, SampleLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    mode::mlir::hbdk::InterpolationModeAttrinterpolation mode for all march
    expansionMode::mlir::hbdk::ExpansionModeAttrmode to expand input feature on H/W
    alignCorner::mlir::BoolAttrbool attribute
    padValue::mlir::Attribute64-bit float attribute or 64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values
    gridtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,H,W,C]
  • Dim: H,W ∈ [1, 1024]; H*W ≤ 720*1024; other dims ∈ [1, 65536]
  • grid
  • Type: int16
  • Shape: [*,H,W,2]
  • output
  • Same as input except Dim constraints
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,H,W,C]
  • Dim: H,W ∈ [1, 1024]; H*W ≤ 720*1024; other dims ∈ [1, 65536]
  • grid
  • Type: int16
  • Shape: [*,H,W,2]
  • output
  • Same as input except Dim constraints
  • hbir.leaky_relu (::mlir::hbdk::hbir::LeakyReLUOp)

    HBIR Leaky ReLU Op.

    Applies LeakyRelu funciton element - wise.LeakyRelu function defined as:

    LeakyRelu(x)=max(0,x)+slopemin(0,x)LeakyRelu(x) = max(0, x) + slope * min(0, x)


    Note:

    • slope - Controls the angle of the negative slope.

    Shape:

    • Input: (*), where * means any number of dimensions.
    • Output: (*), same shape as the input.

    Prototype: Pytorch leaky_relu.

    Traits: CommonVerifier, LutLike, NaiveRoiInfer, NaiveTiling, SameElementType, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    slop::mlir::FloatAttr64-bit float attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.linear (::mlir::hbdk::hbir::LinearOp)

    HBIR Linear.

    Applies a linear transformation to the incoming data: y=xWT+by = xW ^ T + b


    Note:

    • Weight's shape is (Cin,Cout)(C_{in},C_{out}).

    Shape:

    • Input: (,Cin)(*, C_{in}) where * represents any number of dimensions and CinC_{in} = in_features.
    • Output: (,Cout)(*, C_{out}) where all but the last dimension are the same shape as the input and CoutC_{out} = out_features.

    Prototype: pytorch linear.

    Traits: CommonVerifier, LinearLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values
    weight2D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values
    bias1D tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,C_in]
  • Dim: *, C_in ∈ [1, 65536]
  • weight
  • Type: int8
  • Shape: [C_out, C_in]
  • Dim: C_in,C_out ∈ [1, 8192]; C_in*C_out ∈ [1, 65536]
  • bias
  • Type: f32
  • output
  • Type: int8, int16, int32
  • Other constraints: same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,C_in]
  • Dim: *, C_in ∈ [1, 65536]
  • weight
  • Type: int8
  • Shape: [C_out, C_in]
  • Dim: C_in,C_out ∈ [1, 8192]; C_in*C_out ∈ [1, 65536]
  • bias
  • Type: f32
  • output
  • Type: int8, int16, int32
  • Other constraints: same as input
  • hbir.log (::mlir::hbdk::hbir::LogOp)

    HBIR tensor log.

    Applies natural logarithm operator element - wise, y=loge(x)y = \log_e{(x)}.


    Note:

    • Returns a new tensor with the natural logarithm of the elements of input.

    Traits: CommonVerifier, LutLike, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.logical_and (::mlir::hbdk::hbir::LogicalAndOp)

    HBIR tensor and.

    Applies 'logical and' operator element - wise, yi=lhsi&&rhsiy_i = lhs_i \&\& rhs_i. Traits: Broadcastable, CommonVerifier, EltwiseLike, SameOperandsElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 8-bit signed integer or 16-bit signed integer or or 16-bit float or values or none type
    rhstensor of 8-bit signed integer or 16-bit signed integer or or 16-bit float or values or none type

    Results:

    ResultDescription
    outputtensor of values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Type: bool8
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Type: bool8
  • hbir.logical_not (::mlir::hbdk::hbir::LogicalNotOp)

    HBIR tensor logical not, output bool.

    Traits: CommonVerifier, EltwiseLike, SameOperandsAndResultShape, SameOperandsElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 8-bit signed integer or 16-bit signed integer or 16-bit float or or values or none type

    Results:

    ResultDescription
    outputtensor of values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Type: bool8
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Type: bool8
  • hbir.matmul (::mlir::hbdk::hbir::MatMulOp)

    HBIR Matrix Multiplication.

    Applies matrix multiplication between two inputs: C=A×BC = A \times B, where ×\times means matrix multiplication.


    Note:

    • If both tensors are 1-dimensional, the dot product (scalar) is returned
    • If both arguments are 2-dimensional, the matrix-matrix product is returned
    • If the first argument is 1-dimensional and the second argument is 2-dimensional, the matrix-vector product is returned
    • If the first argument is 2-dimensional and the second argument is 1-dimensional, the matrix-vector product is returned
    • If both arguments are at least 1-dimensional and at least one argument is N-dimensional (where N > 2), then a batched matrix multiply is returned

    Shape:

    • lhs: (Bl,M,C)(B_{l}, M, C), where BlB_{l} represent any number of dimension.
    • rhs: (Br,C,N)(B_{r}, C, N), where BrB_{r} represent any number of dimension.
    • output: (Bo,M,N)(B_{o}, M, N), where BoB_{o} represent represent the result of broadcast between BlB_{l} and VrV_{r}.

    Prototype: Pytorch Matmul.

    Traits: CommonVerifier, MatmulLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16; lhs and rhs cannot both be int16
  • Shape: [*,M,C]
  • Dim: * ∈ [1, 4096], M,C ∈ [1, 8192]
  • rhs
  • Type: int8, int16; lhs and rhs cannot both be int16
  • Shape: [*,C,N]
  • Dim: * ∈ [1, 4096]; C,N ∈ [1, 8192]
  • output
  • Type: int8, int16, int32
  • Shape: [*,M,N]
  • Other constraints: same as lhs
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16; lhs and rhs cannot both be int16
  • Shape: [*,M,C]
  • Dim: * ∈ [1, 4096], M,C ∈ [1, 8192]
  • rhs
  • Type: int8, int16; lhs and rhs cannot both be int16
  • Shape: [*,C,N]
  • Dim: * ∈ [1, 4096]; C,N ∈ [1, 8192]
  • output
  • Type: int8, int16, int32
  • Shape: [*,M,N]
  • Other constraints: same as lhs
  • hbir.max (::mlir::hbdk::hbir::MaxOp)

    HBIR tensor max.

    Applies maximum operator element-wise, yi=max(lhsi,rhsi)y_i=max(lhs_i,rhs_i).


    Note:

    • Our arithmetic operator support broadcast.

    Traits: Broadcastable, CommonVerifier, EltwiseLike, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • hbir.max_pool2d (::mlir::hbdk::hbir::MaxPool2dOp)

    HBIR 2-D max pooling.

    Applies a 2D max Pooling over an input.

    In the simplest case, the output value of the operator with input size (N,H,W,C)(N, H, W, C), output (N,Hout,Wout,C)(N, H_{out}, W_{out}, C) and kernel size (kerh,kerw)(ker_{h}, ker_{w}) can be precisely described as:

    out(Ni,h,w,Cj)=1kerhkerwmaxm=0kerh1maxn=0kerw1input(Ni,stride[0]×h+m,stride[1]×w+n,Cj)out(N_i, h, w, C_j) = \frac{1} { ker_h *ker_w }\max_{m = 0} ^ { ker_h - 1 }\max_{n = 0} ^ { ker_w - 1 } input(N_i, stride[0] \times h + m, stride[1] \times w + n, C_j)

    where h,wh,w respectively represent the size of H and W.


    Note:

    • parameters has the same manner as the Conv2D operator, the same goes for the output size.
    • ceilMode controls output 's compute is mode of floor or ceil, it' s default value is false.

    Shape:

    • Input: (N,Hin,Win,C)(N, H_{in}, W_{in}, C) or (Hin,Win,C)(H_{in}, W_{in}, C) or (,Hin,Win)(*, H_{in}, W_{in})

    • Output: (N,Hout,Wout,C)(N, H_{out}, W_{out}, C) or (Hout,Wout,C)(H_{out}, W_{out}, C) or (,Hout,Wout,C)(*, H_{out}, W_{out}, C), where * represents any number of dimension.

    Hout=Hin+padding[0]+padding[2]kernel[0]stride[0]+1H_{out} = \lfloor {\frac{H_{in} + padding[0] + padding[2] - kernel[0]} {stride[0]} + 1}\rfloor

    Wout=Win+padding[1]+padding[3]kernel[1]stride[1]+1W_{out} = \lfloor {\frac{W_{in} + padding[1] + padding[3] - kernel[1]} {stride[1]} + 1}\rfloor

    if ceilMode = true, please use ceil replace floor in the above ouput formula.


    Prototype: Pytorch max_pool2d.

    Traits: CommonVerifier, PoolLike, StencilLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    kernel::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    stride::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    pad::mlir::ArrayAttr64-bit integer array attribute with exactly 4 elements
    dilation::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    ceilMode::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*,H,W,C]
  • output
  • Same as input
  • kernel
  • Shape: [KH,KW]
  • Dim: KH, KW ∈ [1, 256]
  • stride
  • Shape: [SH,SW]
  • Dim: SH, SW ∈ [1, 256]
  • pad
  • Shape: [PN,PH,PW,PC]
  • PN,PH,PW,PC ∈ [-3, 256]
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*,H,W,C]
  • output
  • Same as input
  • kernel
  • Shape: [KH,KW]
  • Dim: KH, KW ∈ [1, 256]
  • stride
  • Shape: [SH,SW]
  • Dim: SH, SW ∈ [1, 256]
  • pad
  • Shape: [PN,PH,PW,PC]
  • PN,PH,PW,PC ∈ [-3, 256]
  • hbir.min (::mlir::hbdk::hbir::MinOp)

    HBIR tensor min.

    Applies minimum operator element-wise, yi=min(lhsi,rhsi)y_i=min(lhs_i,rhs_i).


    Note:

    • Our arithmetic operator support broadcast.

    Traits: Broadcastable, CommonVerifier, EltwiseLike, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • hbir.mul (::mlir::hbdk::hbir::MulOp)

    HBIR tensor multiplication.

    Applies multiplication operator element-wise, yi=lhsi×rhsiy_i=lhs_i\times rhs_i.


    Note:

    • Our arithmetic operator support broadcast.

    Prototype: Pytorch mul.

    Traits: Broadcastable, CommonVerifier, EltwiseLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • hbir.pad (::mlir::hbdk::hbir::PadOp)

    Pad at both edges of Tensor.

    Padding at the begin and end position with constant / border value. Traits: CommonVerifier, Expansion, Foldable, MoveLike, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, Layout, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    begin::mlir::ArrayAttr64-bit integer array attribute
    end::mlir::ArrayAttr64-bit integer array attribute
    expansionMode::mlir::hbdk::ExpansionModeAttrmode to expand input feature on H/W
    padValue::mlir::Attribute64-bit float attribute or 64-bit signless integer attribute
    foldable::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int64, uint64 and f64 are not supported when expansionMode is 'constant' else no constraints
  • Dim: all dims < 737280 when expansionMode is not 'constant' else no constraints
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int64, uint64 and f64 are not supported when expansionMode is 'constant' else no constraints
  • Dim: all dims < 737280 when expansionMode is not 'constant' else no constraints
  • output
  • Same as input
  • hbir.point_pillar_preprocess (::mlir::hbdk::hbir::PointPillarPreProcessOp)

    HBIR point pillar preprocess op.

    HBIR point pillar preprocess.Voxelization and Normalization Traits: CommonVerifier, Misc

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    pcRanges::mlir::ArrayAttr64-bit float array attribute
    normRanges::mlir::ArrayAttr64-bit float array attribute
    voxelSizes::mlir::ArrayAttr64-bit float array attribute
    maxVoxelNum::mlir::IntegerAttr64-bit signless integer attribute
    maxPointsPerVoxel::mlir::IntegerAttr64-bit signless integer attribute
    normDims::mlir::ArrayAttr64-bit integer array attribute

    Operands:

    OperandDescription
    pointstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Results:

    ResultDescription
    voxelstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values
    coordstensor of 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer values

    Constraint:

    J5 BPU

    Unsupported

    J6 BPU

    Unsupported

    hbir.point_pillar_scatter (::mlir::hbdk::hbir::PointPillarScatterOp)

    HBIR point pillar scatter op.

    HBIR point pillar scatter. Traits: CommonVerifier, Misc

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    outShape::mlir::ArrayAttr64-bit integer array attribute with exactly 4 elements

    Operands:

    OperandDescription
    voxelstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values
    coordstensor of 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Unsupported

    J6 BPU

    Unsupported

    hbir.relu (::mlir::hbdk::hbir::ReLUOp)

    HBIR ReLU activation.

    Applies the rectified linear unit function element - wise.Relu function is defined as:

    ReLU(x)=(x)+=max(0,x)ReLU(x) = (x) ^ + = max(0, x)


    Shape:

    • Input(*), where * means any number of dimensions.
    • Output(*), same shapes as the input.

    Prototype: Pytorch Relu.

    Traits: CommonVerifier, LutLike, NaiveRoiInfer, NaiveTiling, SameElementType, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16, int32
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16, int32
  • Shape: [*]
  • output
  • Same as input
  • hbir.reciprocal (::mlir::hbdk::hbir::ReciprocalOp)

    HBIR tensor reciprocal.

    Applies reciprocal operator element - wise, y=1xy = \frac{1}{x}.


    Note:

    • Returns a new tensor with the reciprocal of the elements of input.

    Traits: CommonVerifier, EltwiseLike, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.reduce_argmax (::mlir::hbdk::hbir::ReduceArgmaxOp)

    Calculate max on multiple axes and return its index.

    Return the indices of the max elements of the input tensor's element along the provided axis.


    Parameters:

    • input: the input tensor.
    • dims: dimension to perform reduce argmax on. Accepted range is [-r, r - 1] where r = rank(input).
    • keepDim: keep the reduced dimensions or not. Default true means keep reduced dimensions.

    Shape:

    • input: ()(*), where * represents any dimension.
    • output: if keepDim is True, same as input. Otherwise, all reduced dims will be discarded (e.g. if input is of shape 1x2x3x4 and dims=[1], the output shape will be 1x3x4).

    Prototype: ONNX ReduceArgMax.

    Traits: CommonVerifier, ReduceLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dims::mlir::ArrayAttr64-bit integer array attribute
    keepDim::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input, but output can be of type int32 or int64, as long as the size of the reduced axis can be represented using an int16 number
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input, but output can be of type int32 or int64, as long as the size of the reduced axis can be represented using an int16 number
  • hbir.reduce_max (::mlir::hbdk::hbir::ReduceMaxOp)

    Calculate max on multiple axes.

    Return the max value of all elements in the provided axes of the input tensor.


    Parameters:

    • input: the input tensor.
    • dims: dimensions to perform reduce max on. If it's a list, reduce over all of them. Accepted range is [-r, r - 1] where r = rank(input).
    • keepDim: keep the reduced dimensions or not. Default true means keep reduced dimensions.

    Shape:

    • input: ()(*), where * represents any dimension.
    • output: if keepDim is True, same as input. Otherwise, all reduced dims will be discarded (e.g. if input is of shape 1x2x3x4 and dims=[1, 2], the output shape will be 1x4).

    Prototype: ONNX ReduceMax.

    Traits: CommonVerifier, ReduceLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dims::mlir::ArrayAttr64-bit integer array attribute
    keepDim::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.reduce_mean (::mlir::hbdk::hbir::ReduceMeanOp)

    Calculate mean on multiple axes.

    Return the mean of all elements in the provided axes of the input tensor.


    Parameters:

    • input: the input tensor.
    • dims: dimensions to perform reduce mean on. If it's a list, reduce over all of them. Accepted range is [-r, r - 1] where r = rank(input).
    • keepDim: keep the reduced dimensions or not. Default true means keep reduced dimensions.

    Shape:

    • input: ()(*), where * represents any dimension.
    • output: if keepDim is True, same as input. Otherwise, all reduced dims will be discarded (e.g. if input is of shape 1x2x3x4 and dims=[1, 2], the output shape will be 1x4).

    Prototype: ONNX ReduceMean.

    Traits: CommonVerifier, ReduceLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dims::mlir::ArrayAttr64-bit integer array attribute
    keepDim::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • Dim: reduce axis dim size ∈ [1, 16384]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • Dim: reduce axis dim size ∈ [1, 16384]
  • output
  • Same as input
  • hbir.reduce_min (::mlir::hbdk::hbir::ReduceMinOp)

    Calculate min on multiple axes.

    Return the min value of all elements in the provided axes of the input tensor.


    Parameters:

    • input: the input tensor.
    • dims: dimensions to perform reduce min on. If it's a list, reduce over all of them. Accepted range is [-r, r - 1] where r = rank(input).
    • keepDim: keep the reduced dimensions or not. Default true means keep reduced dimensions.

    Shape:

    • input: ()(*), where * represents any dimension.
    • output: if keepDim is True, same as input. Otherwise, all reduced dims will be discarded (e.g. if input is of shape 1x2x3x4 and dims=[1, 2], the output shape will be 1x4).

    Prototype: ONNX ReduceMin

    Traits: CommonVerifier, ReduceLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dims::mlir::ArrayAttr64-bit integer array attribute
    keepDim::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.reduce_sum (::mlir::hbdk::hbir::ReduceSumOp)

    Calculate sum on multiple axes.

    Return the sum of all elements in the provided axes of the input tensor.


    Parameters:

    • input: the input tensor.
    • dims: dimensions to perform reduce sum on. If it's a list, reduce over all of them. Accepted range is [-r, r - 1] where r = rank(input).
    • keepDim: keep the reduced dimensions or not. Default true means keep reduced dimensions.

    Shape:

    • input: ()(*), where * represents any dimension.
    • output: if keepDim is True, same as input. Otherwise, all reduced dims will be discarded (e.g. if input is of shape 1x2x3x4 and dims=[1, 2], the output shape will be 1x4).

    Prototype: ONNX ReduceSum.

    Traits: CommonVerifier, ReduceLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dims::mlir::ArrayAttr64-bit integer array attribute
    keepDim::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • Dim: reduce axis dim size ∈ [1, 16384]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • Dim: reduce axis dim size ∈ [1, 16384]
  • output
  • Same as input
  • hbir.reshape (::mlir::hbdk::hbir::ReshapeOp)

    View a tensor as another shape

    Returns a tensor with the same data and number of elements as input, but with the specified shape.When possible, the returned tensor will be a view of input.


    Note:

    • shape - the new shape.

    Prototype: Pytorch reshape.

    Traits: CommonVerifier, Foldable, MoveLike, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, Layout, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    shape::mlir::ArrayAttr64-bit integer array attribute
    foldable::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • J6 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • hbir.resize2d (::mlir::hbdk::hbir::Resize2dOp)

    HBIR 2-D resizing.

    Scale the input proportionally.


    Note:

    • ratio controls zoom size.*mode controls interpolation type, it's default value is nearest.

    Shape:

    • Input: (,Hin,Win,C)(*, H_{in}, W_{in}, C)
    • Output: (,Hout,Wout,C)(*, H_{out}, W_{out}, C), where

    Hout=HinratioH_{out} = \lfloor{H_{in} * ratio}\rfloor

    Wout=WinratioW_{out} = \lfloor{W_{in} * ratio}\rfloor


    Prototype: Pytorch upsample_nearest2d.

    Traits: CommonVerifier, Expansion, Round, SampleLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    ratio::mlir::ArrayAttr64-bit float array attribute with exactly 2 elements
    size::mlir::ArrayAttr64-bit integer array attribute with exactly 2 elements
    step::mlir::ArrayAttr64-bit float array attribute with exactly 2 elements
    initialOffset::mlir::ArrayAttr64-bit float array attribute with exactly 2 elements
    mode::mlir::hbdk::InterpolationModeAttrinterpolation mode for all march
    expansionMode::mlir::hbdk::ExpansionModeAttrmode to expand input feature on H/W
    padValue::mlir::Attribute64-bit float attribute or 64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,H,W,C]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,H,W,C]
  • output
  • Same as input
  • hbir.roll (::mlir::hbdk::hbir::RollOp)

    Roll the tensor along the given dimensions

    Roll the tensor along the given dimension.Elements that are shifted beyond the last position are re-introduced at the first position.


    Note:

    • shifts - The number of places by which the elements of the tensor are shifted.
    • dims -Axis along which to roll.

    Prototype: Pytorch roll.

    Traits: CommonVerifier, MoveLike, SameElementType, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    shifts::mlir::ArrayAttr64-bit integer array attribute
    dims::mlir::ArrayAttr64-bit integer array attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • J6 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • hbir.sigmoid (::mlir::hbdk::hbir::SigmoidOp)

    HBIR Sigmoid activation.

    Applies the element - wise function.Sigmoid function is defined as:

    Sigmoid(x)=11+exp(x)Sigmoid(x) = \frac{1} {1 + exp(-x)}


    Shape:

    • Input: (*), where * means any number of dimensions.
    • Output: (*), same shape as the input.

    Prototype: Pytorch sigmoid.

    Traits: CommonVerifier, LutLike, NaiveRoiInfer, NaiveTiling, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.slice (::mlir::hbdk::hbir::SliceOp)

    Slice a tensor out of a tensor

    Slicing like python's style means taking elements from one given index to another given index.


    Note:

    • begin -the index start to pick(inclusive).
    • end -the index end to pick(exclusive).
    • step -the step interval of picking.

    Prototype: Pytorch slice.

    Traits: CommonVerifier, Foldable, MoveLike, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, Layout, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    begin::mlir::ArrayAttr64-bit integer array attribute
    end::mlir::ArrayAttr64-bit integer array attribute
    step::mlir::ArrayAttr64-bit integer array attribute
    foldable::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Dim: all dims < 2097152
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Dim: all dims < 2097152
  • output
  • Same as input
  • hbir.softmax (::mlir::hbdk::hbir::SoftmaxOp)

    HBIR Softmax Op.

    Applies the Softmax function to an n - dimensional input Tensor rescaling them so that the elements of the n-dimensional output. Tensor lie in the range [0,1][0, 1] and sum to 1.

    Softmax function is defined as:

    Softmax(xi)=exp(xi)jexp(xj)Softmax(x_i) = \frac{exp(x_i)} {\sum_jexp(x_j)}


    Shape:

    • Input(*), where * means, any number of additional dimensions.Output(), same shape as the input.

    Prototype: Pytorch softmax.

    Traits: CommonVerifier, Misc, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dim::mlir::IntegerAttr64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Unsupported

    J6 BPU

    Unsupported

    hbir.softplus (::mlir::hbdk::hbir::SoftplusOp)

    HBIR Softplus Op.

    Applies the SoftPlus function element-wise. SoftPlus function defined as:

    SoftPlus(x)=1βlog(1+exp(βx))SoftPlus(x) = \frac{1}{\beta}*log(1+exp(\beta * x))

    SoftPlus is a smooth approximation to the ReLU function.


    Note:

    • beta - the β\beta value for the Softplus formulation.
    • max - values is for numerical stability, when βx>max,SoftPlus(x)=x\beta *x > max, SoftPlus(x)=x.

    Shape:

    • Input: (*), where * means any number of dimensions.
    • Output: (*), same shape as the input.

    Prototype: Pytorch softplus.

    Traits: CommonVerifier, LutLike, NaiveRoiInfer, NaiveTiling, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    beta::mlir::FloatAttr64-bit float attribute
    threshold::mlir::FloatAttr64-bit float attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.sort (::mlir::hbdk::hbir::SortOp)

    HBIR tensor sort

    Sorts the elements of the input tensor along a given dimension in ascending order by value.


    Parameters:

    • input: the input tensor.
    • dim: the dimension to sort along.
    • descending: controls the sorting order (ascending or descending).
    • stable: makes the sorting routine stable, which guarantees that the order of equivalent elements is preserved.

    Shape:

    • Input: (N,)(N, *)
    • Values: (N,)(N, *) (same shape as input)
    • Indices: (N,)(N, *) (same shape as input)

    Prototype: Pytorch sort.

    Traits: CommonVerifier, Misc

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dim::mlir::IntegerAttr64-bit signless integer attribute
    descending::mlir::BoolAttrbool attribute
    stable::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    valuestensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type
    indicestensor of 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer values or none type

    Constraint:

    J5 BPU

    Unsupported

    J6 BPU

    Unsupported

    hbir.sqrt (::mlir::hbdk::hbir::SqrtOp)

    HBIR tensor sqrt.

    Applies square root operator element - wise, y=xy = \sqrt{x}.


    Note:

    • Returns a new tensor with the square root of the elements of input. If input is negative, then it will return NaN.

    Traits: CommonVerifier, LutLike, SameOperandsAndResultShape

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8, int16
  • Shape: [*]
  • output
  • Same as input
  • hbir.sub (::mlir::hbdk::hbir::SubOp)

    HBIR tensor substraction.

    Applies substraction operator element-wise, yi=lhsirhsiy_i=lhs_i-rhs_i.


    Note:

    • Our arithmetic operator support broadcast.

    Traits: Broadcastable, CommonVerifier, EltwiseLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, MoveTransposeInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Operands:

    OperandDescription
    lhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type
    rhstensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • J6 BPU

    Features and AttributesConstraints
    lhs
  • Type: int8, int16
  • Shape: [*]
  • rhs
  • Same as lhs
  • output
  • Same as lhs
  • hbir.tile (::mlir::hbdk::hbir::TileOp)

    Constructs a tensor by tiling a given tensor.

    Traits: CommonVerifier, MoveLike, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    multiplies::mlir::ArrayAttr64-bit integer array attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values or none type

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • J6 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • hbir.topk (::mlir::hbdk::hbir::TopkOp)

    HBIR tensor topk

    Returns the k largest elements of the given input tensor along a given dimension.

    If dim is not given, the last dimension of the input is chosen.

    If largest is False then the k smallest elements are returned.

    values, indices are returned in separate tensors, where the indices are the indices of the elements in the original input tensor.

    The boolean option sorted if True, will make sure that the returned k elements are themselves sorted.

    Traits: CommonVerifier, Misc

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    k::mlir::IntegerAttr64-bit signless integer attribute
    dim::mlir::IntegerAttr64-bit signless integer attribute
    largest::mlir::BoolAttrbool attribute
    sorted::mlir::BoolAttrbool attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type

    Results:

    ResultDescription
    valuestensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values or none type
    indicestensor of 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer values or none type

    Constraint:

    J5 BPU

    Unsupported

    J6 BPU

    Unsupported

    hbir.transpose (::mlir::hbdk::hbir::TransposeOp)

    Reverse or permute the dims of an array; returns the modified array.

    Returns a tensor that is a view of the original tensor input with its dimesions permuted.


    Note:

    • input: the input tensor.
    • dims: the desired ordering of dimensions.

    Prototype: Pytorch permute.

    Traits: CommonVerifier, MoveLike, SameElementType

    Interfaces: HBTLExecutable, HbdkExecutorInterface, HbdkInferType, Layout, NoMemoryEffect (MemoryEffectOpInterface), NonBatchAxesInfer, Perf, Quantizable, RoiInfer, SchedInterface, SchedTemp, ShapeInference, Tiling

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    dims::mlir::ArrayAttr64-bit integer array attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • J6 BPU

    Features and AttributesConstraints
    inputs
  • no limits
  • output
  • same as inputs
  • hbir.triton_call (::mlir::hbdk::hbir::TritonCallOp)

    Triton kernel call for custom operator.

    The hbir.triton_call operation is similar to hbir.call op, but it is a zero-output operator and has side effect.

    Traits: CommonVerifier, Misc

    Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface), SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::SideEffects::DefaultResource, MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}

    Attributes:

    AttributeMLIR TypeDescription
    signature::mlir::StringAttrstring attribute
    inputIndices::mlir::ArrayAttrarray attribute
    outputIndices::mlir::ArrayAttrarray attribute
    inputOutputIndices::mlir::ArrayAttrarray attribute
    parameters::mlir::ArrayAttrarray attribute
    library::mlir::StringAttrstring attribute

    Operands:

    OperandDescription
    inputsvariadic of tensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    None

    J6 BPU

    Unsupported

    hbir.warp (::mlir::hbdk::hbir::WarpOp)

    HBIR warp.

    From the input, sample(bi - linear interpolation) pixels specified by grid.


    Shape:

    • input: input of shape (,Hin,Win,Cin)(*, H_{in}, W_{in}, C_{in}), where * represent any number of dimension.
    • grid: flow - field of shape (,Hout,Wout,2)(*, H_{out}, W_{out}, 2)
    • output: (,Hout,Wout,Cin)(*, H_{out}, W_{out}, C_{in})

    Traits: CommonVerifier, Expansion, Round, SampleLike

    Interfaces: HBTLExecutable, HbdkExecutorInterface, NoMemoryEffect (MemoryEffectOpInterface), Perf, Quantizable, SchedInterface, SchedTemp, ShapeInference

    Effects: MemoryEffects::Effect

    Attributes:

    AttributeMLIR TypeDescription
    mode::mlir::hbdk::InterpolationModeAttrinterpolation mode for all march
    expansionMode::mlir::hbdk::ExpansionModeAttrmode to expand input feature on H/W
    padValue::mlir::Attribute64-bit float attribute or 64-bit signless integer attribute

    Operands:

    OperandDescription
    inputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values
    movetensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or values

    Results:

    ResultDescription
    outputtensor of 64-bit float or 32-bit float or 16-bit float or bfloat16 type or 8-bit signed integer or 16-bit signed integer or 32-bit signed integer or 64-bit signed integer or 8-bit unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or or values

    Constraint:

    J5 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,H,W,C]
  • Dim: H,W ∈ [1, 1024]; H*W ≤ 720*1024; other dims ∈ [1, 65536]
  • grid
  • Type: int16
  • Shape: [*,H,W,2]
  • output
  • Same as input except Dim constraints
  • J6 BPU

    Features and AttributesConstraints
    input
  • Type: int8
  • Shape: [*,H,W,C]
  • Dim: H,W ∈ [1, 1024]; H*W ≤ 720*1024; other dims ∈ [1, 65536]
  • grid
  • Type: int16
  • Shape: [*,H,W,2]
  • output
  • Same as input except Dim constraints
  • On This Page