MLIR 24.0.0git
XeGPUPropagateLayout.cpp File Reference
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
#include "mlir/Analysis/DataFlow/Utils.h"
#include "mlir/Analysis/DataFlowFramework.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/XeGPU/IR/XeGPU.h"
#include "mlir/Dialect/XeGPU/Transforms/Passes.h"
#include "mlir/Dialect/XeGPU/Transforms/XeGPULayoutImpl.h"
#include "mlir/Dialect/XeGPU/Utils/XeGPUUtils.h"
#include "mlir/Dialect/XeGPU/uArch/uArchCommon.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/Value.h"
#include "mlir/IR/Visitors.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/LogicalResult.h"
#include "llvm/Support/raw_ostream.h"
#include <limits>
#include "mlir/Dialect/XeGPU/Transforms/Passes.h.inc"

Go to the source code of this file.

Classes

class  mlir::xegpu::impl::XeGPUPropagateLayoutBase< DerivedT >

Namespaces

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

Macros

#define GEN_PASS_DEF_XEGPUPROPAGATELAYOUT
#define DEBUG_TYPE   "xegpu-propagate-layout"
#define DBGS()

Typedefs

using GetLayoutFnTy = function_ref<xegpu::DistributeLayoutAttr(Value)>

Functions

std::unique_ptr<::mlir::Passmlir::xegpu::impl::createXeGPUPropagateLayout ()
std::unique_ptr<::mlir::Passmlir::xegpu::impl::createXeGPUPropagateLayout (XeGPUPropagateLayoutOptions options)
std::unique_ptr<::mlir::Passmlir::xegpu::createXeGPUPropagateLayout ()
std::unique_ptr<::mlir::Passmlir::xegpu::createXeGPUPropagateLayout (XeGPUPropagateLayoutOptions options)
FailureOr< int64_tgetNumSg (Operation *op, const int sgSize, xegpu::DistributeLayoutAttr consumerLayout=nullptr)
static LogicalResult updateOpWithForwardFill (mlir::OpBuilder &builder, mlir::Operation *op, GetLayoutFnTy getLayoutOfValue)
 Update an operation with the layout of its results.
static LogicalResult updateFunctionOpInterface (mlir::OpBuilder &builder, mlir::FunctionOpInterface funcOp, GetLayoutFnTy getLayoutOfValue)
 Update the function arguments and results with the layouts.

Macro Definition Documentation

◆ DBGS

#define DBGS ( )
Value:
(llvm::dbgs() << "[" DEBUG_TYPE "]: ")
#define DEBUG_TYPE

Definition at line 52 of file XeGPUPropagateLayout.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "xegpu-propagate-layout"

Definition at line 51 of file XeGPUPropagateLayout.cpp.

◆ GEN_PASS_DEF_XEGPUPROPAGATELAYOUT

#define GEN_PASS_DEF_XEGPUPROPAGATELAYOUT

Definition at line 46 of file XeGPUPropagateLayout.cpp.

Typedef Documentation

◆ GetLayoutFnTy

using GetLayoutFnTy = function_ref<xegpu::DistributeLayoutAttr(Value)>

Definition at line 1750 of file XeGPUPropagateLayout.cpp.

Function Documentation

◆ getNumSg()

FailureOr< int64_t > getNumSg ( Operation * op,
const int sgSize,
xegpu::DistributeLayoutAttr consumerLayout = nullptr )

Definition at line 457 of file XeGPUPropagateLayout.cpp.

References mlir::Operation::getParentOfType().

◆ updateFunctionOpInterface()

LogicalResult updateFunctionOpInterface ( mlir::OpBuilder & builder,
mlir::FunctionOpInterface funcOp,
GetLayoutFnTy getLayoutOfValue )
static

Update the function arguments and results with the layouts.

Definition at line 1811 of file XeGPUPropagateLayout.cpp.

References DBGS, and success().

Referenced by mlir::xegpu::propagateLayouts().

◆ updateOpWithForwardFill()

LogicalResult updateOpWithForwardFill ( mlir::OpBuilder & builder,
mlir::Operation * op,
GetLayoutFnTy getLayoutOfValue )
static

Update an operation with the layout of its results.

If the result type is a vector type, a temporary layout attribute is added to the operation. If the result type is a tensor descriptor type, the type is updated with the layout attribute. The users of the result are also updated with the layout attribute.

If the global propagation left a result without a layout, forward-fill it locally from the operand layouts.

Definition at line 1760 of file XeGPUPropagateLayout.cpp.

References mlir::Operation::emitWarning(), mlir::xegpu::getDistributeLayoutAttr(), mlir::Operation::getNumOperands(), mlir::Operation::getOperands(), mlir::Operation::getResults(), mlir::xegpu::inferResultLayoutFromSourceForNonAnchorOp(), result, mlir::xegpu::setDistributeLayoutAttr(), and success().

Referenced by mlir::xegpu::propagateLayouts().