MLIR 22.0.0git
mlir::xegpu Namespace Reference

Namespaces

namespace  impl
namespace  uArch

Classes

struct  UnrollOptions
 Options to control the XeGPU unrolling. More...
struct  XeGPUPropagateLayoutOptions

Functions

void registerTransformDialectExtension (DialectRegistry &registry)
std::unique_ptr<::mlir::PasscreateXeGPUBlocking ()
std::unique_ptr<::mlir::PasscreateXeGPUFoldAliasOps ()
std::unique_ptr<::mlir::PasscreateXeGPUOptimizeBlockLoads ()
std::unique_ptr<::mlir::PasscreateXeGPUPropagateLayout ()
std::unique_ptr<::mlir::PasscreateXeGPUPropagateLayout (XeGPUPropagateLayoutOptions options)
std::unique_ptr<::mlir::PasscreateXeGPUSubgroupDistribute ()
std::unique_ptr<::mlir::PasscreateXeGPUVectorLinearize ()
std::unique_ptr<::mlir::PasscreateXeGPUWgToSgDistribute ()
void registerXeGPUBlocking ()
void registerXeGPUBlockingPass ()
void registerXeGPUFoldAliasOps ()
void registerXeGPUFoldAliasOpsPass ()
void registerXeGPUOptimizeBlockLoads ()
void registerXeGPUOptimizeBlockLoadsPass ()
void registerXeGPUPropagateLayout ()
void registerXeGPUPropagateLayoutPass ()
void registerXeGPUSubgroupDistribute ()
void registerXeGPUSubgroupDistributePass ()
void registerXeGPUVectorLinearize ()
void registerXeGPUVectorLinearizePass ()
void registerXeGPUWgToSgDistribute ()
void registerXeGPUWgToSgDistributePass ()
void registerXeGPUPasses ()
void populateXeGPUFoldAliasOpsPatterns (RewritePatternSet &patterns)
 Appends patterns for folding aliasing ops into XeGPU ops into patterns.
void populateXeGPUOptimizeBlockLoadsPatterns (RewritePatternSet &patterns)
 Appends patterns for optimizing block load operations into patterns.
void populateXeGPUSubgroupDistributePatterns (RewritePatternSet &patterns)
 Appends patterns for XeGPU SIMT distribution into patterns.
void populateXeGPUMoveFuncBodyToWarpOpPatterns (RewritePatternSet &patterns)
 Appends patterns for moving function body into gpu.warp_execute_on_lane0 op.
void populateXeGPUWgToSgDistributePatterns (RewritePatternSet &patterns)
 Appends patterns for XeGPU workgroup to subgroup distribution into patterns.
void populateXeGPUUnrollPatterns (RewritePatternSet &patterns, const UnrollOptions &options)
 Collect a set of patterns to unroll xegpu operations to a smaller shapes.
SmallVector< ValueflattenValues (ArrayRef< ValueRange > values)
 Flatten a set of ValueRange into a single SmallVector<Value>
FailureOr< VectorType > getDistributedVectorType (xegpu::TensorDescType tdescTy)
 If tensor descriptor has a layout attribute it is used in SIMT mode.
FailureOr< VectorType > getDistributedVectorType (VectorType originalType, LayoutAttr layout)
 Helper to get the distributed vector type for a given vector type according to a given LayoutAttr.
std::string getLayoutName (const OpOperand &operand)
 Return the attribute name for the OpOperand to attach DistributeLayoutAttr.
std::string getLayoutName (const OpResult result)
 Return the attribute name for the OpResult to attach DistributeLayoutAttr.
DistributeLayoutAttr getDistributeLayoutAttr (const Value value)
 Retrieves the DistributeLayoutAttr associated with a given Value.
template<typename AttrTy>
AttrTy getDistributeLayoutAttrOfType (const Value value)
DistributeLayoutAttr getDistributeLayoutAttr (const OpOperand &opr)
 Retrieves the DistributeLayoutAttr associated with a given OpOperand.
template<typename AttrTy>
AttrTy getDistributeLayoutAttrOfType (const OpOperand &opr)
template<typename T, typename = std::enable_if_t<std::is_same_v<T, OpOperand> || std::is_same_v<T, OpResult>>>
void removeLayoutAttr (const T &operandOrResult)
 Removes the LayoutAttr for a given OpOperand or OpResult if it exists.
void removeLayoutAttrs (Operation *op)
 Removes the DistributeLayoutAttr for each OpOperand and OpResult of the given operation if they exist.
