Transform Dialect in MLIR provides operations that can be used to control transformation of the Intermediate Representation (IR) using a different portion of the IR. It refers to the IR being transformed as payload IR, and to the IR guiding the transformation as transform IR. The main use case for this dialect is orchestrating fine-grain transformations on individual IR objects (operations or values) or sets thereof. For example, it may involve finding loop-like operations with specific properties (e.g., large size) in the payload IR, applying loop tiling to those and only those operations, and then applying loop unrolling to the inner loops produced by the previous transformations. As such, it is not intended as a replacement for the pass infrastructure, nor for the pattern rewriting infrastructure. In the most common case, the transform IR will be processed and applied to the payload IR by a pass. Transformations expressed by the Transform dialect may be implemented using the pattern infrastructure or any other relevant MLIR component. The rest of this document explains the main concepts and usage scenario of the MLIR Transform Dialect combined with structured operations.
翻译:MLIR中的转换方言提供了一系列操作,这些操作可利用中间表示(IR)的不同部分来控制其变换。该方言将待变换的IR称为载荷IR,将指导变换的IR称为变换IR。该方言的主要应用场景是针对单个IR对象(如操作或值)或其集合进行细粒度变换的编排。例如,它可能涉及在载荷IR中查找具有特定属性(如大尺寸)的类循环操作,仅对这些操作应用循环分块,然后对先前变换产生的内层循环应用循环展开。因此,它并非旨在替代通行基础设施或模式重写基础设施。在最常见的情况下,变换IR将由通行(pass)处理并应用于载荷IR。通过转换方言表达的变换可以使用模式基础设施或任何其他相关MLIR组件来实现。本文其余部分将结合结构化操作,阐释MLIR转换方言的主要概念与使用场景。