Changelog
Source:NEWS.md
stablehlo (development version)
Features
Inference functions now refuse a dimension attribute that contains a missing value, instead of letting it surface as R’s
missing value where TRUE/FALSE needed.GatherDimensionNumbers()andScatterDimensionNumbers()check their dimension vectors the same way.infer_types_convolution()refuses apaddingthat takes away more than a spatial dimension holds. Such a shape made XLA’s own inference abort the process; negative padding that only empties a dimension stays legal. It also refuses a zero-sized kernel spatial dimension, which would otherwise infer a non-empty result from an empty window.Dimension attributes are checked before they are coerced, so a whole number outside the integer range (
3e9,Inf) is reported as the value the caller passed instead of theNAas.integer()made of it. Affectshlo_convolution(),hlo_broadcast_in_dim(),hlo_dynamic_slice()andhlo_empty().CustomOpBackendConfig()now acceptsConstantAttritems, so a custom call can carry array-valued attributes (what an XLA FFI handler decodes asSpan<const T>) and not just scalars, booleans and strings.hlo_custom_call()gained anoutput_operand_aliasesargument, built with the newOutputOperandAlias(). XLA then hands the handler the same buffer for the aliased operand and result, which is what lets an in-place kernel avoid a copy.
Bug fixes
-
hlo_pad()refused negative edge padding whose magnitude exceededrank(operand)rather than the size of the dimension it applied to, sopad(tensor<10xf32>, low = -5)was rejected although its result is atensor<5xf32>. Padding that genuinely empties a dimension is still refused, now naming the arguments involved. -
infer_types_concatenate()rejects inputs of different rank. Its (C2) check compared the shapes without the concatenation dimension, which a shorter shape passed, soconcatenate(tensor<2x3x4>, tensor<2x3>, dimension = 2)inferred a result with an unknown size along that dimension. -
infer_types_if()rejects a branch that declares inputs. -
infer_types_while()checks itsbody’s inputs and not only its outputs. - The short assembly form (
%0 = stablehlo.<op> %a : <type>) is emitted only for ops that actually allow it. -
hlo_triangular_solve()now rejects operands that are not of floating-point type, as required by the StableHLO spec. -
infer_types_slice()rejects a stride of0. The spec’s (C4) is0 < strides, but the check read0 <= strides. -
infer_types_dynamic_slice(),infer_types_dynamic_update_slice()andinfer_types_gather()rejectstart_indicesthat are not of integer type, as the spec requires. A float one used to reach MLIR and come back as a raw parse error. - Corrected some checks in the inference functions.
- Added some missing checks in the inference functions.
-
infer_types_reduce(),infer_types_reduce_window(),infer_types_scatter()andinfer_types_sort()check their region’s arguments. Only the region’s outputs were read, so a body with the wrong arity, a non-scalar argument, or the wrong element type passed inference – a one-argumentsortcomparator returning anf32was accepted and rendered. -
infer_types_reduce()accepts a body that accumulates into a wider element type. (C6) isis_promotable(element_type(inputs[i]), Ei), not an equality, so summing ani8into ani32is legal; it used to be refused.
stablehlo 0.4.0
Features
- Added
hlo_convolution() -
hlo_dot_general()gained aprecision_configargument, which is eitherNULLor one or two of"DEFAULT","HIGH"and"HIGHEST".
Breaking changes
- Adopted tengen’s enum-style
DataType. TheBooleanType(),FloatType(),IntegerType()andUIntegerType()constructors were removed, usedtype()/as_dtype()instead. - The package now requires R >= 4.4.0.
Performance
- The package was optimized w.r.t. runtime performance. This was achieved by reducing the number of classes that are used internally when creating
Funcs. Thehlo_<*>user API remains unaffected. - The
hlo_*builders of common ops gained anoutput_typesargument. When the output types are known ahead of time (e.g. from a lowering that ran type inference at trace time), passing them skips redundant inference and its input validation.
Bug fixes
- emit width-correct hex for f64 NaN/Inf constants
-
hlo_reduce_window()now validates the shape ofpaddingagainst its declared type instead of its R representation.
stablehlo 0.3.0
Features
- Added support for CHLO ops, a higher-level companion dialect to stableHLO that is lowered to stableHLO during compilation. New ops:
- Inverse trig:
hlo_acos(),hlo_asin(),hlo_atan(). - Hyperbolic:
hlo_cosh(),hlo_sinh(),hlo_acosh(),hlo_asinh(),hlo_atanh(). - Gamma family:
hlo_lgamma(),hlo_digamma(),hlo_polygamma(). - Error / Bessel / misc:
hlo_erf(),hlo_erfc(),hlo_erf_inv(),hlo_bessel_i1e(),hlo_square(). - Float predicates:
hlo_is_inf(),hlo_is_pos_inf(),hlo_is_neg_inf(). - Selection:
hlo_top_k()returning the top-k values and their indices along the last dimension.
- Inverse trig:
-
OpName()andnew_Op()gain adialectargument (default"stablehlo") to support ops from other MLIR dialects.
Bug fixes
-
hlo_reduce_window()now works on rank-1 inputs.