template<typename T, typename = std::enable_if_t<std::is_same_v<T, OpOperand> || std::is_same_v<T, OpResult>>>
void setDistributeLayoutAttr (const T &operandOrResult, const DistributeLayoutAttr layout, bool respectPermLayout=false)
 Sets the DistributeLayoutAttr for a given OpOperand or OpResult by attaching it to the owner's dictionary attributes If respectPermLayout is true the existing permament layout attribute will be kept and assigned to the attribute dict instead of the provided layout.
void setDistributeLayoutAttrs (Operation *op, function_ref< DistributeLayoutAttr(Value)> getLayoutImpl)
 Set the DistributeLayoutAttr for each OpOperand and OpResult of the given operation.
SmallVector< ValueextractVectorsWithShapeFromValue (OpBuilder &builder, Location loc, Value value, ArrayRef< int64_t > shape)
 Extract a set of small vectors from a value with a given shape using vector.extract_stride_slice.
Value createVectorWithShapeFromValues (OpBuilder &builder, Location loc, ValueRange values, ArrayRef< int64_t > shape)
 Create a vector of shape from a set of values using vector.insert_stride_slice.
void doSCFStructuralTypeConversionWithTensorType (Operation *op, TypeConverter converter)
 Do type conversion for SCF structural ops, e.g., scf.for using SCF structure type convertion patterns.
std::optional< std::string > getChipStr (Operation *op)
 Retrieves the chip string from the XeVM target attribute of the parent GPU module operation.
SmallVector< OpFoldResultaddElementwise (OpBuilder &builder, Location loc, ArrayRef< OpFoldResult > lhs, ArrayRef< OpFoldResult > rhs)
 Generates element-wise addition ops of two arrays with same length.
SmallVector< OpFoldResultaddWithRightAligned (OpBuilder &builder, Location loc, ArrayRef< OpFoldResult > lhs, ArrayRef< OpFoldResult > rhs)
 Generates element-wise addition ops of two arrays with automatic alignment.
template<typename T>
int getLargestDivisor (T dim, ArrayRef< T > candidates, ArrayRef< T > candidateMultiples={})
 Helper Function to find a proper instruction multiple for the user-supplied sg-level data shape (diven by dim).
static SmallVector< SmallVector< Value > > genCoordinates (OpBuilder &builder, Location loc, SmallVector< Value > delinearizedId, ArrayRef< int64_t > subShapesLayout, ArrayRef< int64_t > subShape, ArrayRef< int64_t > srcShape)
template<typename ArithOp>
OpFoldResult genBinOp (OpFoldResult a, OpFoldResult b, Location loc, OpBuilder &builder)
SmallVector< OpFoldResultgetBlockedOffsets (OpBuilder &builder, Location loc, ArrayRef< OpFoldResult > offsets, ArrayRef< int64_t > blockShape)

Function Documentation

◆ addElementwise()

SmallVector< OpFoldResult > mlir::xegpu::addElementwise ( OpBuilder & builder,
Location loc,
ArrayRef< OpFoldResult > lhs,
ArrayRef< OpFoldResult > rhs )

Generates element-wise addition ops of two arrays with same length.

Definition at line 522 of file XeGPUUtils.cpp.

References mlir::OpBuilder::createOrFold(), mlir::getValueOrCreateConstantIndexOp(), lhs, and rhs.

Referenced by addWithRightAligned().

◆ addWithRightAligned()

SmallVector< OpFoldResult > mlir::xegpu::addWithRightAligned ( OpBuilder & builder,
Location loc,
ArrayRef< OpFoldResult > lhs,
ArrayRef< OpFoldResult > rhs )

Generates element-wise addition ops of two arrays with automatic alignment.

When the input arrays have different sizes, the shorter array is right-aligned with the longer array, and the unmatched leading elements from the longer array are preserved unchanged. This is commonly used for offset computation where higher-dimensional offsets need to be added to lower-dimensional adjustments.

Example: lhs = [l1, l2, l3], rhs = [r1, r2] Result: [11, l2+r1, l3+r2]

Definition at line 547 of file XeGPUUtils.cpp.

References addElementwise(), b, lhs, and rhs.

◆ createVectorWithShapeFromValues()

Value mlir::xegpu::createVectorWithShapeFromValues ( OpBuilder & builder,
Location loc,
ValueRange values,
ArrayRef< int64_t > shape )

Create a vector of shape from a set of values using vector.insert_stride_slice.

Definition at line 331 of file XeGPUUtils.cpp.

