MLIR 22.0.0git
XeGPUUtils.h File Reference

Go to the source code of this file.

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::xegpu

Functions

SmallVector< Valuemlir::xegpu::flattenValues (ArrayRef< ValueRange > values)
 Flatten a set of ValueRange into a single SmallVector<Value>
FailureOr< VectorType > mlir::xegpu::getDistributedVectorType (xegpu::TensorDescType tdescTy)
 If tensor descriptor has a layout attribute it is used in SIMT mode.
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.
SmallVector< Valuemlir::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.
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.
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.
std::optional< std::string > mlir::xegpu::getChipStr (Operation *op)
 Retrieves the chip string from the XeVM target attribute of the parent GPU module operation.
SmallVector< OpFoldResultmlir::xegpu::addElementwise (OpBuilder &builder, Location loc, ArrayRef< OpFoldResult > lhs, ArrayRef< OpFoldResult > rhs)
 Generates element-wise addition ops of two arrays with same length.
SmallVector< OpFoldResultmlir::xegpu::addWithRightAligned (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 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).
std::string mlir::xegpu::getTemporaryLayoutName (const OpOperand &operand)
 Return the attribute name for the OpOperand to attach DistributeLayoutAttr.
std::string mlir::xegpu::getTemporaryLayoutName (const OpResult result)
 Return the attribute name for the OpResult to attach DistributeLayoutAttr.
DistributeLayoutAttr mlir::xegpu::getDistributeLayoutAttr (const Value value)
 Retrieves the DistributeLayoutAttr associated with a given Value.
DistributeLayoutAttr mlir::xegpu::getDistributeLayoutAttr (const OpOperand &opr)
 Retrieves the DistributeLayoutAttr associated with a given OpOperand.
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)
 Removes the LayoutAttr for a given OpOperand or OpResult if it exists.
void mlir::xegpu::removeLayoutAttrs (Operation *op)
 Removes the DistributeLayoutAttr for each OpOperand and OpResult of the given operation if they exist.
void mlir::xegpu::setDistributeLayoutAttr (const OpResult &Result, const DistributeLayoutAttr layout)
 [to-be-deprecated] Sets the DistributeLayoutAttr for a given OpResult user should use setAnchorLayout instead
void mlir::xegpu::setDistributeLayoutAttr (const OpOperand &opr, const DistributeLayoutAttr layout)
 [to-be-deprecated] Sets the DistributeLayoutAttr for a given OpOperand user should use setAnchorLayout instead
template<typename T, typename = std::enable_if_t<std::is_same_v<T, OpOperand> || std::is_same_v<T, OpResult>>>
DistributeLayoutAttr mlir::xegpu::getTemporaryLayout (const T &operandOrResult)
 get and set distribute layout attribute for non-anchor operations (and offsets/masks of load/store ops before we get rid of their temp attrs)
template<typename T, typename = std::enable_if_t<std::is_same_v<T, OpOperand> || std::is_same_v<T, OpResult>>>
void mlir::xegpu::setTemporaryLayout (const T &operandOrResult, const DistributeLayoutAttr layout)
void mlir::xegpu::recoverTemporaryLayoutsDeprecated (Operation *op)
 [to-be-deprecated] Set the DistributeLayoutAttr for each OpOperand and OpResult of of the given operation.
bool mlir::xegpu::recoverTemporaryLayouts (Operation *rootOp)
 Attach layout attributes to all vector-type operands of operations within the given operation's region.