MLIR 24.0.0git
XeVMDialect.cpp File Reference
#include "mlir/Dialect/LLVMIR/XeVMDialect.h"
#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/TypeUtilities.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MathExtras.h"
#include "mlir/Dialect/LLVMIR/XeVMOpsDialect.cpp.inc"
#include "mlir/Dialect/LLVMIR/XeVMOpsEnums.cpp.inc"
#include "mlir/Dialect/LLVMIR/XeVMOps.cpp.inc"
#include "mlir/Dialect/LLVMIR/XeVMOpsAttributes.cpp.inc"

Go to the source code of this file.

Macros

#define GET_OP_LIST
#define GET_ATTRDEF_LIST
#define GET_OP_CLASSES
#define GET_ATTRDEF_CLASSES

Functions

template<typename OpType, typename = std::enable_if_t<llvm::is_one_of< OpType, BlockLoadOp, BlockStoreOp>::value>>
LogicalResult verify1DBlockArg (OpType op)
static int64_t getNarrowFloatBitWidth (TruncfDstElemTypes etype)
 Number of bits one narrow float value occupies.
static int64_t getNarrowFloatBitWidth (ExtfSrcElemTypes etype)
static int64_t getNumValues (Type ty)
 Number of values ty holds: its length if it is a vector, and one otherwise.
static int64_t getPackedBitWidth (Type ty)
 Total bit width of ty, which is a scalar or a vector of a scalar.
static LogicalResult verifyPackedWidth (Operation *op, StringRef packedName, Type packedTy, int64_t numValues, int64_t narrowBits)
 Verifies that packedTy is exactly wide enough to hold numValues values of narrowBits bits each, rounded up to whole bytes.

Macro Definition Documentation

◆ GET_ATTRDEF_CLASSES

#define GET_ATTRDEF_CLASSES

Definition at line 494 of file XeVMDialect.cpp.

◆ GET_ATTRDEF_LIST

#define GET_ATTRDEF_LIST

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

Definition at line 491 of file XeVMDialect.cpp.

◆ GET_OP_LIST

#define GET_OP_LIST

Function Documentation

◆ getNarrowFloatBitWidth() [1/2]

int64_t getNarrowFloatBitWidth ( ExtfSrcElemTypes etype)
static

Definition at line 367 of file XeVMDialect.cpp.

◆ getNarrowFloatBitWidth() [2/2]

int64_t getNarrowFloatBitWidth ( TruncfDstElemTypes etype)
static

Number of bits one narrow float value occupies.

The narrow values of a xevm.truncf destination, or a xevm.extf source, are packed into whole bytes, so a sub-byte format fits several values per byte.

Definition at line 364 of file XeVMDialect.cpp.

◆ getNumValues()

int64_t getNumValues ( Type ty)
static

Number of values ty holds: its length if it is a vector, and one otherwise.

SPIR-V has no vector of length one and uses a scalar instead, so a conversion of two fp4 values, which pack into a single byte, has a scalar on its packed side.

Definition at line 375 of file XeVMDialect.cpp.

◆ getPackedBitWidth()

int64_t getPackedBitWidth ( Type ty)
static

Total bit width of ty, which is a scalar or a vector of a scalar.

Definition at line 382 of file XeVMDialect.cpp.

References mlir::Type::getIntOrFloatBitWidth().

Referenced by verifyPackedWidth().

◆ verify1DBlockArg()

template<typename OpType, typename = std::enable_if_t<llvm::is_one_of< OpType, BlockLoadOp, BlockStoreOp>::value>>
LogicalResult verify1DBlockArg ( OpType op)

Definition at line 313 of file XeVMDialect.cpp.

References success().

◆ verifyPackedWidth()

LogicalResult verifyPackedWidth ( Operation * op,
StringRef packedName,
Type packedTy,
int64_t numValues,
int64_t narrowBits )
static

Verifies that packedTy is exactly wide enough to hold numValues values of narrowBits bits each, rounded up to whole bytes.

Definition at line 390 of file XeVMDialect.cpp.

References mlir::Operation::emitOpError(), getPackedBitWidth(), and success().