References mlir::DenseElementsAttr::get(), mlir::getType(), mlir::ValueRange::getTypes(), mlir::Builder::getZeroAttr(), and result.

Referenced by mlir::xegpu::impl::XeGPUBlockingBase< DerivedT >::clonePass().

◆ createXeGPUBlocking()

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUBlocking ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 88 of file XeGPUBlocking.cpp.

◆ createXeGPUFoldAliasOps()

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUFoldAliasOps ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 164 of file XeGPUFoldAliasOps.cpp.

◆ createXeGPUOptimizeBlockLoads()

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUOptimizeBlockLoads ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 241 of file XeGPUOptimizeBlockLoads.cpp.

References getChipStr(), mlir::getConstantIntValue(), mlir::Value::getType(), mlir::xegpu::uArch::getUArch(), and success().

◆ createXeGPUPropagateLayout() [1/2]

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUPropagateLayout ( )

Definition at line 337 of file XeGPUPropagateLayout.cpp.

◆ createXeGPUPropagateLayout() [2/2]

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUPropagateLayout ( XeGPUPropagateLayoutOptions options)

Definition at line 341 of file XeGPUPropagateLayout.cpp.

References broadcast(), and load.

◆ createXeGPUSubgroupDistribute()

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUSubgroupDistribute ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 419 of file XeGPUSubgroupDistribute.cpp.

◆ createXeGPUVectorLinearize()

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUVectorLinearize ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 498 of file XeGPUVectorLinearize.cpp.

◆ createXeGPUWgToSgDistribute()

std::unique_ptr<::mlir::Pass > mlir::xegpu::createXeGPUWgToSgDistribute ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 578 of file XeGPUWgToSgDistribute.cpp.

References success(), and target.

◆ doSCFStructuralTypeConversionWithTensorType()

void mlir::xegpu::doSCFStructuralTypeConversionWithTensorType ( Operation * op,
TypeConverter converter )

Do type conversion for SCF structural ops, e.g., scf.for using SCF structure type convertion patterns.

Since VectorType cannot carry the layout attribute, which is needed to guide the type conversion for XeGPU, they are first converted into RankedTensorType, where the layout attribute can be attached. And then upstream SCF structural type conversion patterns are applied with the provided converter. TODO: This is a temporary solution. We should refactor it when context-aware type conversion is available.

Definition at line 356 of file XeGPUUtils.cpp.

References mlir::WalkResult::advance(), flattenValues(), mlir::Operation::getContext(), getDistributeLayoutAttr(), mlir::Operation::getOperandTypes(), mlir::Operation::getOpResults(), mlir::Operation::getParentOp(), mlir::Operation::getResultTypes(), mlir::Value::getType(), mlir::patterns, mlir::scf::populateSCFStructuralTypeConversionsAndLegality(), result, mlir::Value::setType(), mlir::WalkResult::skip(), success(), target, and mlir::Operation::walk().

◆ extractVectorsWithShapeFromValue()

SmallVector< Value > mlir::xegpu::extractVectorsWithShapeFromValue ( OpBuilder & builder,
Location loc,
Value value,
ArrayRef< int64_t > shape )

Extract a set of small vectors from a value with a given shape using vector.extract_stride_slice.

Definition at line 294 of file XeGPUUtils.cpp.

References mlir::computeShapeRatio(), mlir::Value::getType(), and result.

◆ flattenValues()

SmallVector< Value > mlir::xegpu::flattenValues ( ArrayRef< ValueRange > values)

Flatten a set of ValueRange into a single SmallVector<Value>

convert ArrayRef<ValueRange> into SmallVector<Value>

Definition at line 32 of file XeGPUUtils.cpp.

References result.

Referenced by doSCFStructuralTypeConversionWithTensorType().

◆ genBinOp()

template<typename ArithOp>
OpFoldResult mlir::xegpu::genBinOp ( OpFoldResult a,
OpFoldResult b,
Location loc,
OpBuilder & builder )

Definition at line 814 of file XeGPUDialect.cpp.

References b, and mlir::getValueOrCreateConstantIndexOp().

◆ genCoordinates()

SmallVector< SmallVector< Value > > mlir::xegpu::genCoordinates ( OpBuilder & builder,
Location loc,
SmallVector< Value > delinearizedId,
ArrayRef< int64_t > subShapesLayout,
ArrayRef< int64_t > subShape,
ArrayRef< int64_t > srcShape )
static

◆ getBlockedOffsets()

