Files
gps/tools/local/circt/include/mlir/Dialect/XeGPU/IR/XeGPUAttrInterface.cpp.inc
T
2026-07-12 11:01:51 +03:00

199 lines
11 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Interface Definitions *|
|* *|
|* Automatically generated file, do not edit! *|
|* *|
\*===----------------------------------------------------------------------===*/
/// Check the availability of workgroup level layouts
bool mlir::xegpu::DistributeLayoutAttr::isForWorkgroup() const {
return getImpl()->isForWorkgroup(getImpl(), *this);
}
/// Check the availability of subgroup level layouts
bool mlir::xegpu::DistributeLayoutAttr::isForSubgroup() const {
return getImpl()->isForSubgroup(getImpl(), *this);
}
/// Check the availability of lane level layouts
bool mlir::xegpu::DistributeLayoutAttr::isForLane() const {
return getImpl()->isForLane(getImpl(), *this);
}
/// Get the rank of attribute
int64_t mlir::xegpu::DistributeLayoutAttr::getRank() const {
return getImpl()->getRank(getImpl(), *this);
}
/// Get the num of effective subgroups
int64_t mlir::xegpu::DistributeLayoutAttr::getNumSubgroups() const {
return getImpl()->getNumSubgroups(getImpl(), *this);
}
/// Get the order of the layout attribute
DenseI32ArrayAttr mlir::xegpu::DistributeLayoutAttr::getOrder() const {
return getImpl()->getOrder(getImpl(), *this);
}
/// Get the effective SgLayout of the layout attribute as integer array
SmallVector<int64_t> mlir::xegpu::DistributeLayoutAttr::getEffectiveSgLayoutAsInt() const {
return getImpl()->getEffectiveSgLayoutAsInt(getImpl(), *this);
}
/// Get the effective SgData of the layout attribute as integer array
SmallVector<int64_t> mlir::xegpu::DistributeLayoutAttr::getEffectiveSgDataAsInt() const {
return getImpl()->getEffectiveSgDataAsInt(getImpl(), *this);
}
/// Get the effective InstData of the layout attribute as integer array
SmallVector<int64_t> mlir::xegpu::DistributeLayoutAttr::getEffectiveInstDataAsInt() const {
return getImpl()->getEffectiveInstDataAsInt(getImpl(), *this);
}
/// Get the effective LaneLayout of the layout attribute as integer array
SmallVector<int64_t> mlir::xegpu::DistributeLayoutAttr::getEffectiveLaneLayoutAsInt() const {
return getImpl()->getEffectiveLaneLayoutAsInt(getImpl(), *this);
}
/// Get the effective LaneData of the layout attribute as integer array
SmallVector<int64_t> mlir::xegpu::DistributeLayoutAttr::getEffectiveLaneDataAsInt() const {
return getImpl()->getEffectiveLaneDataAsInt(getImpl(), *this);
}
/// Get the effective order of the layout attribute as integer array
SmallVector<int64_t> mlir::xegpu::DistributeLayoutAttr::getEffectiveOrderAsInt() const {
return getImpl()->getEffectiveOrderAsInt(getImpl(), *this);
}
/// Derive a new layout by dropping sgLayout and sgData
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::dropSgLayoutAndData() const {
return getImpl()->dropSgLayoutAndData(getImpl(), *this);
}
/// Derive a new layout by dropping InstData
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::dropInstData() const {
return getImpl()->dropInstData(getImpl(), *this);
}
/// Derive a new layout with sg_data, inst_data and lane_data set to 1 for the specified unit dims
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::setUnitDimData(const SmallVector<int64_t> unitDims) const {
return getImpl()->setUnitDimData(getImpl(), *this, unitDims);
}
/// Derive a new layout with sg_lane and lane_layout set to 1 for the specified unit dims
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::setUnitDimLayout(const SmallVector<int64_t> unitDims) const {
return getImpl()->setUnitDimLayout(getImpl(), *this, unitDims);
}
/// Delinearizes a linear ID into its multidimensional
/// indices based on the effective layout level.
FailureOr<SmallVector<Value>> mlir::xegpu::DistributeLayoutAttr::delinearizeId(OpBuilder & builder, Location loc, Value linearId) const {
return getImpl()->delinearizeId(getImpl(), *this, builder, loc, linearId);
}
/// Derive a new layout with sg_data, inst_data and lane_data set to the
/// specified values for the given dimension. Passing -1 for any parameter
/// preserves its original value.
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::setDimData(int64_t dim, int64_t sgData, int64_t instData, int64_t laneData) const {
return getImpl()->setDimData(getImpl(), *this, dim, sgData, instData, laneData);
}
/// Derive a new layout by removing dimensions.
/// `dimGroup` specifies a group of dimensions to be removed in the derived layout.
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::dropDims(SmallVector<int64_t> dimGroup) const {
return getImpl()->dropDims(getImpl(), *this, dimGroup);
}
/// Derive a new layout by collapsing dimensions.
/// `dimGroup` specifies a group of adjacent dimensions that are collapsed into
/// a single dimension in the derived layout.
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::collapseDims(SmallVector<int64_t> dimGroup) const {
return getImpl()->collapseDims(getImpl(), *this, dimGroup);
}
/// Derive a new layout by expanding a single dimension into
/// multiple adjacent dimensions whose extents are given by `targetShape`
/// (`product(targetShape) == originalSize` on `dim`). The original layout's
/// per-dim values on `dim` are distributed across the new dims:
/// `sg_layout` and `lane_layout` spread outer-to-inner (capped per dim by
/// `targetShape[i]`); `sg_data`, `lane_data`, and `inst_data` fill innermost-
/// first; `inst_data` is seeded from `lane_layout * lane_data` per new dim.
/// `order`, when present, is rewritten so the expanded dims appear
/// innermost-fastest in the original dim's slot; if the input has no
/// `order`, the result has no `order` either (the default FCD-first
/// order `[rank-1, ..., 0]` is assumed).
/// Example: layout<sg_layout=[2, 16], sg_data=[1, 1]> with
/// expandDim(1, [2, 8]) -> layout<sg_layout=[2, 2, 8], sg_data=[1, 1, 1]>
/// (no order in, no order out).
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::expandDim(int64_t dim, ArrayRef<int64_t> targetShape) const {
return getImpl()->expandDim(getImpl(), *this, dim, targetShape);
}
/// Derive a new layout by trasnposing it using `permutation`.
xegpu::DistributeLayoutAttr mlir::xegpu::DistributeLayoutAttr::transposeDims(ArrayRef<int64_t> permutation) const {
return getImpl()->transposeDims(getImpl(), *this, permutation);
}
/// Generates instructions to compute multidimensional coordinates for dist units
/// assigned to a level identified by linearId. The shape parameter
/// represents the higher-level problem size. Each level may access
/// multiple blocks according to round-robin distribution rules.
FailureOr<SmallVector<SmallVector<Value>>> mlir::xegpu::DistributeLayoutAttr::computeDistributedCoords(OpBuilder & builder, Location loc, Value linearId, ArrayRef<int64_t> shape) const {
return getImpl()->computeDistributedCoords(getImpl(), *this, builder, loc, linearId, shape);
}
/// Statically computes multidimensional coordinates for all dist units
/// assigned to a compute unit identified by `linearId`. This is the
/// compile-time counterpart of `computeDistributedCoords`: it performs
/// the same delinearization and round-robin enumeration but operates
/// entirely on static integer values. Returns a list of coordinate
/// vectors, one per dist unit.
SmallVector<SmallVector<int64_t>> mlir::xegpu::DistributeLayoutAttr::computeStaticDistributedCoords(int64_t linearId, ArrayRef<int64_t> shape) const {
return getImpl()->computeStaticDistributedCoords(getImpl(), *this, linearId, shape);
}
/// Computes the distributed shape for each compute unit by dividing each
/// dimension of `shape` by the corresponding layout factor (sg_layout or
/// lane_layout).
/// The distributed shape represents the per-compute-unit tile. Each
/// distribution unit is defined as the combination of layout factors and
/// per-unit data (`subshape`, e.g., sg_data or lane_data). When `shape`
/// spans multiple distribution units, the distributed shape may contain
/// multiple such units.
/// For wrap-around dimensions where the division is uneven, the tensor tile
/// is broadcast to all subgroups/lanes.
FailureOr<SmallVector<int64_t>> mlir::xegpu::DistributeLayoutAttr::computeDistributedShape(SmallVector<int64_t> shape) const {
return getImpl()->computeDistributedShape(getImpl(), *this, shape);
}
/// Checks if the given shape can be distributed by the layout
bool mlir::xegpu::DistributeLayoutAttr::isDistributable(SmallVector<int64_t> shape) const {
return getImpl()->isDistributable(getImpl(), *this, shape);
}
/// Check if this layout is a slice of another layout.
bool mlir::xegpu::DistributeLayoutAttr::isSliceOf(const xegpu::DistributeLayoutAttr& other) const {
return getImpl()->isSliceOf(getImpl(), *this, other);
}
/// Check if this layout is a transpose of
/// the other layout according to given permutation of (0...n-1).
bool mlir::xegpu::DistributeLayoutAttr::isTransposeOf(const xegpu::DistributeLayoutAttr& other, ArrayRef<int64_t> perm, xegpu::LayoutKind kind) const {
return getImpl()->isTransposeOf(getImpl(), *this, other, perm, kind);
}
/// Check if this layout is compatible with another layout
/// at a specific level of the layout hierarchy regarding a given shape.
bool mlir::xegpu::DistributeLayoutAttr::isCompatibleWith(const xegpu::DistributeLayoutAttr& other, SmallVector<int64_t> shape, xegpu::LayoutKind level) const {
return getImpl()->isCompatibleWith(getImpl(), *this, other, shape, level);
}
/// Check if this layout is equal to another layout.
/// For LayoutAttr, this compares all fields.
/// For SliceAttr, this requires the same parent and same sliced dims.
bool mlir::xegpu::DistributeLayoutAttr::isEqualTo(const xegpu::DistributeLayoutAttr& other) const {
return getImpl()->isEqualTo(getImpl(), *this, other);
}