mlir.dialects.transform.tune

Classes

KnobOp

Provides a representation for "tunables" within schedules.

AlternativesOp

This op represents a choice over which of its regions is to be used.

Functions

knob(result, name, options, *[, selected, loc, ip])

alternatives(results, name, num_alternatives, *[, ...])

Module Contents

class mlir.dialects.transform.tune.KnobOp(result: mlir.ir.Type, name: mlir.ir.StringAttr | str, options: mlir.ir.ArrayAttr | Sequence[mlir.ir.Attribute | bool | int | float | str] | mlir.ir.Attribute, *, selected: mlir.ir.Attribute | bool | int | float | str | None = None, loc=None, ip=None)

Bases: KnobOp

Provides a representation for “tunables” within schedules.

Each op represents a single tunable, which has a name and a set of valid options described by an attribute. Without a specified selected option, this op represents a non-deterministic choice that has yet to be resolved – as such, the interpreter runtime semantics is to raise a failure.

The non-deterministic choice is resolved through providing a selected attribute. When provided, the interpreter runtime semantics are to return the selected attribute as a param through the op’s result.

In case the options attribute is an ArrayAttr, the verifier checks that the provided selected attribute occurs in options.

mlir.dialects.transform.tune.knob(result: mlir.ir.Type, name: mlir.ir.StringAttr | str, options: mlir.ir.ArrayAttr | Sequence[mlir.ir.Attribute | bool | int | float | str] | mlir.ir.Attribute, *, selected: mlir.ir.Attribute | bool | int | float | str | None = None, loc=None, ip=None)
class mlir.dialects.transform.tune.AlternativesOp(results: Sequence[mlir.ir.Type], name: mlir.ir.StringAttr | str, num_alternatives: int, *, selected_region: int | mlir.ir.IntegerAttr | mlir.ir.Value | mlir.ir.Operation | mlir.ir.OpView | None = None, loc=None, ip=None)

Bases: AlternativesOp

This op represents a choice over which of its regions is to be used.

When selected_region is provided, the semantics are that this op is to be substituted for by the selected region, meaning the region’s results become the results of this op. Without a provided selected_region, the semantics are that this non-deterministic choice is yet to be resolved – which in terms of the op’s interpreted semantics is a failure.

The selected_region argument is either an IntegerAttr or a param holding an IntegerAttr, which should provide a valid zero-based index with respect to the number of alternatives, i.e. regions.

mlir.dialects.transform.tune.alternatives(results: Sequence[mlir.ir.Type], name: mlir.ir.StringAttr | str, num_alternatives: int, *, selected_region: int | mlir.ir.IntegerAttr | mlir.ir.Value | mlir.ir.Operation | mlir.ir.OpView | None = None, loc=None, ip=None)