SmallVector< OpFoldResult > mlir::xegpu::getBlockedOffsets ( OpBuilder & builder,
Location loc,
ArrayRef< OpFoldResult > offsets,
ArrayRef< int64_t > blockShape )

Definition at line 839 of file XeGPUDialect.cpp.

References div, and rem.

◆ getChipStr()

std::optional< std::string > mlir::xegpu::getChipStr ( Operation * op)

Retrieves the chip string from the XeVM target attribute of the parent GPU module operation.

Returns the chip identifier if found, or nullopt if no GPU module parent or XeVM target attribute exists.

Definition at line 503 of file XeGPUUtils.cpp.

References mlir::Operation::getParentOfType().

Referenced by createXeGPUOptimizeBlockLoads().

◆ getDistributedVectorType() [1/2]

FailureOr< VectorType > mlir::xegpu::getDistributedVectorType ( VectorType originalType,
LayoutAttr layout )

Helper to get the distributed vector type for a given vector type according to a given LayoutAttr.

References result.

◆ getDistributedVectorType() [2/2]

FailureOr< VectorType > mlir::xegpu::getDistributedVectorType ( xegpu::TensorDescType tdescTy)

If tensor descriptor has a layout attribute it is used in SIMT mode.

In this mode, the distributed vector shape is determined as follows: Definitions: lane_data_size = lane_data[0] × lane_data[1] subgroup_size = lane_layout[0] × lane_layout[1] distribution_unit_size = subgroup_size × lane_data_size

Case 1: Regular loads/stores. The following conditions must be met:

  • tensor_desc[0] == lane_layout[0] Distributed vector is a 1D vector with shape: [chunk_size]

Case 2: Block loads/stores Additional definitions: tensor_size = tensor_desc[0] * .. * tensor_desc[r-1] * array_length n_distribution_units = tensor_size / distribution_unit_size fragment_size = n_distribution_units * lane_data_size Given above definitions, the following conditions must be met:

  • tensor_desc[0] % (lane_layout[0] × lane_data[0]) == 0
  • tensor_desc[1] % (lane_layout[1] × lane_data[1]) == 0 Distributed vector is a 1D vector with shape: [fragment_size]

Definition at line 40 of file XeGPUUtils.cpp.

◆ getDistributeLayoutAttr() [1/2]

xegpu::DistributeLayoutAttr mlir::xegpu::getDistributeLayoutAttr ( const OpOperand & opr)

Retrieves the DistributeLayoutAttr associated with a given OpOperand.

It will first check the operand_layout_{id} of the owner operation. If not found, it will check the operand itself and its defining op.

Definition at line 167 of file XeGPUUtils.cpp.

References mlir::IROperand< DerivedT, IRValueT >::get(), mlir::Operation::getAttrOfType(), getDistributeLayoutAttr(), getLayoutName(), mlir::detail::IROperandBase::getOwner(), and mlir::Operation::hasAttr().

◆ getDistributeLayoutAttr() [2/2]

xegpu::DistributeLayoutAttr mlir::xegpu::getDistributeLayoutAttr ( const Value value)

Retrieves the DistributeLayoutAttr associated with a given Value.

For TensorDescType values, the DistributeLayoutAttr is extracted from the TensorDescType itself. For other values, it is obtained from the attributes of the defining operation. Returns nullptr if no DistributeLayoutAttr is found.

Definition at line 116 of file XeGPUUtils.cpp.

References mlir::IROperand< DerivedT, IRValueT >::get(), mlir::Operation::getAttrOfType(), getDistributeLayoutAttr(), getLayoutName(), mlir::Value::getType(), mlir::Operation::hasAttr(), and result.

Referenced by doSCFStructuralTypeConversionWithTensorType(), getDistributeLayoutAttr(), getDistributeLayoutAttr(), getDistributeLayoutAttrOfType(), and getDistributeLayoutAttrOfType().

◆ getDistributeLayoutAttrOfType() [1/2]

template<typename AttrTy>
AttrTy mlir::xegpu::getDistributeLayoutAttrOfType ( const OpOperand & opr)

Definition at line 90 of file XeGPUUtils.h.

References getDistributeLayoutAttr().

◆ getDistributeLayoutAttrOfType() [2/2]

template<typename AttrTy>
AttrTy mlir::xegpu::getDistributeLayoutAttrOfType ( const Value value)

Definition at line 80 of file XeGPUUtils.h.

References getDistributeLayoutAttr().

◆ getLargestDivisor()

template<typename T>
int mlir::xegpu::getLargestDivisor ( T dim,
ArrayRef< T > candidates,
ArrayRef< T > candidateMultiples = {} )

