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/MathExtras.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.

Namespaces

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

Macros

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

Typedefs

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

Functions

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 53 of file XeGPUPropagateLayout.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "xegpu-propagate-layout"

Definition at line 52 of file XeGPUPropagateLayout.cpp.

◆ GEN_PASS_DEF_XEGPUPROPAGATELAYOUT

#define GEN_PASS_DEF_XEGPUPROPAGATELAYOUT

Definition at line 47 of file XeGPUPropagateLayout.cpp.

Typedef Documentation

◆ GetLayoutFnTy

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

Definition at line 1767 of file XeGPUPropagateLayout.cpp.

Function Documentation

◆ updateFunctionOpInterface()

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

Update the function arguments and results with the layouts.

Definition at line 1828 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 1777 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().