ReductionOperationsConverter

Converter for reduction operations (sum, mean, variance).

Emits real stablehlo.reduce ops (pretty-printed short form), not stablehlo.custom_call @reduce_*. The custom_call form is a non-standard target that iree-compile rejects; this was the first compile error on the Whisper encoder MLIR. mean and variance are decomposed into reduce

  • arithmetic since StableHLO only has a single stablehlo.reduce primitive with a body.

Reduced shape semantics match VoidTensorOps.calculateReductionShape: the reduced dimension is removed from the output (no keepdim). If dim is null the result is a scalar (tensor).

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val supportedOperations: Set<String>

Set of operation names this converter supports

Functions

Link copied to clipboard
open override fun convert(node: GraphNode, operands: List<String>, context: ConversionContext): ConversionResult

Convert a graph node to StableHLO operations