Helper Function to find a proper instruction multiple for the user-supplied sg-level data shape (diven by dim).

candidates are uArch allowed shapes. candidateMultiples are uArch multiples of such shapes (i.e. block count or array length).

Definition at line 560 of file XeGPUUtils.cpp.

◆ getLayoutName() [1/2]

std::string mlir::xegpu::getLayoutName ( const OpOperand & operand)

Return the attribute name for the OpOperand to attach DistributeLayoutAttr.

Definition at line 105 of file XeGPUUtils.cpp.

Referenced by getDistributeLayoutAttr(), getDistributeLayoutAttr(), removeLayoutAttr(), and setDistributeLayoutAttr().

◆ getLayoutName() [2/2]

std::string mlir::xegpu::getLayoutName ( const OpResult result)

Return the attribute name for the OpResult to attach DistributeLayoutAttr.

Definition at line 111 of file XeGPUUtils.cpp.

References result.

◆ populateXeGPUFoldAliasOpsPatterns()

void mlir::xegpu::populateXeGPUFoldAliasOpsPatterns ( RewritePatternSet & patterns)

Appends patterns for folding aliasing ops into XeGPU ops into patterns.

Definition at line 63 of file XeGPUFoldAliasOps.cpp.

References mlir::patterns.

◆ populateXeGPUMoveFuncBodyToWarpOpPatterns()

void mlir::xegpu::populateXeGPUMoveFuncBodyToWarpOpPatterns ( RewritePatternSet & patterns)

Appends patterns for moving function body into gpu.warp_execute_on_lane0 op.

Definition at line 1634 of file XeGPUSubgroupDistribute.cpp.

References mlir::patterns.

◆ populateXeGPUOptimizeBlockLoadsPatterns()

void mlir::xegpu::populateXeGPUOptimizeBlockLoadsPatterns ( RewritePatternSet & patterns)

Appends patterns for optimizing block load operations into patterns.

Definition at line 421 of file XeGPUOptimizeBlockLoads.cpp.

References mlir::patterns.

◆ populateXeGPUSubgroupDistributePatterns()

void mlir::xegpu::populateXeGPUSubgroupDistributePatterns ( RewritePatternSet & patterns)

Appends patterns for XeGPU SIMT distribution into patterns.

Definition at line 1618 of file XeGPUSubgroupDistribute.cpp.

References mlir::patterns.

◆ populateXeGPUUnrollPatterns()

void mlir::xegpu::populateXeGPUUnrollPatterns ( RewritePatternSet & patterns,
const UnrollOptions & options )

Collect a set of patterns to unroll xegpu operations to a smaller shapes.

Users can control whether an operation to be unrolled or not, as well as its target shape via options structure. (via setting filterConstraint and nativeShape respectively, both of them are function refs taking op as input). An op is unrolled to the targetShape as follows, for each of its operands:

  1. the unrolled type unrolledType and number of unrolled instances numUnrolledInstances are computed from the targetShape.
  2. pack each operand. ExtractStridedSlice are created to break-up the vector operands. And BuiltinUnrealizedCastop are created to break-up the TensorDesc operands.
  3. the original op is cloned numUnrolledInstances times, once for each result.
  4. unpack the results. InsertStridedSlice are inserted for VectorType result, and BuiltinUnrealizedCastOp are inserted for TensorDescType result to re-assemble the slices into the original shape.

Definition at line 1024 of file XeGPUUnroll.cpp.

References options, and mlir::patterns.

◆ populateXeGPUWgToSgDistributePatterns()

void mlir::xegpu::populateXeGPUWgToSgDistributePatterns ( RewritePatternSet & patterns)

Appends patterns for XeGPU workgroup to subgroup distribution into patterns.

Definition at line 1342 of file XeGPUWgToSgDistribute.cpp.

References mlir::patterns.

◆ registerTransformDialectExtension()

void mlir::xegpu::registerTransformDialectExtension ( DialectRegistry & registry)

◆ registerXeGPUBlocking()

void mlir::xegpu::registerXeGPUBlocking ( )
inline

Definition at line 599 of file Passes.h.

◆ registerXeGPUBlockingPass()

void mlir::xegpu::registerXeGPUBlockingPass ( )
inline

Definition at line 606 of file Passes.h.

◆ registerXeGPUFoldAliasOps()

void mlir::xegpu::registerXeGPUFoldAliasOps ( )
inline

Definition at line 620 of file Passes.h.

◆ registerXeGPUFoldAliasOpsPass()

void mlir::xegpu::registerXeGPUFoldAliasOpsPass ( )
inline

Definition at line 627 of file Passes.h.

◆ registerXeGPUOptimizeBlockLoads()

void mlir::xegpu::registerXeGPUOptimizeBlockLoads ( )
inline

Definition at line 641 of file Passes.h.

◆ registerXeGPUOptimizeBlockLoadsPass()

void mlir::xegpu::registerXeGPUOptimizeBlockLoadsPass ( )
inline

Definition at line 648 of file Passes.h.

◆ registerXeGPUPasses()

void mlir::xegpu::registerXeGPUPasses ( )
inline

Definition at line 746 of file Passes.h.

Referenced by mlir::registerAllPasses().

◆ registerXeGPUPropagateLayout()

void mlir::xegpu::registerXeGPUPropagateLayout ( )
inline

Definition at line 662 of file Passes.h.

◆ registerXeGPUPropagateLayoutPass()

void mlir::xegpu::registerXeGPUPropagateLayoutPass ( )
inline

Definition at line 669 of file Passes.h.

◆ registerXeGPUSubgroupDistribute()

void mlir::xegpu::registerXeGPUSubgroupDistribute ( )
inline

Definition at line 683 of file Passes.h.

◆ registerXeGPUSubgroupDistributePass()

void mlir::xegpu::registerXeGPUSubgroupDistributePass ( )
inline

Definition at line 690 of file Passes.h.

◆ registerXeGPUVectorLinearize()

void mlir::xegpu::registerXeGPUVectorLinearize ( )
inline

Definition at line 704 of file Passes.h.

◆ registerXeGPUVectorLinearizePass()

void mlir::xegpu::registerXeGPUVectorLinearizePass ( )
inline

Definition at line 711 of file Passes.h.

◆ registerXeGPUWgToSgDistribute()

void mlir::xegpu::registerXeGPUWgToSgDistribute ( )
inline

Definition at line 725 of file Passes.h.

◆ registerXeGPUWgToSgDistributePass()

void mlir::xegpu::registerXeGPUWgToSgDistributePass ( )
inline

Definition at line 732 of file Passes.h.

◆ removeLayoutAttr()

template<typename T, typename = std::enable_if_t<std::is_same_v<T, OpOperand> || std::is_same_v<T, OpResult>>>
void mlir::xegpu::removeLayoutAttr ( const T & operandOrResult)

◆ removeLayoutAttrs()

void mlir::xegpu::removeLayoutAttrs ( Operation * op)

Removes the DistributeLayoutAttr for each OpOperand and OpResult of the given operation if they exist.

If the operation contains regions, it is also applied recursively to the contained operations

Definition at line 284 of file XeGPUUtils.cpp.

References mlir::Operation::getOpOperands(), mlir::Operation::getOpResults(), removeLayoutAttr(), result, and mlir::Operation::walk().

◆ setDistributeLayoutAttr()

template<typename T, typename = std::enable_if_t<std::is_same_v<T, OpOperand> || std::is_same_v<T, OpResult>>>
void mlir::xegpu::setDistributeLayoutAttr ( const T & operandOrResult,
const DistributeLayoutAttr layout,
bool respectPermLayout = false )

Sets the DistributeLayoutAttr for a given OpOperand or OpResult by attaching it to the owner's dictionary attributes If respectPermLayout is true the existing permament layout attribute will be kept and assigned to the attribute dict instead of the provided layout.

Definition at line 224 of file XeGPUUtils.cpp.

References getLayoutName(), mlir::Operation::hasAttrOfType(), maybePickPermanentLayout(), and mlir::Operation::setAttr().

Referenced by setDistributeLayoutAttrs(), updateControlFlowOps(), updateOp(), xegpu::setDistributeLayoutAttr< mlir::OpOperand >(), and xegpu::setDistributeLayoutAttr< mlir::OpResult >().

◆ setDistributeLayoutAttrs()

void mlir::xegpu::setDistributeLayoutAttrs ( Operation * op,
function_ref< DistributeLayoutAttr(Value)> getLayoutImpl )

Set the DistributeLayoutAttr for each OpOperand and OpResult of the given operation.

If the operation contains regions, it is also applied recursively to the contained operations

Definition at line 251 of file XeGPUUtils.cpp.

References mlir::Operation::getOpOperands(), mlir::Operation::getOpResults(), result, setDistributeLayoutAttr(), and mlir::Operation::walk().