31682 lines
1.6 MiB
Plaintext
31682 lines
1.6 MiB
Plaintext
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|
|
|* *|
|
|
|* Op Definitions *|
|
|
|* *|
|
|
|* Automatically generated file, do not edit! *|
|
|
|* From: AMDGPU.td *|
|
|
|* *|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
#ifdef GET_OP_LIST
|
|
#undef GET_OP_LIST
|
|
|
|
::mlir::amdgpu::DPPOp,
|
|
::mlir::amdgpu::DotOp,
|
|
::mlir::amdgpu::DsAsyncBarrierArriveOp,
|
|
::mlir::amdgpu::DsBarrierArriveOp,
|
|
::mlir::amdgpu::DsBarrierInitOp,
|
|
::mlir::amdgpu::DsBarrierPollStateOp,
|
|
::mlir::amdgpu::DsBarrierStateInitCountOp,
|
|
::mlir::amdgpu::DsBarrierStatePendingCountOp,
|
|
::mlir::amdgpu::DsBarrierStatePhaseOp,
|
|
::mlir::amdgpu::DsBarrierStatePhaseParity,
|
|
::mlir::amdgpu::ExtPackedFp8Op,
|
|
::mlir::amdgpu::FatRawBufferCastOp,
|
|
::mlir::amdgpu::GatherToLDSOp,
|
|
::mlir::amdgpu::GlobalLoadAsyncToLDSOp,
|
|
::mlir::amdgpu::GlobalPrefetchOp,
|
|
::mlir::amdgpu::GlobalTransposeLoadOp,
|
|
::mlir::amdgpu::LDSBarrierOp,
|
|
::mlir::amdgpu::MFMAOp,
|
|
::mlir::amdgpu::MakeDmaBaseOp,
|
|
::mlir::amdgpu::MakeDmaDescriptorOp,
|
|
::mlir::amdgpu::MakeGatherDmaBaseOp,
|
|
::mlir::amdgpu::MakeGatherDmaDescriptorOp,
|
|
::mlir::amdgpu::MemoryCounterWaitOp,
|
|
::mlir::amdgpu::PackedScaledTruncOp,
|
|
::mlir::amdgpu::PackedStochRoundFp8Op,
|
|
::mlir::amdgpu::PackedTrunc2xFp8Op,
|
|
::mlir::amdgpu::PermlaneSwapOp,
|
|
::mlir::amdgpu::PermlaneVarOp,
|
|
::mlir::amdgpu::RawBufferAtomicCmpswapOp,
|
|
::mlir::amdgpu::RawBufferAtomicFaddOp,
|
|
::mlir::amdgpu::RawBufferAtomicFmaxOp,
|
|
::mlir::amdgpu::RawBufferAtomicSmaxOp,
|
|
::mlir::amdgpu::RawBufferAtomicUminOp,
|
|
::mlir::amdgpu::RawBufferLoadOp,
|
|
::mlir::amdgpu::RawBufferStoreOp,
|
|
::mlir::amdgpu::ScaledExtPackedMatrixOp,
|
|
::mlir::amdgpu::ScaledExtPackedOp,
|
|
::mlir::amdgpu::ScaledMFMAOp,
|
|
::mlir::amdgpu::ScaledWMMAOp,
|
|
::mlir::amdgpu::SchedBarrierOp,
|
|
::mlir::amdgpu::SparseMFMAOp,
|
|
::mlir::amdgpu::SparseWMMAOp,
|
|
::mlir::amdgpu::SwizzleBitModeOp,
|
|
::mlir::amdgpu::TensorLoadToLDSOp,
|
|
::mlir::amdgpu::TensorStoreFromLDSOp,
|
|
::mlir::amdgpu::TransposeLoadOp,
|
|
::mlir::amdgpu::WMMAOp
|
|
#endif // GET_OP_LIST
|
|
|
|
#ifdef GET_OP_CLASSES
|
|
#undef GET_OP_CLASSES
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Local Utility Method Definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU1(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isIntOrFloat() && type.getIntOrFloatBitWidth() <= 64)) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isIntOrFloat() && elementType.getIntOrFloatBitWidth() <= 64); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank()
|
|
== 1)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be integer or float with element bitwidth <= 64 or fixed-length vector of integer or float with element bitwidth <= 64 values of ranks 1, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU2(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(!((::llvm::isa<::mlir::TokenType>(type))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be any non-token type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU3(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((elementType.isSignlessInteger(16))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(4)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 16-bit float or bfloat16 type or 16-bit signless integer values of length 2 or vector of 8-bit signless integer or f8E4M3FN type or f8E5M2 type values of length 4 or vector of 4-bit signless integer values of length 8, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU4(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isF32())) || ((type.isF16())) || ((::llvm::isa<::mlir::BFloat16Type>(type))) || ((type.isSignlessInteger(32))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 32-bit float or 16-bit float or bfloat16 type or 32-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU5(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::amdgpu::DsBarrierStateType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be memref of State of an in-LDS barrier. values, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU6(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::IndexType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of index, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU7(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger(64)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 64-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU8(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::amdgpu::DsBarrierStateType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be State of an in-LDS barrier., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU9(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger(32)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 32-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU10(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger(1)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 1-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU11(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::llvm::isa<::mlir::Float8E5M2FNUZType>(type))) || ((::llvm::isa<::mlir::Float8E4M3FNUZType>(type))) || ((::llvm::isa<::mlir::Float8E5M2Type>(type))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(type))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 1)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be f8E5M2FNUZ type or f8E4M3FNUZ type or f8E5M2 type or f8E4M3FN type or vector of f8E5M2FNUZ type or f8E4M3FNUZ type or f8E5M2 type or f8E4M3FN type values of length 1/2/3/4, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU12(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isF32())) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 32-bit float or fixed-length vector of 32-bit float values of length 2, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU13(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::llvm::isa<::mlir::MemRefType>(type))) && ([](::mlir::Type elementType) { return !((::llvm::isa<::mlir::TokenType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be memref of any non-token type values, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU14(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger(14)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 14-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU15(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger(64)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of 64-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU16(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((elementType.isF16())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))) || ((elementType.isSignlessInteger(16))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)))) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(4))) || ((::llvm::isa<::mlir::Float4E2M1FNType>(elementType))) || ((elementType.isSignlessInteger(6))) || ((::llvm::isa<::mlir::Float6E2M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float6E3M2FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be fixed-length vector of 8-bit signless integer or f8E5M2FNUZ type or f8E4M3FNUZ type or f8E5M2 type or f8E4M3FN type or 16-bit float or bfloat16 type or 16-bit signless integer values of length 8 or fixed-length vector of 4-bit signless integer or f4E2M1FN type or 6-bit signless integer or f6E2M3FN type or f6E3M2FN type values of length 16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU17(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isF32())) || ((type.isF64())) || ((type.isSignlessInteger(32))) || ((type.isSignlessInteger(64))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float6E2M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float6E3M2FNType>(elementType))) || ((::llvm::isa<::mlir::Float4E2M1FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 32-bit float or 64-bit float or 32-bit signless integer or 64-bit signless integer or vector of 32-bit float values of length 2 or vector of 16-bit float values of length 4/8 or vector of bfloat16 type values of length 2/4/8 or vector of 8-bit signless integer values of length 4/8/16 or vector of f8E5M2FNUZ type or f8E4M3FNUZ type values of length 8 or vector of f8E5M2 type or f8E4M3FN type values of length 8/32 or vector of f6E2M3FN type or f6E3M2FN type or f4E2M1FN type values of length 32, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU18(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isF64())) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF64()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 64-bit float or vector of 32-bit float values of length 4/16/32 or vector of 32-bit signless integer values of length 4/16/32 or vector of 64-bit float values of length 4, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU19(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::amdgpu::TDMBaseType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be Pair of base addresses that move data between LDS and global storage., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU20(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be fixed-length vector of 1-bit signless integer values of length 16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU21(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::IndexType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be index, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU22(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::amdgpu::TDMDescriptorType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be Descriptors used in tensor store/load operations., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU23(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::amdgpu::TDMGatherBaseType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be Pair of base addresses that move data between LDS and global storage., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU24(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() >= 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() <= 8)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(16)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() >= 1))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements() <= 16)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit signless integer values of at least length 1 of at most length 8 or vector of 16-bit signless integer values of at least length 1 of at most length 16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU25(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF32())) || ((elementType.isF16())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 1)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit float or 16-bit float or bfloat16 type values of length 1/2, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU26(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isF32()))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 32-bit float, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU27(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)))) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float4E2M1FNType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be fixed-length vector of f8E5M2 type or f8E4M3FN type values of length 4 or fixed-length vector of f4E2M1FN type values of length 8, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU28(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be fixed-length vector of f8E4M3FNUZ type or f8E5M2FNUZ type or f8E4M3FN type or f8E5M2 type values of length 4, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU29(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((type.isSignlessInteger())) || ((::llvm::isa<::mlir::FloatType>(type)))) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((::llvm::isa<::mlir::FloatType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getRank()
|
|
== 1)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be Integer or Float or fixed-length vector of Integer or Float values of ranks 1, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU30(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((type.isSignlessInteger(32)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of 32-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU31(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isF32())) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 32-bit float or vector of 16-bit float or bfloat16 type values of length 2, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU32(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((type.isF32())) || ((type.isF64())))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be 32-bit float or 64-bit float, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU33(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({8}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float4E2M1FNType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({8}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float8E4M3FNType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({8}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float8E5M2Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({16}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float6E2M3FNType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({16}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float6E3M2FNType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector<8xF4E2M1FN> of f4E2M1FN type values or vector<8xF8E4M3FN> of f8E4M3FN type values or vector<8xF8E5M2> of f8E5M2 type values or vector<16xF6E2M3FN> of f6E2M3FN type values or vector<16xF6E3M2FN> of f6E3M2FN type values, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU34(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({4}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float8E8M0FNUType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector<4xF8E8M0FNU> of f8E8M0FNU type values, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU35(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({8}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({8}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({8}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({16}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({16}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) || ((((::llvm::cast<::mlir::VectorType>(type).getShape() == ::llvm::ArrayRef<int64_t>({16}))) && ((::llvm::isa<::mlir::FixedVectorType>(type)))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector<8xF32> of 32-bit float values or vector<8xF16> of 16-bit float values or vector<8xBF16> of bfloat16 type values or vector<16xF32> of 32-bit float values or vector<16xF16> of 16-bit float values or vector<16xBF16> of bfloat16 type values, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU36(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 1)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float4E2M1FNType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 1)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 3)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 5)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 6)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 7)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of f8E5M2 type or f8E4M3FN type values of length 1/2/3/4 or vector of f4E2M1FN type values of length 1/2/3/4/5/6/7/8, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU37(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be fixed-length vector of 32-bit float values of length 2 or fixed-length vector of 16-bit float values of length 2 or fixed-length vector of bfloat16 type values of length 2, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU38(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float6E2M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float6E3M2FNType>(elementType))) || ((::llvm::isa<::mlir::Float4E2M1FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of f8E5M2 type or f8E4M3FN type values of length 32 or vector of f6E2M3FN type or f6E3M2FN type or f4E2M1FN type values of length 32, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU39(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit float values of length 4/16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU40(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::llvm::isa<::mlir::Float8E8M0FNUType>(type))) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float8E8M0FNUType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be f8E8M0FNU type or fixed-length vector of f8E8M0FNU type values of length 4, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU41(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float6E2M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float6E3M2FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 64)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::Float4E2M1FNType>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 64)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 128))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of f8E5M2 type or f8E4M3FN type values of length 64 or vector of f6E2M3FN type or f6E3M2FN type values of length 64 or vector of f4E2M1FN type values of length 64/128, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU42(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit float values of length 8/16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU43(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E8M0FNUType>(elementType))) || ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of f8E8M0FNU type or f8E4M3FN type values of length 4/8, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU44(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 16-bit float values of length 4/8 or vector of bfloat16 type values of length 4/8 or vector of 8-bit signless integer values of length 8/16 or vector of f8E4M3FN type or f8E5M2 type values of length 8/16 or vector of f8E4M3FNUZ type or f8E5M2FNUZ type values of length 8/16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU45(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 16-bit float values of length 8/16 or vector of bfloat16 type values of length 8/16 or vector of 8-bit signless integer values of length 16/32 or vector of f8E4M3FN type or f8E5M2 type values of length 16/32 or vector of f8E4M3FNUZ type or f8E5M2FNUZ type values of length 16/32, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU46(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit float values of length 4/16 or vector of 32-bit signless integer values of length 4/16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU47(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)))) || ((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(16)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))) || ((type.isSignlessInteger(32))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be fixed-length vector of 8-bit signless integer values of length 4 or fixed-length vector of 16-bit signless integer values of length 2 or 32-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU48(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(4)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 16-bit float values of length 4/8/16 or vector of bfloat16 type values of length 4/8/16 or vector of 8-bit signless integer values of length 4/8/32 or vector of 4-bit signless integer values of length 8/16 or vector of f8E4M3FN type or f8E5M2 type values of length 4/8/16/32 or vector of f8E4M3FNUZ type or f8E5M2FNUZ type values of length 4/8/16/32, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU49(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 64))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(4)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 64))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNUZType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2FNUZType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 64))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 16-bit float values of length 8/16/32 or vector of bfloat16 type values of length 8/16/32 or vector of 8-bit signless integer values of length 4/8/16/64 or vector of 4-bit signless integer values of length 8/16/32 or vector of f8E4M3FN type or f8E5M2 type values of length 4/8/16/64 or vector of f8E4M3FNUZ type or f8E5M2FNUZ type values of length 4/8/16/64, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU50(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF16()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (::llvm::isa<::mlir::BFloat16Type>(elementType)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(32)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit float values of length 4/8/16 or vector of 16-bit float values of length 4/8 or vector of bfloat16 type values of length 4/8 or vector of 32-bit signless integer values of length 4/8, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU51(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((::llvm::isa<::mlir::FixedVectorType>(type))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(8)); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && (((::llvm::isa<::mlir::FixedVectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be fixed-length vector of 8-bit signless integer values of length 4, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU52(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return !((::llvm::isa<::mlir::TokenType>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of any non-token type values, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU53(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isF32()); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 2)))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(8))) || ((elementType.isSignedInteger(8))) || ((elementType.isUnsignedInteger(8))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::Float8E4M3FNType>(elementType))) || ((::llvm::isa<::mlir::Float8E5M2Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 32)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 64))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger(4))) || ((elementType.isSignedInteger(4))) || ((elementType.isUnsignedInteger(4))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit float values of length 2 or vector of 16-bit float or bfloat16 type values of length 4/8/16 or vector of 8-bit signless integer or 8-bit signed integer or 8-bit unsigned integer values of length 4/8/16/32 or vector of f8E4M3FN type or f8E5M2 type values of length 4/8/32/64 or vector of 4-bit signless integer or 4-bit signed integer or 4-bit unsigned integer values of length 4/8/16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_AMDGPU54(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF32())) || ((elementType.isSignlessInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8))))) || (((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && ([](::mlir::Type elementType) { return ((elementType.isF16())) || ((::llvm::isa<::mlir::BFloat16Type>(elementType))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType()))) && ((((::llvm::isa<::mlir::VectorType>(type))) && ((::llvm::cast<::mlir::VectorType>(type).getRank() > 0))) && (((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 4)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 8)) || ((::llvm::cast<::mlir::VectorType>(type).getNumElements()
|
|
== 16))))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be vector of 32-bit float or 32-bit signless integer values of length 4/8 or vector of 16-bit float or bfloat16 type values of length 4/8/16, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU1(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::amdgpu::DPPPermAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: The possible permutations for a DPP operation";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU1(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU1(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU2(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) || ((::llvm::isa<::mlir::ArrayAttr>(attr))) || ((::llvm::isa<::mlir::UnitAttr>(attr)))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute or array attribute or unit attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU2(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU2(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU3(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU3(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU3(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU4(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::BoolAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: bool attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU4(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU4(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU5(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: unit attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU5(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU5(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU6(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 3))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU6(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU6(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU7(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: any type attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU7(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU7(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU8(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::amdgpu::LoadTemporalHintAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: AMDGPU-specific prefetch temporal hints for load instructions. RT - regular temporal for both near and far caches; NT - non-temporal for both near and far caches; HT - high-priority temporal for both near and far caches; LU - last-use; NT_RT - non-temporal for near cache(s) and regular for far caches; RT_NT - regular for near cache(s) and non-temporal for far caches; NT_HT - non-temporal for near cache(s) and high-priority temporal for far caches";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU8(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU8(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU9(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::amdgpu::ScopeAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: AMDGPU-specific cache scopes. WGP - workgroup processor (CUs); SE - shader engine (GL2); DEV - device; SYS - system";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU9(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU9(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU10(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({4, 16, 32}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {4, 16, 32}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU10(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU10(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU11(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({1, 2, 4, 8, 16, 32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {1, 2, 4, 8, 16, 32, 64, 128}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU11(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU11(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU12(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({1, 2, 4, 16}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {1, 2, 4, 16}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU12(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU12(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU13(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::ROCDL::MFMAPermBAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: permutations of the lanes storing B in an MFMA";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU13(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU13(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU14(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: i64 dense array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU14(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU14(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU15(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 7))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 7";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU15(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU15(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU16(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(attr).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 1))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 1";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU16(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU16(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU17(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU17(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU17(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU18(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({0, 16}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {0, 16}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU18(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU18(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU19(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getInt() <= 3))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU19(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU19(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU20(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({64, 128}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {64, 128}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU20(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU20(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU21(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU21(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU21(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU22(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({128}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {128}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU22(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU22(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU23(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::ROCDL::SchedGroupMaskAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: instruction type mask for scheduling barriers";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU23(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU23(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU24(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32, 64, 128}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU24(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU24(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU25(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {32, 64, 128}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU25(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU25(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU26(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({4, 16, 32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {4, 16, 32, 64, 128}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU26(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU26(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU27(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({0, 1}, ::llvm::cast<::mlir::IntegerAttr>(attr).getInt())))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {0, 1}";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_AMDGPU27(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_AMDGPU27(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DPPOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DPPOpGenericAdaptorBase::DPPOpGenericAdaptorBase(DPPOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::amdgpu::DPPPerm DPPOpGenericAdaptorBase::getKind() {
|
|
auto attr = getKindAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<::mlir::Attribute> DPPOpGenericAdaptorBase::getPermArgument() {
|
|
auto attr = getPermArgumentAttr();
|
|
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
::mlir::IntegerAttr DPPOpGenericAdaptorBase::getRowMaskAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().row_mask);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t DPPOpGenericAdaptorBase::getRowMask() {
|
|
auto attr = getRowMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::IntegerAttr DPPOpGenericAdaptorBase::getBankMaskAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().bank_mask);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t DPPOpGenericAdaptorBase::getBankMask() {
|
|
auto attr = getBankMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::BoolAttr DPPOpGenericAdaptorBase::getBoundCtrlAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().bound_ctrl);
|
|
return attr;
|
|
}
|
|
|
|
bool DPPOpGenericAdaptorBase::getBoundCtrl() {
|
|
auto attr = getBoundCtrlAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
DPPOpAdaptor::DPPOpAdaptor(DPPOp op) : DPPOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DPPOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_bank_mask = getProperties().bank_mask; (void)tblgen_bank_mask;
|
|
auto tblgen_bound_ctrl = getProperties().bound_ctrl; (void)tblgen_bound_ctrl;
|
|
auto tblgen_kind = getProperties().kind; (void)tblgen_kind;
|
|
if (!tblgen_kind) return emitError(loc, "'amdgpu.dpp' op requires attribute 'kind'");
|
|
auto tblgen_permArgument = getProperties().permArgument; (void)tblgen_permArgument;
|
|
auto tblgen_row_mask = getProperties().row_mask; (void)tblgen_row_mask;
|
|
|
|
if (tblgen_kind && !((::llvm::isa<::mlir::amdgpu::DPPPermAttr>(tblgen_kind))))
|
|
return emitError(loc, "'amdgpu.dpp' op attribute 'kind' failed to satisfy constraint: The possible permutations for a DPP operation");
|
|
|
|
if (tblgen_permArgument && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_permArgument))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_permArgument).getType().isSignlessInteger(32)))) || ((::llvm::isa<::mlir::ArrayAttr>(tblgen_permArgument))) || ((::llvm::isa<::mlir::UnitAttr>(tblgen_permArgument)))))
|
|
return emitError(loc, "'amdgpu.dpp' op attribute 'permArgument' failed to satisfy constraint: 32-bit signless integer attribute or array attribute or unit attribute");
|
|
|
|
if (tblgen_row_mask && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_row_mask))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_row_mask).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.dpp' op attribute 'row_mask' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_bank_mask && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_bank_mask))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_bank_mask).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.dpp' op attribute 'bank_mask' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_bound_ctrl && !((::llvm::isa<::mlir::BoolAttr>(tblgen_bound_ctrl))))
|
|
return emitError(loc, "'amdgpu.dpp' op attribute 'bound_ctrl' failed to satisfy constraint: bool attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DPPOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.bank_mask;
|
|
auto attr = dict.get("bank_mask");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `bank_mask` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.bound_ctrl;
|
|
auto attr = dict.get("bound_ctrl");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `bound_ctrl` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.kind;
|
|
auto attr = dict.get("kind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `kind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.permArgument;
|
|
auto attr = dict.get("permArgument");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `permArgument` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.row_mask;
|
|
auto attr = dict.get("row_mask");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `row_mask` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DPPOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.bank_mask;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("bank_mask",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.bound_ctrl;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("bound_ctrl",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.kind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("kind",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.permArgument;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("permArgument",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.row_mask;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("row_mask",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DPPOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.bank_mask.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.bound_ctrl.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.kind.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.permArgument.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.row_mask.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DPPOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "bank_mask")
|
|
return prop.bank_mask;
|
|
|
|
if (name == "bound_ctrl")
|
|
return prop.bound_ctrl;
|
|
|
|
if (name == "kind")
|
|
return prop.kind;
|
|
|
|
if (name == "permArgument")
|
|
return prop.permArgument;
|
|
|
|
if (name == "row_mask")
|
|
return prop.row_mask;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DPPOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "bank_mask") {
|
|
prop.bank_mask = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.bank_mask)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "bound_ctrl") {
|
|
prop.bound_ctrl = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.bound_ctrl)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "kind") {
|
|
prop.kind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.kind)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "permArgument") {
|
|
prop.permArgument = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.permArgument)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "row_mask") {
|
|
prop.row_mask = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.row_mask)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void DPPOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.bank_mask) attrs.append("bank_mask", prop.bank_mask);
|
|
|
|
if (prop.bound_ctrl) attrs.append("bound_ctrl", prop.bound_ctrl);
|
|
|
|
if (prop.kind) attrs.append("kind", prop.kind);
|
|
|
|
if (prop.permArgument) attrs.append("permArgument", prop.permArgument);
|
|
|
|
if (prop.row_mask) attrs.append("row_mask", prop.row_mask);
|
|
}
|
|
|
|
::llvm::LogicalResult DPPOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBankMaskAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "bank_mask", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundCtrlAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "bound_ctrl", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getKindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(attr, "kind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPermArgumentAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU2(attr, "permArgument", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getRowMaskAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "row_mask", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DPPOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.bank_mask)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.bound_ctrl)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.kind)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.permArgument)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.row_mask)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DPPOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.bank_mask);
|
|
|
|
writer.writeOptionalAttribute(prop.bound_ctrl);
|
|
writer.writeAttribute(prop.kind);
|
|
|
|
writer.writeOptionalAttribute(prop.permArgument);
|
|
|
|
writer.writeOptionalAttribute(prop.row_mask);
|
|
}
|
|
|
|
::mlir::amdgpu::DPPPerm DPPOp::getKind() {
|
|
auto attr = getKindAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<::mlir::Attribute> DPPOp::getPermArgument() {
|
|
auto attr = getPermArgumentAttr();
|
|
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
|
|
}
|
|
|
|
uint32_t DPPOp::getRowMask() {
|
|
auto attr = getRowMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t DPPOp::getBankMask() {
|
|
auto attr = getBankMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
bool DPPOp::getBoundCtrl() {
|
|
auto attr = getBoundCtrlAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void DPPOp::setKind(::mlir::amdgpu::DPPPerm attrValue) {
|
|
getProperties().kind = ::mlir::amdgpu::DPPPermAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void DPPOp::setRowMask(uint32_t attrValue) {
|
|
getProperties().row_mask = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void DPPOp::setBankMask(uint32_t attrValue) {
|
|
getProperties().bank_mask = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void DPPOp::setBoundCtrl(bool attrValue) {
|
|
getProperties().bound_ctrl = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(old);
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().kind = kind;
|
|
if (permArgument) {
|
|
odsState.getOrAddProperties<Properties>().permArgument = permArgument;
|
|
}
|
|
if (row_mask) {
|
|
odsState.getOrAddProperties<Properties>().row_mask = row_mask;
|
|
}
|
|
if (bank_mask) {
|
|
odsState.getOrAddProperties<Properties>().bank_mask = bank_mask;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(old);
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().kind = kind;
|
|
if (permArgument) {
|
|
odsState.getOrAddProperties<Properties>().permArgument = permArgument;
|
|
}
|
|
if (row_mask) {
|
|
odsState.getOrAddProperties<Properties>().row_mask = row_mask;
|
|
}
|
|
if (bank_mask) {
|
|
odsState.getOrAddProperties<Properties>().bank_mask = bank_mask;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DPPOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(old);
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().kind = kind;
|
|
if (permArgument) {
|
|
odsState.getOrAddProperties<Properties>().permArgument = permArgument;
|
|
}
|
|
if (row_mask) {
|
|
odsState.getOrAddProperties<Properties>().row_mask = row_mask;
|
|
}
|
|
if (bank_mask) {
|
|
odsState.getOrAddProperties<Properties>().bank_mask = bank_mask;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPermAttr kind, /*optional*/::mlir::Attribute permArgument, ::mlir::IntegerAttr row_mask, ::mlir::IntegerAttr bank_mask, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
odsState.addOperands(old);
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().kind = ::mlir::amdgpu::DPPPermAttr::get(odsBuilder.getContext(), kind);
|
|
if (permArgument) {
|
|
odsState.getOrAddProperties<Properties>().permArgument = permArgument;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().row_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), row_mask);
|
|
odsState.getOrAddProperties<Properties>().bank_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), bank_mask);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
odsState.addOperands(old);
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().kind = ::mlir::amdgpu::DPPPermAttr::get(odsBuilder.getContext(), kind);
|
|
if (permArgument) {
|
|
odsState.getOrAddProperties<Properties>().permArgument = permArgument;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().row_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), row_mask);
|
|
odsState.getOrAddProperties<Properties>().bank_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), bank_mask);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DPPOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
odsState.addOperands(old);
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().kind = ::mlir::amdgpu::DPPPermAttr::get(odsBuilder.getContext(), kind);
|
|
if (permArgument) {
|
|
odsState.getOrAddProperties<Properties>().permArgument = permArgument;
|
|
}
|
|
odsState.getOrAddProperties<Properties>().row_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), row_mask);
|
|
odsState.getOrAddProperties<Properties>().bank_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), bank_mask);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value old, ::mlir::Value src, ::mlir::amdgpu::DPPPerm kind, /*optional*/::mlir::Attribute permArgument, uint32_t row_mask, uint32_t bank_mask, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(old)>(old), std::forward<decltype(src)>(src), std::forward<decltype(kind)>(kind), std::forward<decltype(permArgument)>(permArgument), std::forward<decltype(row_mask)>(row_mask), std::forward<decltype(bank_mask)>(bank_mask), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<DPPOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<DPPOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DPPOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DPPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DPPOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DPPOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DPPOp DPPOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DPPOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.row_mask)
|
|
properties.row_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0xf);
|
|
if (!properties.bank_mask)
|
|
properties.bank_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0xf);
|
|
if (!properties.bound_ctrl)
|
|
properties.bound_ctrl = odsBuilder.getBoolAttr(false);
|
|
}
|
|
|
|
::llvm::LogicalResult DPPOp::verifyInvariantsImpl() {
|
|
auto tblgen_bank_mask = getProperties().bank_mask; (void)tblgen_bank_mask;
|
|
auto tblgen_bound_ctrl = getProperties().bound_ctrl; (void)tblgen_bound_ctrl;
|
|
auto tblgen_kind = getProperties().kind; (void)tblgen_kind;
|
|
if (!tblgen_kind) return emitOpError("requires attribute 'kind'");
|
|
auto tblgen_permArgument = getProperties().permArgument; (void)tblgen_permArgument;
|
|
auto tblgen_row_mask = getProperties().row_mask; (void)tblgen_row_mask;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU1(*this, tblgen_kind, "kind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU2(*this, tblgen_permArgument, "permArgument")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_row_mask, "row_mask")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_bank_mask, "bank_mask")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_bound_ctrl, "bound_ctrl")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU1(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {result, old, src} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DPPOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult DPPOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 1)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[1].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DPPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand oldRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> oldOperands(&oldRawOperand, 1); ::llvm::SMLoc oldOperandsLoc;
|
|
(void)oldOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::mlir::amdgpu::DPPPermAttr kindAttr;
|
|
::mlir::Attribute permArgumentAttr;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
oldOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(oldRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(kindAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (kindAttr) result.getOrAddProperties<DPPOp::Properties>().kind = kindAttr;
|
|
if (::mlir::succeeded(parser.parseOptionalLParen())) {
|
|
|
|
if (parser.parseAttribute(permArgumentAttr, ::mlir::Type{}))
|
|
return ::mlir::failure();
|
|
if (permArgumentAttr) result.getOrAddProperties<DPPOp::Properties>().permArgument = permArgumentAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(oldOperands, resultTypes[0], oldOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(srcOperands, resultTypes[0], srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DPPOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOld();
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getKindAttr());
|
|
if (getPermArgumentAttr()) {
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttribute(getPermArgumentAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("kind");
|
|
elidedAttrs.push_back("permArgument");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getRowMaskAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0xf)))
|
|
elidedAttrs.push_back("row_mask");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBankMaskAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0xf)))
|
|
elidedAttrs.push_back("bank_mask");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundCtrlAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(false)))
|
|
elidedAttrs.push_back("bound_ctrl");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DPPOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DPPOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::DPPOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DotOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DotOpGenericAdaptorBase::DotOpGenericAdaptorBase(DotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::UnitAttr DotOpGenericAdaptorBase::getUnsignedAAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedA);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool DotOpGenericAdaptorBase::getUnsignedA() {
|
|
auto attr = getUnsignedAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr DotOpGenericAdaptorBase::getUnsignedBAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedB);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool DotOpGenericAdaptorBase::getUnsignedB() {
|
|
auto attr = getUnsignedBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr DotOpGenericAdaptorBase::getClampAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().clamp);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool DotOpGenericAdaptorBase::getClamp() {
|
|
auto attr = getClampAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
DotOpAdaptor::DotOpAdaptor(DotOp op) : DotOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DotOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp;
|
|
auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA;
|
|
auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB;
|
|
|
|
if (tblgen_unsignedA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedA))))
|
|
return emitError(loc, "'amdgpu.dot' op attribute 'unsignedA' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_unsignedB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedB))))
|
|
return emitError(loc, "'amdgpu.dot' op attribute 'unsignedB' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_clamp && !((::llvm::isa<::mlir::UnitAttr>(tblgen_clamp))))
|
|
return emitError(loc, "'amdgpu.dot' op attribute 'clamp' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DotOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.clamp;
|
|
auto attr = dict.get("clamp");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `clamp` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unsignedA;
|
|
auto attr = dict.get("unsignedA");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unsignedA` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unsignedB;
|
|
auto attr = dict.get("unsignedB");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unsignedB` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.clamp;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("clamp",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unsignedA;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unsignedA",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unsignedB;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unsignedB",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DotOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.clamp.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unsignedA.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unsignedB.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "clamp")
|
|
return prop.clamp;
|
|
|
|
if (name == "unsignedA")
|
|
return prop.unsignedA;
|
|
|
|
if (name == "unsignedB")
|
|
return prop.unsignedB;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "clamp") {
|
|
prop.clamp = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.clamp)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unsignedA") {
|
|
prop.unsignedA = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unsignedA)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unsignedB") {
|
|
prop.unsignedB = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unsignedB)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void DotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.clamp) attrs.append("clamp", prop.clamp);
|
|
|
|
if (prop.unsignedA) attrs.append("unsignedA", prop.unsignedA);
|
|
|
|
if (prop.unsignedB) attrs.append("unsignedB", prop.unsignedB);
|
|
}
|
|
|
|
::llvm::LogicalResult DotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getClampAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "clamp", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnsignedAAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "unsignedA", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnsignedBAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "unsignedB", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DotOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.clamp)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedA)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedB)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DotOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.clamp);
|
|
|
|
writer.writeOptionalAttribute(prop.unsignedA);
|
|
|
|
writer.writeOptionalAttribute(prop.unsignedB);
|
|
}
|
|
|
|
bool DotOp::getUnsignedA() {
|
|
auto attr = getUnsignedAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool DotOp::getUnsignedB() {
|
|
auto attr = getUnsignedBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool DotOp::getClamp() {
|
|
auto attr = getClampAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void DotOp::setUnsignedA(bool attrValue) {
|
|
auto &odsProp = getProperties().unsignedA;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void DotOp::setUnsignedB(bool attrValue) {
|
|
auto &odsProp = getProperties().unsignedB;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void DotOp::setClamp(bool attrValue) {
|
|
auto &odsProp = getProperties().clamp;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DotOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DotOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<DotOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<DotOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DotOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DotOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DotOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DotOp DotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DotOp::verifyInvariantsImpl() {
|
|
auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp;
|
|
auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA;
|
|
auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_unsignedA, "unsignedA")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_unsignedB, "unsignedB")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_clamp, "clamp")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {destC, destD} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DotOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult DotOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(&sourceBRawOperand, 1); ::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand destCRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(&destCRawOperand, 1); ::llvm::SMLoc destCOperandsLoc;
|
|
(void)destCOperandsLoc;
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type sourceBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceBTypes(&sourceBRawType, 1);
|
|
::mlir::Type destCRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> destCTypes(&destCRawType, 1);
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
destCOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(destCRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
destCRawType = type;
|
|
}
|
|
result.addTypes(destCTypes[0]);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DotOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceB();
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestC();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getUnsignedAAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("unsignedA");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getUnsignedBAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("unsignedB");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getClampAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("clamp");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDestC().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DotOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DotOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::DotOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsAsyncBarrierArriveOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsAsyncBarrierArriveOpGenericAdaptorBase::DsAsyncBarrierArriveOpGenericAdaptorBase(DsAsyncBarrierArriveOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> DsAsyncBarrierArriveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
DsAsyncBarrierArriveOpAdaptor::DsAsyncBarrierArriveOpAdaptor(DsAsyncBarrierArriveOp op) : DsAsyncBarrierArriveOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsAsyncBarrierArriveOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> DsAsyncBarrierArriveOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange DsAsyncBarrierArriveOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult DsAsyncBarrierArriveOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsAsyncBarrierArriveOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsAsyncBarrierArriveOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsAsyncBarrierArriveOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsAsyncBarrierArriveOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
auto __res__ = ::llvm::dyn_cast<DsAsyncBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
auto __res__ = ::llvm::dyn_cast<DsAsyncBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsAsyncBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsAsyncBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsAsyncBarrierArriveOp DsAsyncBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsAsyncBarrierArriveOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsAsyncBarrierArriveOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult DsAsyncBarrierArriveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand baseRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(&baseRawOperand, 1); ::llvm::SMLoc baseOperandsLoc;
|
|
(void)baseOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::mlir::Type baseRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1);
|
|
|
|
baseOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(baseRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
baseRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getBase().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsAsyncBarrierArriveOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsAsyncBarrierArriveOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsBarrierArriveOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsBarrierArriveOpGenericAdaptorBase::DsBarrierArriveOpGenericAdaptorBase(DsBarrierArriveOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> DsBarrierArriveOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true, false};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
DsBarrierArriveOpAdaptor::DsBarrierArriveOpAdaptor(DsBarrierArriveOp op) : DsBarrierArriveOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsBarrierArriveOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> DsBarrierArriveOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true, false};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange DsBarrierArriveOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierArriveOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsBarrierArriveOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsBarrierArriveOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsBarrierArriveOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsBarrierArriveOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsBarrierArriveOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierArriveOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(count);
|
|
odsState.addTypes(out);
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type out, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(out)>(out), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(count)>(count));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type out, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(out)>(out), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(count)>(count));
|
|
}
|
|
|
|
void DsBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(count);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierArriveOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(count)>(count));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(count)>(count));
|
|
}
|
|
|
|
void DsBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(count);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(count)>(count));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(count)>(count));
|
|
}
|
|
|
|
void DsBarrierArriveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierArriveOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierArriveOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DsBarrierArriveOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierArriveOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierArriveOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierArriveOp DsBarrierArriveOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierArriveOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU7(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierArriveOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierArriveOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::amdgpu::DsBarrierStateType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DsBarrierArriveOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand baseRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(&baseRawOperand, 1); ::llvm::SMLoc baseOperandsLoc;
|
|
(void)baseOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand countRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> countOperands(&countRawOperand, 1); ::llvm::SMLoc countOperandsLoc;
|
|
(void)countOperandsLoc;
|
|
::mlir::Type baseRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1);
|
|
::mlir::Type countRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> countTypes(&countRawType, 1);
|
|
::mlir::Type outRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> outTypes(&outRawType, 1);
|
|
|
|
baseOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(baseRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
countOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(countRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
baseRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
countRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::amdgpu::DsBarrierStateType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
outRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
result.addTypes(outTypes);
|
|
if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(countOperands, countTypes, countOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierArriveOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getCount();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getBase().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getCount().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getOut().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::amdgpu::DsBarrierStateType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsBarrierArriveOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsBarrierArriveOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsBarrierInitOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsBarrierInitOpGenericAdaptorBase::DsBarrierInitOpGenericAdaptorBase(DsBarrierInitOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> DsBarrierInitOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true, false};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
DsBarrierInitOpAdaptor::DsBarrierInitOpAdaptor(DsBarrierInitOp op) : DsBarrierInitOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsBarrierInitOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> DsBarrierInitOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true, false};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange DsBarrierInitOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierInitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsBarrierInitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsBarrierInitOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsBarrierInitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsBarrierInitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsBarrierInitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierInitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierInitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value participants) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(participants);
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value participants) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(participants)>(participants));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierInitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value participants) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(participants)>(participants));
|
|
}
|
|
|
|
void DsBarrierInitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value participants) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(participants);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value participants) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(participants)>(participants));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierInitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices, ::mlir::Value participants) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(participants)>(participants));
|
|
}
|
|
|
|
void DsBarrierInitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierInitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierInitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierInitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierInitOp DsBarrierInitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierInitOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierInitOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult DsBarrierInitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand baseRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(&baseRawOperand, 1); ::llvm::SMLoc baseOperandsLoc;
|
|
(void)baseOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand participantsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> participantsOperands(&participantsRawOperand, 1); ::llvm::SMLoc participantsOperandsLoc;
|
|
(void)participantsOperandsLoc;
|
|
::mlir::Type baseRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1);
|
|
::mlir::Type participantsRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> participantsTypes(&participantsRawType, 1);
|
|
|
|
baseOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(baseRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
participantsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(participantsRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
baseRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
participantsRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(participantsOperands, participantsTypes, participantsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierInitOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getParticipants();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getBase().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getParticipants().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsBarrierInitOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsBarrierInitOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsBarrierPollStateOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsBarrierPollStateOpGenericAdaptorBase::DsBarrierPollStateOpGenericAdaptorBase(DsBarrierPollStateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> DsBarrierPollStateOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
DsBarrierPollStateOpAdaptor::DsBarrierPollStateOpAdaptor(DsBarrierPollStateOp op) : DsBarrierPollStateOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsBarrierPollStateOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> DsBarrierPollStateOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange DsBarrierPollStateOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierPollStateOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsBarrierPollStateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsBarrierPollStateOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsBarrierPollStateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsBarrierPollStateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsBarrierPollStateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierPollStateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierPollStateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addTypes(out);
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type out, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(out)>(out), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierPollStateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type out, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(out)>(out), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
}
|
|
|
|
void DsBarrierPollStateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierPollStateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierPollStateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
}
|
|
|
|
void DsBarrierPollStateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierPollStateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices));
|
|
}
|
|
|
|
void DsBarrierPollStateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierPollStateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierPollStateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierPollStateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierPollStateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierPollStateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierPollStateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DsBarrierPollStateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierPollStateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierPollStateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierPollStateOp DsBarrierPollStateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierPollStateOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierPollStateOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierPollStateOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::amdgpu::DsBarrierStateType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DsBarrierPollStateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand baseRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(&baseRawOperand, 1); ::llvm::SMLoc baseOperandsLoc;
|
|
(void)baseOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::mlir::Type baseRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1);
|
|
::mlir::Type outRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> outTypes(&outRawType, 1);
|
|
|
|
baseOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(baseRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
baseRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::amdgpu::DsBarrierStateType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
outRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
result.addTypes(outTypes);
|
|
if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierPollStateOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getBase().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getOut().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::amdgpu::DsBarrierStateType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsBarrierPollStateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsBarrierPollStateOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsBarrierStateInitCountOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsBarrierStateInitCountOpGenericAdaptorBase::DsBarrierStateInitCountOpGenericAdaptorBase(DsBarrierStateInitCountOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
DsBarrierStateInitCountOpAdaptor::DsBarrierStateInitCountOpAdaptor(DsBarrierStateInitCountOp op) : DsBarrierStateInitCountOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsBarrierStateInitCountOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStateInitCountOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsBarrierStateInitCountOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsBarrierStateInitCountOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsBarrierStateInitCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStateInitCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStateInitCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStateInitCountOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStateInitCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStateInitCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStateInitCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStateInitCountOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStateInitCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStateInitCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStateInitCountOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStateInitCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStateInitCountOp DsBarrierStateInitCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStateInitCountOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStateInitCountOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStateInitCountOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DsBarrierStateInitCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand stateRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stateOperands(&stateRawOperand, 1); ::llvm::SMLoc stateOperandsLoc;
|
|
(void)stateOperandsLoc;
|
|
::mlir::Type stateRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> stateTypes(&stateRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
stateOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(stateRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::amdgpu::DsBarrierStateType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
stateRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(stateOperands, stateTypes, stateOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getState();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getState().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::amdgpu::DsBarrierStateType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsBarrierStateInitCountOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsBarrierStateInitCountOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsBarrierStatePendingCountOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsBarrierStatePendingCountOpGenericAdaptorBase::DsBarrierStatePendingCountOpGenericAdaptorBase(DsBarrierStatePendingCountOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
DsBarrierStatePendingCountOpAdaptor::DsBarrierStatePendingCountOpAdaptor(DsBarrierStatePendingCountOp op) : DsBarrierStatePendingCountOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePendingCountOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePendingCountOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsBarrierStatePendingCountOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsBarrierStatePendingCountOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsBarrierStatePendingCountOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePendingCountOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePendingCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePendingCountOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePendingCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePendingCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePendingCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePendingCountOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePendingCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePendingCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePendingCountOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePendingCountOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePendingCountOp DsBarrierStatePendingCountOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePendingCountOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePendingCountOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePendingCountOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DsBarrierStatePendingCountOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand stateRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stateOperands(&stateRawOperand, 1); ::llvm::SMLoc stateOperandsLoc;
|
|
(void)stateOperandsLoc;
|
|
::mlir::Type stateRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> stateTypes(&stateRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
stateOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(stateRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::amdgpu::DsBarrierStateType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
stateRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(stateOperands, stateTypes, stateOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getState();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getState().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::amdgpu::DsBarrierStateType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsBarrierStatePendingCountOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsBarrierStatePendingCountOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsBarrierStatePhaseOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsBarrierStatePhaseOpGenericAdaptorBase::DsBarrierStatePhaseOpGenericAdaptorBase(DsBarrierStatePhaseOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
DsBarrierStatePhaseOpAdaptor::DsBarrierStatePhaseOpAdaptor(DsBarrierStatePhaseOp op) : DsBarrierStatePhaseOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsBarrierStatePhaseOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsBarrierStatePhaseOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsBarrierStatePhaseOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePhaseOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePhaseOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePhaseOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseOp DsBarrierStatePhaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DsBarrierStatePhaseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand stateRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stateOperands(&stateRawOperand, 1); ::llvm::SMLoc stateOperandsLoc;
|
|
(void)stateOperandsLoc;
|
|
::mlir::Type stateRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> stateTypes(&stateRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
stateOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(stateRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::amdgpu::DsBarrierStateType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
stateRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(stateOperands, stateTypes, stateOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getState();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getState().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::amdgpu::DsBarrierStateType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsBarrierStatePhaseOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsBarrierStatePhaseOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::DsBarrierStatePhaseParity definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
DsBarrierStatePhaseParityGenericAdaptorBase::DsBarrierStatePhaseParityGenericAdaptorBase(DsBarrierStatePhaseParity op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
DsBarrierStatePhaseParityAdaptor::DsBarrierStatePhaseParityAdaptor(DsBarrierStatePhaseParity op) : DsBarrierStatePhaseParityGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseParityAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseParity::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute DsBarrierStatePhaseParity::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code DsBarrierStatePhaseParity::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> DsBarrierStatePhaseParity::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseParity::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseParity>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePhaseParity::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseParity>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
odsState.addOperands(state);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseParity>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value state) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(state)>(state));
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseParity>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePhaseParity::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseParity>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseParity>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(DsBarrierStatePhaseParity::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<DsBarrierStatePhaseParity>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
DsBarrierStatePhaseParity DsBarrierStatePhaseParity::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseParity::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU8(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseParity::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult DsBarrierStatePhaseParity::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1);
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult DsBarrierStatePhaseParity::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand stateRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stateOperands(&stateRawOperand, 1); ::llvm::SMLoc stateOperandsLoc;
|
|
(void)stateOperandsLoc;
|
|
::mlir::Type stateRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> stateTypes(&stateRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
|
|
stateOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(stateRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::amdgpu::DsBarrierStateType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
stateRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(stateOperands, stateTypes, stateOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getState();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getState().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::amdgpu::DsBarrierStateType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void DsBarrierStatePhaseParity::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::DsBarrierStatePhaseParity)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::ExtPackedFp8Op definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ExtPackedFp8OpGenericAdaptorBase::ExtPackedFp8OpGenericAdaptorBase(ExtPackedFp8Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t ExtPackedFp8OpGenericAdaptorBase::getIndex() {
|
|
auto attr = getIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ExtPackedFp8OpAdaptor::ExtPackedFp8OpAdaptor(ExtPackedFp8Op op) : ExtPackedFp8OpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ExtPackedFp8OpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_index = getProperties().index; (void)tblgen_index;
|
|
if (!tblgen_index) return emitError(loc, "'amdgpu.ext_packed_fp8' op requires attribute 'index'");
|
|
|
|
if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getInt() <= 3))))
|
|
return emitError(loc, "'amdgpu.ext_packed_fp8' op attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtPackedFp8Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.index;
|
|
auto attr = dict.get("index");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `index` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ExtPackedFp8Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.index;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("index",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ExtPackedFp8Op::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.index.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ExtPackedFp8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "index")
|
|
return prop.index;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ExtPackedFp8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "index") {
|
|
prop.index = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.index)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ExtPackedFp8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.index) attrs.append("index", prop.index);
|
|
}
|
|
|
|
::llvm::LogicalResult ExtPackedFp8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(attr, "index", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtPackedFp8Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.index)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ExtPackedFp8Op::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.index);
|
|
}
|
|
|
|
uint32_t ExtPackedFp8Op::getIndex() {
|
|
auto attr = getIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void ExtPackedFp8Op::setIndex(uint32_t attrValue) {
|
|
getProperties().index = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::IntegerAttr index) {
|
|
odsState.addOperands(source);
|
|
odsState.getOrAddProperties<Properties>().index = index;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::IntegerAttr index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ExtPackedFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::IntegerAttr index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::IntegerAttr index) {
|
|
odsState.addOperands(source);
|
|
odsState.getOrAddProperties<Properties>().index = index;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::IntegerAttr index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ExtPackedFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::IntegerAttr index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, uint32_t index) {
|
|
odsState.addOperands(source);
|
|
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, uint32_t index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ExtPackedFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, uint32_t index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ExtPackedFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, uint32_t index) {
|
|
odsState.addOperands(source);
|
|
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, uint32_t index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ExtPackedFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, uint32_t index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ExtPackedFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ExtPackedFp8Op::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtPackedFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ExtPackedFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ExtPackedFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ExtPackedFp8Op ExtPackedFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ExtPackedFp8Op::verifyInvariantsImpl() {
|
|
auto tblgen_index = getProperties().index; (void)tblgen_index;
|
|
if (!tblgen_index) return emitOpError("requires attribute 'index'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(*this, tblgen_index, "index")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU11(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU12(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ExtPackedFp8Op::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ExtPackedFp8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
|
|
(void)sourceOperandsLoc;
|
|
::mlir::IntegerAttr indexAttr;
|
|
::mlir::Type sourceRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
sourceOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (indexAttr) result.getOrAddProperties<ExtPackedFp8Op::Properties>().index = indexAttr;
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ExtPackedFp8Op::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("index");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSource();
|
|
_odsPrinter << "[";
|
|
_odsPrinter.printAttributeWithoutType(getIndexAttr());
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSource().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ExtPackedFp8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::ExtPackedFp8Op)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::ExtPackedFp8OpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::FatRawBufferCastOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FatRawBufferCastOpGenericAdaptorBase::FatRawBufferCastOpGenericAdaptorBase(FatRawBufferCastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> FatRawBufferCastOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr FatRawBufferCastOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool FatRawBufferCastOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::UnitAttr FatRawBufferCastOpGenericAdaptorBase::getResetOffsetAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().resetOffset);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool FatRawBufferCastOpGenericAdaptorBase::getResetOffset() {
|
|
auto attr = getResetOffsetAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FatRawBufferCastOpAdaptor::FatRawBufferCastOpAdaptor(FatRawBufferCastOp op) : FatRawBufferCastOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FatRawBufferCastOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_resetOffset = getProperties().resetOffset; (void)tblgen_resetOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.fat_raw_buffer_cast' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_resetOffset && !((::llvm::isa<::mlir::UnitAttr>(tblgen_resetOffset))))
|
|
return emitError(loc, "'amdgpu.fat_raw_buffer_cast' op attribute 'resetOffset' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> FatRawBufferCastOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange FatRawBufferCastOp::getValidBytesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange FatRawBufferCastOp::getCacheSwizzleStrideMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult FatRawBufferCastOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.resetOffset;
|
|
auto attr = dict.get("resetOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `resetOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FatRawBufferCastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.resetOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("resetOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FatRawBufferCastOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.resetOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FatRawBufferCastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "resetOffset")
|
|
return prop.resetOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FatRawBufferCastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "resetOffset") {
|
|
prop.resetOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.resetOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FatRawBufferCastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.resetOffset) attrs.append("resetOffset", prop.resetOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult FatRawBufferCastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getResetOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "resetOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FatRawBufferCastOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.resetOffset)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FatRawBufferCastOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
writer.writeOptionalAttribute(prop.resetOffset);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool FatRawBufferCastOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool FatRawBufferCastOp::getResetOffset() {
|
|
auto attr = getResetOffsetAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void FatRawBufferCastOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void FatRawBufferCastOp::setResetOffset(bool attrValue) {
|
|
auto &odsProp = getProperties().resetOffset;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
odsState.addOperands(source);
|
|
if (validBytes)
|
|
odsState.addOperands(validBytes);
|
|
if (cacheSwizzleStride)
|
|
odsState.addOperands(cacheSwizzleStride);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (validBytes ? 1 : 0), (cacheSwizzleStride ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (resetOffset) {
|
|
odsState.getOrAddProperties<Properties>().resetOffset = resetOffset;
|
|
}
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
odsState.addOperands(source);
|
|
if (validBytes)
|
|
odsState.addOperands(validBytes);
|
|
if (cacheSwizzleStride)
|
|
odsState.addOperands(cacheSwizzleStride);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (validBytes ? 1 : 0), (cacheSwizzleStride ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (resetOffset) {
|
|
odsState.getOrAddProperties<Properties>().resetOffset = resetOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FatRawBufferCastOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
odsState.addOperands(source);
|
|
if (validBytes)
|
|
odsState.addOperands(validBytes);
|
|
if (cacheSwizzleStride)
|
|
odsState.addOperands(cacheSwizzleStride);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (validBytes ? 1 : 0), (cacheSwizzleStride ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (resetOffset) {
|
|
odsState.getOrAddProperties<Properties>().resetOffset = resetOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::UnitAttr resetOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
odsState.addOperands(source);
|
|
if (validBytes)
|
|
odsState.addOperands(validBytes);
|
|
if (cacheSwizzleStride)
|
|
odsState.addOperands(cacheSwizzleStride);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (validBytes ? 1 : 0), (cacheSwizzleStride ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (resetOffset) {
|
|
odsState.getOrAddProperties<Properties>().resetOffset = ((resetOffset) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
odsState.addOperands(source);
|
|
if (validBytes)
|
|
odsState.addOperands(validBytes);
|
|
if (cacheSwizzleStride)
|
|
odsState.addOperands(cacheSwizzleStride);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (validBytes ? 1 : 0), (cacheSwizzleStride ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (resetOffset) {
|
|
odsState.getOrAddProperties<Properties>().resetOffset = ((resetOffset) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FatRawBufferCastOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
odsState.addOperands(source);
|
|
if (validBytes)
|
|
odsState.addOperands(validBytes);
|
|
if (cacheSwizzleStride)
|
|
odsState.addOperands(cacheSwizzleStride);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (validBytes ? 1 : 0), (cacheSwizzleStride ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (resetOffset) {
|
|
odsState.getOrAddProperties<Properties>().resetOffset = ((resetOffset) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::Value validBytes, /*optional*/::mlir::Value cacheSwizzleStride, bool boundsCheck, /*optional*/bool resetOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(validBytes)>(validBytes), std::forward<decltype(cacheSwizzleStride)>(cacheSwizzleStride), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(resetOffset)>(resetOffset));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FatRawBufferCastOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FatRawBufferCastOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FatRawBufferCastOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FatRawBufferCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FatRawBufferCastOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FatRawBufferCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FatRawBufferCastOp FatRawBufferCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void FatRawBufferCastOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult FatRawBufferCastOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_resetOffset = getProperties().resetOffset; (void)tblgen_resetOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_resetOffset, "resetOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
if (valueGroup1.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup1.size();
|
|
}
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU7(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
if (valueGroup2.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup2.size();
|
|
}
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FatRawBufferCastOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult FatRawBufferCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
|
|
(void)sourceOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> validBytesOperands;
|
|
::llvm::SMLoc validBytesOperandsLoc;
|
|
(void)validBytesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> cacheSwizzleStrideOperands;
|
|
::llvm::SMLoc cacheSwizzleStrideOperandsLoc;
|
|
(void)cacheSwizzleStrideOperandsLoc;
|
|
::mlir::BoolAttr boundsCheckAttr;
|
|
::mlir::Type sourceRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
sourceOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceRawOperand))
|
|
return ::mlir::failure();
|
|
bool validBytesClause = false;
|
|
bool cacheSwizzleStrideClause = false;
|
|
bool boundsCheckClause = false;
|
|
bool resetOffsetClause = false;
|
|
while(true) {
|
|
if (succeeded(parser.parseOptionalKeyword("validBytes"))) {
|
|
|
|
if (validBytesClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`validBytes` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
validBytesClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
validBytesOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
validBytesOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else if (succeeded(parser.parseOptionalKeyword("cacheSwizzleStride"))) {
|
|
|
|
if (cacheSwizzleStrideClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`cacheSwizzleStride` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
cacheSwizzleStrideClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
cacheSwizzleStrideOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
cacheSwizzleStrideOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else if (succeeded(parser.parseOptionalKeyword("boundsCheck"))) {
|
|
|
|
if (boundsCheckClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`boundsCheck` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
boundsCheckClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(boundsCheckAttr, parser.getBuilder().getIntegerType(1))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (boundsCheckAttr) result.getOrAddProperties<FatRawBufferCastOp::Properties>().boundsCheck = boundsCheckAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else if (succeeded(parser.parseOptionalKeyword("resetOffset"))) {
|
|
|
|
if (resetOffsetClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`resetOffset` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
resetOffsetClause = true;
|
|
result.getOrAddProperties<FatRawBufferCastOp::Properties>().resetOffset = parser.getBuilder().getUnitAttr(); } else {
|
|
break;
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(validBytesOperands.size()), static_cast<int32_t>(cacheSwizzleStrideOperands.size())}), result.getOrAddProperties<FatRawBufferCastOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(64);
|
|
::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(14);
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!validBytesOperands.empty()) {
|
|
if (parser.resolveOperands(validBytesOperands, odsBuildableType0, validBytesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!cacheSwizzleStrideOperands.empty()) {
|
|
if (parser.resolveOperands(cacheSwizzleStrideOperands, odsBuildableType1, cacheSwizzleStrideOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FatRawBufferCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSource();
|
|
if (false || getValidBytes()) {
|
|
_odsPrinter << ' ' << "validBytes";
|
|
_odsPrinter << "(";
|
|
if (::mlir::Value value = getValidBytes())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ")";
|
|
}
|
|
if (false || getCacheSwizzleStride()) {
|
|
_odsPrinter << ' ' << "cacheSwizzleStride";
|
|
_odsPrinter << "(";
|
|
if (::mlir::Value value = getCacheSwizzleStride())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ")";
|
|
}
|
|
if (false || (getBoundsCheckAttr() != ::mlir::OpBuilder((*this)->getContext()).getBoolAttr(true))) {
|
|
_odsPrinter << ' ' << "boundsCheck";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getBoundsCheckAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
if (false || ((getResetOffsetAttr() && getResetOffsetAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr)))) {
|
|
_odsPrinter << ' ' << "resetOffset";
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("boundsCheck");
|
|
elidedAttrs.push_back("resetOffset");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getResetOffsetAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("resetOffset");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSource().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void FatRawBufferCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::FatRawBufferCastOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::FatRawBufferCastOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::GatherToLDSOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GatherToLDSOpGenericAdaptorBase::GatherToLDSOpGenericAdaptorBase(GatherToLDSOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> GatherToLDSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::Type GatherToLDSOpGenericAdaptorBase::getTransferType() {
|
|
auto attr = getTransferTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
::mlir::UnitAttr GatherToLDSOpGenericAdaptorBase::getAsyncAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().async);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool GatherToLDSOpGenericAdaptorBase::getAsync() {
|
|
auto attr = getAsyncAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GatherToLDSOpAdaptor::GatherToLDSOpAdaptor(GatherToLDSOp op) : GatherToLDSOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GatherToLDSOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_async = getProperties().async; (void)tblgen_async;
|
|
auto tblgen_transferType = getProperties().transferType; (void)tblgen_transferType;
|
|
if (!tblgen_transferType) return emitError(loc, "'amdgpu.gather_to_lds' op requires attribute 'transferType'");
|
|
|
|
if (tblgen_transferType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_transferType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_transferType).getValue()))) && ((true))))
|
|
return emitError(loc, "'amdgpu.gather_to_lds' op attribute 'transferType' failed to satisfy constraint: any type attribute");
|
|
|
|
if (tblgen_async && !((::llvm::isa<::mlir::UnitAttr>(tblgen_async))))
|
|
return emitError(loc, "'amdgpu.gather_to_lds' op attribute 'async' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> GatherToLDSOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange GatherToLDSOp::getSrcIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange GatherToLDSOp::getDstIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult GatherToLDSOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.async;
|
|
auto attr = dict.get("async");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `async` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.transferType;
|
|
auto attr = dict.get("transferType");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `transferType` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GatherToLDSOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.async;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("async",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.transferType;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("transferType",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GatherToLDSOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.async.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.transferType.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GatherToLDSOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "async")
|
|
return prop.async;
|
|
|
|
if (name == "transferType")
|
|
return prop.transferType;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GatherToLDSOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "async") {
|
|
prop.async = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.async)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "transferType") {
|
|
prop.transferType = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.transferType)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void GatherToLDSOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.async) attrs.append("async", prop.async);
|
|
|
|
if (prop.transferType) attrs.append("transferType", prop.transferType);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult GatherToLDSOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAsyncAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "async", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTransferTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU7(attr, "transferType", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GatherToLDSOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.async)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.transferType)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GatherToLDSOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.async);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
writer.writeAttribute(prop.transferType);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::mlir::Type GatherToLDSOp::getTransferType() {
|
|
auto attr = getTransferTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
bool GatherToLDSOp::getAsync() {
|
|
auto attr = getAsyncAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void GatherToLDSOp::setTransferType(::mlir::Type attrValue) {
|
|
getProperties().transferType = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void GatherToLDSOp::setAsync(bool attrValue) {
|
|
auto &odsProp = getProperties().async;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GatherToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::UnitAttr async) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = transferType;
|
|
if (async) {
|
|
odsState.getOrAddProperties<Properties>().async = async;
|
|
}
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::UnitAttr async) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
auto __res__ = ::llvm::dyn_cast<GatherToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::UnitAttr async) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
}
|
|
|
|
void GatherToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::UnitAttr async) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = transferType;
|
|
if (async) {
|
|
odsState.getOrAddProperties<Properties>().async = async;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::UnitAttr async) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
auto __res__ = ::llvm::dyn_cast<GatherToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::UnitAttr async) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
}
|
|
|
|
void GatherToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/bool async) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = ::mlir::TypeAttr::get(transferType);
|
|
if (async) {
|
|
odsState.getOrAddProperties<Properties>().async = ((async) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/bool async) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
auto __res__ = ::llvm::dyn_cast<GatherToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/bool async) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
}
|
|
|
|
void GatherToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/bool async) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = ::mlir::TypeAttr::get(transferType);
|
|
if (async) {
|
|
odsState.getOrAddProperties<Properties>().async = ((async) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/bool async) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
auto __res__ = ::llvm::dyn_cast<GatherToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/bool async) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(async)>(async));
|
|
}
|
|
|
|
void GatherToLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<GatherToLDSOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GatherToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void GatherToLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<GatherToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GatherToLDSOp GatherToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult GatherToLDSOp::verifyInvariantsImpl() {
|
|
auto tblgen_async = getProperties().async; (void)tblgen_async;
|
|
auto tblgen_transferType = getProperties().transferType; (void)tblgen_transferType;
|
|
if (!tblgen_transferType) return emitOpError("requires attribute 'transferType'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU7(*this, tblgen_transferType, "transferType")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_async, "async")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GatherToLDSOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult GatherToLDSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> srcIndicesOperands;
|
|
::llvm::SMLoc srcIndicesOperandsLoc;
|
|
(void)srcIndicesOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand dstRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(&dstRawOperand, 1); ::llvm::SMLoc dstOperandsLoc;
|
|
(void)dstOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dstIndicesOperands;
|
|
::llvm::SMLoc dstIndicesOperandsLoc;
|
|
(void)dstIndicesOperandsLoc;
|
|
::mlir::TypeAttr transferTypeAttr;
|
|
::mlir::Type srcRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> srcTypes(&srcRawType, 1);
|
|
::mlir::Type dstRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> dstTypes(&dstRawType, 1);
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("async"))) {
|
|
result.getOrAddProperties<GatherToLDSOp::Properties>().async = parser.getBuilder().getUnitAttr(); }
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
srcIndicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(srcIndicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
dstOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(dstRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
dstIndicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(dstIndicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(transferTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (transferTypeAttr) result.getOrAddProperties<GatherToLDSOp::Properties>().transferType = transferTypeAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
srcRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
dstRawType = type;
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndicesOperands.size()), 1, static_cast<int32_t>(dstIndicesOperands.size())}), result.getOrAddProperties<GatherToLDSOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(srcIndicesOperands, odsBuildableType0, srcIndicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(dstOperands, dstTypes, dstOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(dstIndicesOperands, odsBuildableType0, dstIndicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GatherToLDSOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if ((getAsyncAttr() && getAsyncAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "async";
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getSrcIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDst();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getDstIndices();
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("async");
|
|
elidedAttrs.push_back("transferType");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getAsyncAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("async");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getTransferTypeAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSrc().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDst().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void GatherToLDSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(2);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::GatherToLDSOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::GatherToLDSOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::GlobalLoadAsyncToLDSOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GlobalLoadAsyncToLDSOpGenericAdaptorBase::GlobalLoadAsyncToLDSOpGenericAdaptorBase(GlobalLoadAsyncToLDSOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> GlobalLoadAsyncToLDSOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::Type GlobalLoadAsyncToLDSOpGenericAdaptorBase::getTransferType() {
|
|
auto attr = getTransferTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GlobalLoadAsyncToLDSOpAdaptor::GlobalLoadAsyncToLDSOpAdaptor(GlobalLoadAsyncToLDSOp op) : GlobalLoadAsyncToLDSOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GlobalLoadAsyncToLDSOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_transferType = getProperties().transferType; (void)tblgen_transferType;
|
|
if (!tblgen_transferType) return emitError(loc, "'amdgpu.global_load_async_to_lds' op requires attribute 'transferType'");
|
|
|
|
if (tblgen_transferType && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_transferType))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_transferType).getValue()))) && ((true))))
|
|
return emitError(loc, "'amdgpu.global_load_async_to_lds' op attribute 'transferType' failed to satisfy constraint: any type attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> GlobalLoadAsyncToLDSOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange GlobalLoadAsyncToLDSOp::getSrcIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange GlobalLoadAsyncToLDSOp::getDstIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange GlobalLoadAsyncToLDSOp::getMaskMutable() {
|
|
auto range = getODSOperandIndexAndLength(4);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalLoadAsyncToLDSOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.transferType;
|
|
auto attr = dict.get("transferType");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `transferType` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GlobalLoadAsyncToLDSOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.transferType;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("transferType",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GlobalLoadAsyncToLDSOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.transferType.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GlobalLoadAsyncToLDSOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "transferType")
|
|
return prop.transferType;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "transferType") {
|
|
prop.transferType = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.transferType)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.transferType) attrs.append("transferType", prop.transferType);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalLoadAsyncToLDSOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTransferTypeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU7(attr, "transferType", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalLoadAsyncToLDSOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.transferType)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
writer.writeAttribute(prop.transferType);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::mlir::Type GlobalLoadAsyncToLDSOp::getTransferType() {
|
|
auto attr = getTransferTypeAttr();
|
|
return ::llvm::cast<::mlir::Type>(attr.getValue());
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::setTransferType(::mlir::Type attrValue) {
|
|
getProperties().transferType = ::mlir::TypeAttr::get(attrValue);
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::Value mask) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
if (mask)
|
|
odsState.addOperands(mask);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size()), (mask ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = transferType;
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::Value mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalLoadAsyncToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::Value mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::Value mask) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
if (mask)
|
|
odsState.addOperands(mask);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size()), (mask ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = transferType;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::Value mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalLoadAsyncToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::TypeAttr transferType, /*optional*/::mlir::Value mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/::mlir::Value mask) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
if (mask)
|
|
odsState.addOperands(mask);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size()), (mask ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = ::mlir::TypeAttr::get(transferType);
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/::mlir::Value mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalLoadAsyncToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/::mlir::Value mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/::mlir::Value mask) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addOperands(dst);
|
|
odsState.addOperands(dstIndices);
|
|
if (mask)
|
|
odsState.addOperands(mask);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndices.size()), 1, static_cast<int32_t>(dstIndices.size()), (mask ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().transferType = ::mlir::TypeAttr::get(transferType);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/::mlir::Value mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalLoadAsyncToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices, ::mlir::Value dst, ::mlir::ValueRange dstIndices, ::mlir::Type transferType, /*optional*/::mlir::Value mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices), std::forward<decltype(dst)>(dst), std::forward<decltype(dstIndices)>(dstIndices), std::forward<decltype(transferType)>(transferType), std::forward<decltype(mask)>(mask));
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<GlobalLoadAsyncToLDSOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalLoadAsyncToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalLoadAsyncToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalLoadAsyncToLDSOp GlobalLoadAsyncToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalLoadAsyncToLDSOp::verifyInvariantsImpl() {
|
|
auto tblgen_transferType = getProperties().transferType; (void)tblgen_transferType;
|
|
if (!tblgen_transferType) return emitOpError("requires attribute 'transferType'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU7(*this, tblgen_transferType, "transferType")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup4 = getODSOperands(4);
|
|
|
|
if (valueGroup4.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup4.size();
|
|
}
|
|
|
|
for (auto v : valueGroup4) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalLoadAsyncToLDSOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult GlobalLoadAsyncToLDSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> srcIndicesOperands;
|
|
::llvm::SMLoc srcIndicesOperandsLoc;
|
|
(void)srcIndicesOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand dstRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dstOperands(&dstRawOperand, 1); ::llvm::SMLoc dstOperandsLoc;
|
|
(void)dstOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> dstIndicesOperands;
|
|
::llvm::SMLoc dstIndicesOperandsLoc;
|
|
(void)dstIndicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> maskOperands;
|
|
::llvm::SMLoc maskOperandsLoc;
|
|
(void)maskOperandsLoc;
|
|
::mlir::TypeAttr transferTypeAttr;
|
|
::mlir::Type srcRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> srcTypes(&srcRawType, 1);
|
|
::mlir::Type dstRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> dstTypes(&dstRawType, 1);
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
srcIndicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(srcIndicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
dstOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(dstRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
dstIndicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(dstIndicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalComma())) {
|
|
|
|
{
|
|
maskOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
maskOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(transferTypeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (transferTypeAttr) result.getOrAddProperties<GlobalLoadAsyncToLDSOp::Properties>().transferType = transferTypeAttr;
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
srcRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
dstRawType = type;
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(srcIndicesOperands.size()), 1, static_cast<int32_t>(dstIndicesOperands.size()), static_cast<int32_t>(maskOperands.size())}), result.getOrAddProperties<GlobalLoadAsyncToLDSOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
::mlir::Type odsBuildableType1 = parser.getBuilder().getIntegerType(1);
|
|
if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(srcIndicesOperands, odsBuildableType0, srcIndicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(dstOperands, dstTypes, dstOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(dstIndicesOperands, odsBuildableType0, dstIndicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!maskOperands.empty()) {
|
|
if (parser.resolveOperands(maskOperands, odsBuildableType1, maskOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getSrcIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDst();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getDstIndices();
|
|
_odsPrinter << "]";
|
|
if (getMask()) {
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getMask())
|
|
_odsPrinter << value;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("transferType");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getTransferTypeAttr());
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSrc().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDst().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void GlobalLoadAsyncToLDSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(2);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::GlobalLoadAsyncToLDSOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::GlobalLoadAsyncToLDSOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::GlobalPrefetchOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GlobalPrefetchOpGenericAdaptorBase::GlobalPrefetchOpGenericAdaptorBase(GlobalPrefetchOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> GlobalPrefetchOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::amdgpu::LoadTemporalHint GlobalPrefetchOpGenericAdaptorBase::getTemporalHint() {
|
|
auto attr = getTemporalHintAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::amdgpu::Scope GlobalPrefetchOpGenericAdaptorBase::getCacheScope() {
|
|
auto attr = getCacheScopeAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::UnitAttr GlobalPrefetchOpGenericAdaptorBase::getSpeculativeAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().speculative);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool GlobalPrefetchOpGenericAdaptorBase::getSpeculative() {
|
|
auto attr = getSpeculativeAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GlobalPrefetchOpAdaptor::GlobalPrefetchOpAdaptor(GlobalPrefetchOp op) : GlobalPrefetchOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GlobalPrefetchOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_cacheScope = getProperties().cacheScope; (void)tblgen_cacheScope;
|
|
if (!tblgen_cacheScope) return emitError(loc, "'amdgpu.global_prefetch' op requires attribute 'cacheScope'");
|
|
auto tblgen_speculative = getProperties().speculative; (void)tblgen_speculative;
|
|
auto tblgen_temporalHint = getProperties().temporalHint; (void)tblgen_temporalHint;
|
|
if (!tblgen_temporalHint) return emitError(loc, "'amdgpu.global_prefetch' op requires attribute 'temporalHint'");
|
|
|
|
if (tblgen_temporalHint && !((::llvm::isa<::mlir::amdgpu::LoadTemporalHintAttr>(tblgen_temporalHint))))
|
|
return emitError(loc, "'amdgpu.global_prefetch' op attribute 'temporalHint' failed to satisfy constraint: AMDGPU-specific prefetch temporal hints for load instructions. RT - regular temporal for both near and far caches; NT - non-temporal for both near and far caches; HT - high-priority temporal for both near and far caches; LU - last-use; NT_RT - non-temporal for near cache(s) and regular for far caches; RT_NT - regular for near cache(s) and non-temporal for far caches; NT_HT - non-temporal for near cache(s) and high-priority temporal for far caches");
|
|
|
|
if (tblgen_cacheScope && !((::llvm::isa<::mlir::amdgpu::ScopeAttr>(tblgen_cacheScope))))
|
|
return emitError(loc, "'amdgpu.global_prefetch' op attribute 'cacheScope' failed to satisfy constraint: AMDGPU-specific cache scopes. WGP - workgroup processor (CUs); SE - shader engine (GL2); DEV - device; SYS - system");
|
|
|
|
if (tblgen_speculative && !((::llvm::isa<::mlir::UnitAttr>(tblgen_speculative))))
|
|
return emitError(loc, "'amdgpu.global_prefetch' op attribute 'speculative' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> GlobalPrefetchOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange GlobalPrefetchOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalPrefetchOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.cacheScope;
|
|
auto attr = dict.get("cacheScope");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cacheScope` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.speculative;
|
|
auto attr = dict.get("speculative");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `speculative` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.temporalHint;
|
|
auto attr = dict.get("temporalHint");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `temporalHint` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GlobalPrefetchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.cacheScope;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("cacheScope",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.speculative;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("speculative",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.temporalHint;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("temporalHint",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GlobalPrefetchOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.cacheScope.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.speculative.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.temporalHint.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GlobalPrefetchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "cacheScope")
|
|
return prop.cacheScope;
|
|
|
|
if (name == "speculative")
|
|
return prop.speculative;
|
|
|
|
if (name == "temporalHint")
|
|
return prop.temporalHint;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GlobalPrefetchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "cacheScope") {
|
|
prop.cacheScope = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cacheScope)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "speculative") {
|
|
prop.speculative = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.speculative)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "temporalHint") {
|
|
prop.temporalHint = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.temporalHint)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void GlobalPrefetchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.cacheScope) attrs.append("cacheScope", prop.cacheScope);
|
|
|
|
if (prop.speculative) attrs.append("speculative", prop.speculative);
|
|
|
|
if (prop.temporalHint) attrs.append("temporalHint", prop.temporalHint);
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalPrefetchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCacheScopeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU9(attr, "cacheScope", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSpeculativeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "speculative", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTemporalHintAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU8(attr, "temporalHint", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalPrefetchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.cacheScope)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.speculative)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.temporalHint)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalPrefetchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.cacheScope);
|
|
|
|
writer.writeOptionalAttribute(prop.speculative);
|
|
writer.writeAttribute(prop.temporalHint);
|
|
}
|
|
|
|
::mlir::amdgpu::LoadTemporalHint GlobalPrefetchOp::getTemporalHint() {
|
|
auto attr = getTemporalHintAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::amdgpu::Scope GlobalPrefetchOp::getCacheScope() {
|
|
auto attr = getCacheScopeAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool GlobalPrefetchOp::getSpeculative() {
|
|
auto attr = getSpeculativeAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void GlobalPrefetchOp::setTemporalHint(::mlir::amdgpu::LoadTemporalHint attrValue) {
|
|
getProperties().temporalHint = ::mlir::amdgpu::LoadTemporalHintAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void GlobalPrefetchOp::setCacheScope(::mlir::amdgpu::Scope attrValue) {
|
|
getProperties().cacheScope = ::mlir::amdgpu::ScopeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void GlobalPrefetchOp::setSpeculative(bool attrValue) {
|
|
auto &odsProp = getProperties().speculative;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void GlobalPrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHintAttr temporalHint, ::mlir::amdgpu::ScopeAttr cacheScope, /*optional*/::mlir::UnitAttr speculative) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(indices);
|
|
odsState.getOrAddProperties<Properties>().temporalHint = temporalHint;
|
|
odsState.getOrAddProperties<Properties>().cacheScope = cacheScope;
|
|
if (speculative) {
|
|
odsState.getOrAddProperties<Properties>().speculative = speculative;
|
|
}
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHintAttr temporalHint, ::mlir::amdgpu::ScopeAttr cacheScope, /*optional*/::mlir::UnitAttr speculative) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalPrefetchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHintAttr temporalHint, ::mlir::amdgpu::ScopeAttr cacheScope, /*optional*/::mlir::UnitAttr speculative) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
}
|
|
|
|
void GlobalPrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHintAttr temporalHint, ::mlir::amdgpu::ScopeAttr cacheScope, /*optional*/::mlir::UnitAttr speculative) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(indices);
|
|
odsState.getOrAddProperties<Properties>().temporalHint = temporalHint;
|
|
odsState.getOrAddProperties<Properties>().cacheScope = cacheScope;
|
|
if (speculative) {
|
|
odsState.getOrAddProperties<Properties>().speculative = speculative;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHintAttr temporalHint, ::mlir::amdgpu::ScopeAttr cacheScope, /*optional*/::mlir::UnitAttr speculative) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalPrefetchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHintAttr temporalHint, ::mlir::amdgpu::ScopeAttr cacheScope, /*optional*/::mlir::UnitAttr speculative) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
}
|
|
|
|
void GlobalPrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHint temporalHint, ::mlir::amdgpu::Scope cacheScope, /*optional*/bool speculative) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(indices);
|
|
odsState.getOrAddProperties<Properties>().temporalHint = ::mlir::amdgpu::LoadTemporalHintAttr::get(odsBuilder.getContext(), temporalHint);
|
|
odsState.getOrAddProperties<Properties>().cacheScope = ::mlir::amdgpu::ScopeAttr::get(odsBuilder.getContext(), cacheScope);
|
|
if (speculative) {
|
|
odsState.getOrAddProperties<Properties>().speculative = ((speculative) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHint temporalHint, ::mlir::amdgpu::Scope cacheScope, /*optional*/bool speculative) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalPrefetchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHint temporalHint, ::mlir::amdgpu::Scope cacheScope, /*optional*/bool speculative) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
}
|
|
|
|
void GlobalPrefetchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHint temporalHint, ::mlir::amdgpu::Scope cacheScope, /*optional*/bool speculative) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(indices);
|
|
odsState.getOrAddProperties<Properties>().temporalHint = ::mlir::amdgpu::LoadTemporalHintAttr::get(odsBuilder.getContext(), temporalHint);
|
|
odsState.getOrAddProperties<Properties>().cacheScope = ::mlir::amdgpu::ScopeAttr::get(odsBuilder.getContext(), cacheScope);
|
|
if (speculative) {
|
|
odsState.getOrAddProperties<Properties>().speculative = ((speculative) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHint temporalHint, ::mlir::amdgpu::Scope cacheScope, /*optional*/bool speculative) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalPrefetchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange indices, ::mlir::amdgpu::LoadTemporalHint temporalHint, ::mlir::amdgpu::Scope cacheScope, /*optional*/bool speculative) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(indices)>(indices), std::forward<decltype(temporalHint)>(temporalHint), std::forward<decltype(cacheScope)>(cacheScope), std::forward<decltype(speculative)>(speculative));
|
|
}
|
|
|
|
void GlobalPrefetchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<GlobalPrefetchOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalPrefetchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void GlobalPrefetchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalPrefetchOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalPrefetchOp GlobalPrefetchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalPrefetchOp::verifyInvariantsImpl() {
|
|
auto tblgen_cacheScope = getProperties().cacheScope; (void)tblgen_cacheScope;
|
|
if (!tblgen_cacheScope) return emitOpError("requires attribute 'cacheScope'");
|
|
auto tblgen_speculative = getProperties().speculative; (void)tblgen_speculative;
|
|
auto tblgen_temporalHint = getProperties().temporalHint; (void)tblgen_temporalHint;
|
|
if (!tblgen_temporalHint) return emitOpError("requires attribute 'temporalHint'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU8(*this, tblgen_temporalHint, "temporalHint")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU9(*this, tblgen_cacheScope, "cacheScope")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_speculative, "speculative")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU15(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalPrefetchOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult GlobalPrefetchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::mlir::amdgpu::LoadTemporalHintAttr temporalHintAttr;
|
|
::mlir::amdgpu::ScopeAttr cacheScopeAttr;
|
|
::mlir::Type srcRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> srcTypes(&srcRawType, 1);
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(temporalHintAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (temporalHintAttr) result.getOrAddProperties<GlobalPrefetchOp::Properties>().temporalHint = temporalHintAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(cacheScopeAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (cacheScopeAttr) result.getOrAddProperties<GlobalPrefetchOp::Properties>().cacheScope = cacheScopeAttr;
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("speculative"))) {
|
|
result.getOrAddProperties<GlobalPrefetchOp::Properties>().speculative = parser.getBuilder().getUnitAttr(); }
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(srcRawType))
|
|
return ::mlir::failure();
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(64);
|
|
if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalPrefetchOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getTemporalHintAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getCacheScopeAttr());
|
|
if ((getSpeculativeAttr() && getSpeculativeAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
|
|
_odsPrinter << ' ' << "speculative";
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("temporalHint");
|
|
elidedAttrs.push_back("cacheScope");
|
|
elidedAttrs.push_back("speculative");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getSpeculativeAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("speculative");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc().getType();
|
|
}
|
|
|
|
void GlobalPrefetchOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::GlobalPrefetchOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::GlobalPrefetchOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::GlobalTransposeLoadOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
GlobalTransposeLoadOpGenericAdaptorBase::GlobalTransposeLoadOpGenericAdaptorBase(GlobalTransposeLoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> GlobalTransposeLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
GlobalTransposeLoadOpAdaptor::GlobalTransposeLoadOpAdaptor(GlobalTransposeLoadOp op) : GlobalTransposeLoadOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult GlobalTransposeLoadOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> GlobalTransposeLoadOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange GlobalTransposeLoadOp::getSrcIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalTransposeLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute GlobalTransposeLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code GlobalTransposeLoadOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> GlobalTransposeLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalTransposeLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalTransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalTransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalTransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<GlobalTransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
GlobalTransposeLoadOp GlobalTransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalTransposeLoadOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU16(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult GlobalTransposeLoadOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult GlobalTransposeLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> srcIndicesOperands;
|
|
::llvm::SMLoc srcIndicesOperandsLoc;
|
|
(void)srcIndicesOperandsLoc;
|
|
::mlir::Type srcRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> srcTypes(&srcRawType, 1);
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
srcIndicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(srcIndicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
srcRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(srcIndicesOperands, odsBuildableType0, srcIndicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getSrcIndices();
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSrc().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void GlobalTransposeLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::GlobalTransposeLoadOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::LDSBarrierOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
LDSBarrierOpGenericAdaptorBase::LDSBarrierOpGenericAdaptorBase(LDSBarrierOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
LDSBarrierOpAdaptor::LDSBarrierOpAdaptor(LDSBarrierOp op) : LDSBarrierOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult LDSBarrierOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LDSBarrierOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute LDSBarrierOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code LDSBarrierOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> LDSBarrierOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void LDSBarrierOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void LDSBarrierOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult LDSBarrierOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LDSBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__);
|
|
auto __res__ = ::llvm::dyn_cast<LDSBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder) {
|
|
return create(builder, builder.getLoc());
|
|
}
|
|
|
|
void LDSBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
|
|
auto __res__ = ::llvm::dyn_cast<LDSBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void LDSBarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<LDSBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void LDSBarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<LDSBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
LDSBarrierOp LDSBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult LDSBarrierOp::verifyInvariantsImpl() {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult LDSBarrierOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult LDSBarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void LDSBarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::LDSBarrierOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::MFMAOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MFMAOpGenericAdaptorBase::MFMAOpGenericAdaptorBase(MFMAOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t MFMAOpGenericAdaptorBase::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t MFMAOpGenericAdaptorBase::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t MFMAOpGenericAdaptorBase::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getBlocksAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().blocks);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t MFMAOpGenericAdaptorBase::getBlocks() {
|
|
auto attr = getBlocksAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getCbszAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().cbsz);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t MFMAOpGenericAdaptorBase::getCbsz() {
|
|
auto attr = getCbszAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::IntegerAttr MFMAOpGenericAdaptorBase::getAbidAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().abid);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t MFMAOpGenericAdaptorBase::getAbid() {
|
|
auto attr = getAbidAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::ROCDL::MFMAPermBAttr MFMAOpGenericAdaptorBase::getBlgpAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::ROCDL::MFMAPermBAttr>(getProperties().blgp);
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ROCDL::MFMAPermB MFMAOpGenericAdaptorBase::getBlgp() {
|
|
auto attr = getBlgpAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::UnitAttr MFMAOpGenericAdaptorBase::getReducePrecisionAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().reducePrecision);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool MFMAOpGenericAdaptorBase::getReducePrecision() {
|
|
auto attr = getReducePrecisionAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr MFMAOpGenericAdaptorBase::getNegateAAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateA);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool MFMAOpGenericAdaptorBase::getNegateA() {
|
|
auto attr = getNegateAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr MFMAOpGenericAdaptorBase::getNegateBAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateB);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool MFMAOpGenericAdaptorBase::getNegateB() {
|
|
auto attr = getNegateBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr MFMAOpGenericAdaptorBase::getNegateCAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().negateC);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool MFMAOpGenericAdaptorBase::getNegateC() {
|
|
auto attr = getNegateCAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
MFMAOpAdaptor::MFMAOpAdaptor(MFMAOp op) : MFMAOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MFMAOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_abid = getProperties().abid; (void)tblgen_abid;
|
|
auto tblgen_blgp = getProperties().blgp; (void)tblgen_blgp;
|
|
auto tblgen_blocks = getProperties().blocks; (void)tblgen_blocks;
|
|
auto tblgen_cbsz = getProperties().cbsz; (void)tblgen_cbsz;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitError(loc, "'amdgpu.mfma' op requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitError(loc, "'amdgpu.mfma' op requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitError(loc, "'amdgpu.mfma' op requires attribute 'n'");
|
|
auto tblgen_negateA = getProperties().negateA; (void)tblgen_negateA;
|
|
auto tblgen_negateB = getProperties().negateB; (void)tblgen_negateB;
|
|
auto tblgen_negateC = getProperties().negateC; (void)tblgen_negateC;
|
|
auto tblgen_reducePrecision = getProperties().reducePrecision; (void)tblgen_reducePrecision;
|
|
|
|
if (tblgen_m && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({4, 16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getInt())))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {4, 16, 32}");
|
|
|
|
if (tblgen_n && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({4, 16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getInt())))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {4, 16, 32}");
|
|
|
|
if (tblgen_k && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({1, 2, 4, 8, 16, 32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getInt())))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {1, 2, 4, 8, 16, 32, 64, 128}");
|
|
|
|
if (tblgen_blocks && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_blocks))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_blocks).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({1, 2, 4, 16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_blocks).getInt())))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'blocks' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {1, 2, 4, 16}");
|
|
|
|
if (tblgen_cbsz && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_cbsz))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_cbsz).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'cbsz' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_abid && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_abid))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_abid).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'abid' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_blgp && !((::llvm::isa<::mlir::ROCDL::MFMAPermBAttr>(tblgen_blgp))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'blgp' failed to satisfy constraint: permutations of the lanes storing B in an MFMA");
|
|
|
|
if (tblgen_reducePrecision && !((::llvm::isa<::mlir::UnitAttr>(tblgen_reducePrecision))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'reducePrecision' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_negateA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_negateA))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'negateA' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_negateB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_negateB))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'negateB' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_negateC && !((::llvm::isa<::mlir::UnitAttr>(tblgen_negateC))))
|
|
return emitError(loc, "'amdgpu.mfma' op attribute 'negateC' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MFMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.abid;
|
|
auto attr = dict.get("abid");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `abid` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.blgp;
|
|
auto attr = dict.get("blgp");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `blgp` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.blocks;
|
|
auto attr = dict.get("blocks");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `blocks` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.cbsz;
|
|
auto attr = dict.get("cbsz");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cbsz` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.k;
|
|
auto attr = dict.get("k");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `k` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.m;
|
|
auto attr = dict.get("m");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `m` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.n;
|
|
auto attr = dict.get("n");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `n` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.negateA;
|
|
auto attr = dict.get("negateA");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `negateA` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.negateB;
|
|
auto attr = dict.get("negateB");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `negateB` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.negateC;
|
|
auto attr = dict.get("negateC");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `negateC` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.reducePrecision;
|
|
auto attr = dict.get("reducePrecision");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `reducePrecision` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MFMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.abid;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("abid",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.blgp;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("blgp",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.blocks;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("blocks",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.cbsz;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("cbsz",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.k;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("k",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.m;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("m",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.n;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("n",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.negateA;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("negateA",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.negateB;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("negateB",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.negateC;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("negateC",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.reducePrecision;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("reducePrecision",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MFMAOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.abid.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.blgp.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.blocks.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.cbsz.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.k.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.m.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.n.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.negateA.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.negateB.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.negateC.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.reducePrecision.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MFMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "abid")
|
|
return prop.abid;
|
|
|
|
if (name == "blgp")
|
|
return prop.blgp;
|
|
|
|
if (name == "blocks")
|
|
return prop.blocks;
|
|
|
|
if (name == "cbsz")
|
|
return prop.cbsz;
|
|
|
|
if (name == "k")
|
|
return prop.k;
|
|
|
|
if (name == "m")
|
|
return prop.m;
|
|
|
|
if (name == "n")
|
|
return prop.n;
|
|
|
|
if (name == "negateA")
|
|
return prop.negateA;
|
|
|
|
if (name == "negateB")
|
|
return prop.negateB;
|
|
|
|
if (name == "negateC")
|
|
return prop.negateC;
|
|
|
|
if (name == "reducePrecision")
|
|
return prop.reducePrecision;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MFMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "abid") {
|
|
prop.abid = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.abid)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "blgp") {
|
|
prop.blgp = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.blgp)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "blocks") {
|
|
prop.blocks = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.blocks)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "cbsz") {
|
|
prop.cbsz = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cbsz)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "k") {
|
|
prop.k = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.k)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "m") {
|
|
prop.m = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.m)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "n") {
|
|
prop.n = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.n)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "negateA") {
|
|
prop.negateA = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.negateA)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "negateB") {
|
|
prop.negateB = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.negateB)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "negateC") {
|
|
prop.negateC = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.negateC)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "reducePrecision") {
|
|
prop.reducePrecision = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.reducePrecision)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void MFMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.abid) attrs.append("abid", prop.abid);
|
|
|
|
if (prop.blgp) attrs.append("blgp", prop.blgp);
|
|
|
|
if (prop.blocks) attrs.append("blocks", prop.blocks);
|
|
|
|
if (prop.cbsz) attrs.append("cbsz", prop.cbsz);
|
|
|
|
if (prop.k) attrs.append("k", prop.k);
|
|
|
|
if (prop.m) attrs.append("m", prop.m);
|
|
|
|
if (prop.n) attrs.append("n", prop.n);
|
|
|
|
if (prop.negateA) attrs.append("negateA", prop.negateA);
|
|
|
|
if (prop.negateB) attrs.append("negateB", prop.negateB);
|
|
|
|
if (prop.negateC) attrs.append("negateC", prop.negateC);
|
|
|
|
if (prop.reducePrecision) attrs.append("reducePrecision", prop.reducePrecision);
|
|
}
|
|
|
|
::llvm::LogicalResult MFMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAbidAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "abid", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBlgpAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU13(attr, "blgp", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBlocksAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU12(attr, "blocks", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCbszAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "cbsz", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getKAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU11(attr, "k", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU10(attr, "m", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU10(attr, "n", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNegateAAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "negateA", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNegateBAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "negateB", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNegateCAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "negateC", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getReducePrecisionAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "reducePrecision", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MFMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.abid)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.blgp)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.blocks)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.cbsz)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.k)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.m)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.n)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.negateA)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.negateB)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.negateC)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.reducePrecision)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MFMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.abid);
|
|
|
|
writer.writeOptionalAttribute(prop.blgp);
|
|
|
|
writer.writeOptionalAttribute(prop.blocks);
|
|
|
|
writer.writeOptionalAttribute(prop.cbsz);
|
|
writer.writeAttribute(prop.k);
|
|
writer.writeAttribute(prop.m);
|
|
writer.writeAttribute(prop.n);
|
|
|
|
writer.writeOptionalAttribute(prop.negateA);
|
|
|
|
writer.writeOptionalAttribute(prop.negateB);
|
|
|
|
writer.writeOptionalAttribute(prop.negateC);
|
|
|
|
writer.writeOptionalAttribute(prop.reducePrecision);
|
|
}
|
|
|
|
uint32_t MFMAOp::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t MFMAOp::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t MFMAOp::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t MFMAOp::getBlocks() {
|
|
auto attr = getBlocksAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t MFMAOp::getCbsz() {
|
|
auto attr = getCbszAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t MFMAOp::getAbid() {
|
|
auto attr = getAbidAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::ROCDL::MFMAPermB MFMAOp::getBlgp() {
|
|
auto attr = getBlgpAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool MFMAOp::getReducePrecision() {
|
|
auto attr = getReducePrecisionAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool MFMAOp::getNegateA() {
|
|
auto attr = getNegateAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool MFMAOp::getNegateB() {
|
|
auto attr = getNegateBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool MFMAOp::getNegateC() {
|
|
auto attr = getNegateCAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void MFMAOp::setM(uint32_t attrValue) {
|
|
getProperties().m = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void MFMAOp::setN(uint32_t attrValue) {
|
|
getProperties().n = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void MFMAOp::setK(uint32_t attrValue) {
|
|
getProperties().k = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void MFMAOp::setBlocks(uint32_t attrValue) {
|
|
getProperties().blocks = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void MFMAOp::setCbsz(uint32_t attrValue) {
|
|
getProperties().cbsz = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void MFMAOp::setAbid(uint32_t attrValue) {
|
|
getProperties().abid = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void MFMAOp::setBlgp(::mlir::ROCDL::MFMAPermB attrValue) {
|
|
getProperties().blgp = ::mlir::ROCDL::MFMAPermBAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void MFMAOp::setReducePrecision(bool attrValue) {
|
|
auto &odsProp = getProperties().reducePrecision;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MFMAOp::setNegateA(bool attrValue) {
|
|
auto &odsProp = getProperties().negateA;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MFMAOp::setNegateB(bool attrValue) {
|
|
auto &odsProp = getProperties().negateB;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MFMAOp::setNegateC(bool attrValue) {
|
|
auto &odsProp = getProperties().negateC;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (blocks) {
|
|
odsState.getOrAddProperties<Properties>().blocks = blocks;
|
|
}
|
|
if (cbsz) {
|
|
odsState.getOrAddProperties<Properties>().cbsz = cbsz;
|
|
}
|
|
if (abid) {
|
|
odsState.getOrAddProperties<Properties>().abid = abid;
|
|
}
|
|
if (blgp) {
|
|
odsState.getOrAddProperties<Properties>().blgp = blgp;
|
|
}
|
|
if (reducePrecision) {
|
|
odsState.getOrAddProperties<Properties>().reducePrecision = reducePrecision;
|
|
}
|
|
if (negateA) {
|
|
odsState.getOrAddProperties<Properties>().negateA = negateA;
|
|
}
|
|
if (negateB) {
|
|
odsState.getOrAddProperties<Properties>().negateB = negateB;
|
|
}
|
|
if (negateC) {
|
|
odsState.getOrAddProperties<Properties>().negateC = negateC;
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (blocks) {
|
|
odsState.getOrAddProperties<Properties>().blocks = blocks;
|
|
}
|
|
if (cbsz) {
|
|
odsState.getOrAddProperties<Properties>().cbsz = cbsz;
|
|
}
|
|
if (abid) {
|
|
odsState.getOrAddProperties<Properties>().abid = abid;
|
|
}
|
|
if (blgp) {
|
|
odsState.getOrAddProperties<Properties>().blgp = blgp;
|
|
}
|
|
if (reducePrecision) {
|
|
odsState.getOrAddProperties<Properties>().reducePrecision = reducePrecision;
|
|
}
|
|
if (negateA) {
|
|
odsState.getOrAddProperties<Properties>().negateA = negateA;
|
|
}
|
|
if (negateB) {
|
|
odsState.getOrAddProperties<Properties>().negateB = negateB;
|
|
}
|
|
if (negateC) {
|
|
odsState.getOrAddProperties<Properties>().negateC = negateC;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (blocks) {
|
|
odsState.getOrAddProperties<Properties>().blocks = blocks;
|
|
}
|
|
if (cbsz) {
|
|
odsState.getOrAddProperties<Properties>().cbsz = cbsz;
|
|
}
|
|
if (abid) {
|
|
odsState.getOrAddProperties<Properties>().abid = abid;
|
|
}
|
|
if (blgp) {
|
|
odsState.getOrAddProperties<Properties>().blgp = blgp;
|
|
}
|
|
if (reducePrecision) {
|
|
odsState.getOrAddProperties<Properties>().reducePrecision = reducePrecision;
|
|
}
|
|
if (negateA) {
|
|
odsState.getOrAddProperties<Properties>().negateA = negateA;
|
|
}
|
|
if (negateB) {
|
|
odsState.getOrAddProperties<Properties>().negateB = negateB;
|
|
}
|
|
if (negateC) {
|
|
odsState.getOrAddProperties<Properties>().negateC = negateC;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::IntegerAttr blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid, ::mlir::ROCDL::MFMAPermBAttr blgp, /*optional*/::mlir::UnitAttr reducePrecision, /*optional*/::mlir::UnitAttr negateA, /*optional*/::mlir::UnitAttr negateB, /*optional*/::mlir::UnitAttr negateC) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().blocks = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), blocks);
|
|
odsState.getOrAddProperties<Properties>().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz);
|
|
odsState.getOrAddProperties<Properties>().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid);
|
|
odsState.getOrAddProperties<Properties>().blgp = ::mlir::ROCDL::MFMAPermBAttr::get(odsBuilder.getContext(), blgp);
|
|
if (reducePrecision) {
|
|
odsState.getOrAddProperties<Properties>().reducePrecision = ((reducePrecision) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateA) {
|
|
odsState.getOrAddProperties<Properties>().negateA = ((negateA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateB) {
|
|
odsState.getOrAddProperties<Properties>().negateB = ((negateB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateC) {
|
|
odsState.getOrAddProperties<Properties>().negateC = ((negateC) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().blocks = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), blocks);
|
|
odsState.getOrAddProperties<Properties>().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz);
|
|
odsState.getOrAddProperties<Properties>().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid);
|
|
odsState.getOrAddProperties<Properties>().blgp = ::mlir::ROCDL::MFMAPermBAttr::get(odsBuilder.getContext(), blgp);
|
|
if (reducePrecision) {
|
|
odsState.getOrAddProperties<Properties>().reducePrecision = ((reducePrecision) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateA) {
|
|
odsState.getOrAddProperties<Properties>().negateA = ((negateA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateB) {
|
|
odsState.getOrAddProperties<Properties>().negateB = ((negateB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateC) {
|
|
odsState.getOrAddProperties<Properties>().negateC = ((negateC) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().blocks = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), blocks);
|
|
odsState.getOrAddProperties<Properties>().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz);
|
|
odsState.getOrAddProperties<Properties>().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid);
|
|
odsState.getOrAddProperties<Properties>().blgp = ::mlir::ROCDL::MFMAPermBAttr::get(odsBuilder.getContext(), blgp);
|
|
if (reducePrecision) {
|
|
odsState.getOrAddProperties<Properties>().reducePrecision = ((reducePrecision) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateA) {
|
|
odsState.getOrAddProperties<Properties>().negateA = ((negateA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateB) {
|
|
odsState.getOrAddProperties<Properties>().negateB = ((negateB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (negateC) {
|
|
odsState.getOrAddProperties<Properties>().negateC = ((negateC) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, uint32_t blocks, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t cbsz, uint32_t abid, ::mlir::ROCDL::MFMAPermB blgp, /*optional*/bool reducePrecision, /*optional*/bool negateA, /*optional*/bool negateB, /*optional*/bool negateC) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(blocks)>(blocks), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid), std::forward<decltype(blgp)>(blgp), std::forward<decltype(reducePrecision)>(reducePrecision), std::forward<decltype(negateA)>(negateA), std::forward<decltype(negateB)>(negateB), std::forward<decltype(negateC)>(negateC));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MFMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MFMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void MFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MFMAOp MFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void MFMAOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.blocks)
|
|
properties.blocks = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 1);
|
|
if (!properties.cbsz)
|
|
properties.cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0);
|
|
if (!properties.abid)
|
|
properties.abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0);
|
|
if (!properties.blgp)
|
|
properties.blgp = ::mlir::ROCDL::MFMAPermBAttr::get(odsBuilder.getContext(), ::mlir::ROCDL::MFMAPermB::none);
|
|
}
|
|
|
|
::llvm::LogicalResult MFMAOp::verifyInvariantsImpl() {
|
|
auto tblgen_abid = getProperties().abid; (void)tblgen_abid;
|
|
auto tblgen_blgp = getProperties().blgp; (void)tblgen_blgp;
|
|
auto tblgen_blocks = getProperties().blocks; (void)tblgen_blocks;
|
|
auto tblgen_cbsz = getProperties().cbsz; (void)tblgen_cbsz;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitOpError("requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitOpError("requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitOpError("requires attribute 'n'");
|
|
auto tblgen_negateA = getProperties().negateA; (void)tblgen_negateA;
|
|
auto tblgen_negateB = getProperties().negateB; (void)tblgen_negateB;
|
|
auto tblgen_negateC = getProperties().negateC; (void)tblgen_negateC;
|
|
auto tblgen_reducePrecision = getProperties().reducePrecision; (void)tblgen_reducePrecision;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU10(*this, tblgen_m, "m")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU10(*this, tblgen_n, "n")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU11(*this, tblgen_k, "k")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU12(*this, tblgen_blocks, "blocks")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_cbsz, "cbsz")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_abid, "abid")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU13(*this, tblgen_blgp, "blgp")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_reducePrecision, "reducePrecision")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_negateA, "negateA")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_negateB, "negateB")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_negateC, "negateC")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU17(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU17(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU18(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU18(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {destC, destD} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MFMAOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult MFMAOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult MFMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::IntegerAttr mAttr;
|
|
::mlir::IntegerAttr nAttr;
|
|
::mlir::IntegerAttr kAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(&sourceBRawOperand, 1); ::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand destCRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(&destCRawOperand, 1); ::llvm::SMLoc destCOperandsLoc;
|
|
(void)destCOperandsLoc;
|
|
::mlir::ROCDL::MFMAPermBAttr blgpAttr;
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type sourceBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceBTypes(&sourceBRawType, 1);
|
|
::mlir::Type destCRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> destCTypes(&destCRawType, 1);
|
|
{
|
|
auto odsResult = parseMNKDimensionList(parser, mAttr, nAttr, kAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<MFMAOp::Properties>().m = mAttr;
|
|
result.getOrAddProperties<MFMAOp::Properties>().n = nAttr;
|
|
result.getOrAddProperties<MFMAOp::Properties>().k = kAttr;
|
|
}
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
destCOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(destCRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseKeyword("blgp"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(blgpAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (blgpAttr) result.getOrAddProperties<MFMAOp::Properties>().blgp = blgpAttr;
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
destCRawType = type;
|
|
}
|
|
result.addTypes(destCTypes[0]);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MFMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
printMNKDimensionList(_odsPrinter, *this, getMAttr(), getNAttr(), getKAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceB();
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestC();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("m");
|
|
elidedAttrs.push_back("n");
|
|
elidedAttrs.push_back("k");
|
|
elidedAttrs.push_back("blgp");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBlocksAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 1)))
|
|
elidedAttrs.push_back("blocks");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getCbszAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0)))
|
|
elidedAttrs.push_back("cbsz");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getAbidAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0)))
|
|
elidedAttrs.push_back("abid");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBlgpAttr();
|
|
if(attr && (attr == ::mlir::ROCDL::MFMAPermBAttr::get(odsBuilder.getContext(), ::mlir::ROCDL::MFMAPermB::none)))
|
|
elidedAttrs.push_back("blgp");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getReducePrecisionAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("reducePrecision");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getNegateAAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("negateA");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getNegateBAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("negateB");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getNegateCAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("negateC");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << "blgp";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getBlgpAttr());
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDestC().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void MFMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MFMAOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::MFMAOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::MakeDmaBaseOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MakeDmaBaseOpGenericAdaptorBase::MakeDmaBaseOpGenericAdaptorBase(MakeDmaBaseOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> MakeDmaBaseOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
MakeDmaBaseOpAdaptor::MakeDmaBaseOpAdaptor(MakeDmaBaseOp op) : MakeDmaBaseOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MakeDmaBaseOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> MakeDmaBaseOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaBaseOp::getGlobalIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaBaseOp::getLdsIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaBaseOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MakeDmaBaseOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MakeDmaBaseOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MakeDmaBaseOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MakeDmaBaseOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void MakeDmaBaseOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaBaseOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaBaseOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeDmaBaseOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
void MakeDmaBaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type base, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
odsState.addOperands(global);
|
|
odsState.addOperands(global_indices);
|
|
odsState.addOperands(lds);
|
|
odsState.addOperands(lds_indices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_indices.size()), 1, static_cast<int32_t>(lds_indices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.addTypes(base);
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type base, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type base, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
}
|
|
|
|
void MakeDmaBaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
odsState.addOperands(global);
|
|
odsState.addOperands(global_indices);
|
|
odsState.addOperands(lds);
|
|
odsState.addOperands(lds_indices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_indices.size()), 1, static_cast<int32_t>(lds_indices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
}
|
|
|
|
void MakeDmaBaseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MakeDmaBaseOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MakeDmaBaseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaBaseOp MakeDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaBaseOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU19(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))
|
|
return emitOpError("failed to verify that all of {global, lds} have same element type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaBaseOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult MakeDmaBaseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand globalRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> globalOperands(&globalRawOperand, 1); ::llvm::SMLoc globalOperandsLoc;
|
|
(void)globalOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_indicesOperands;
|
|
::llvm::SMLoc global_indicesOperandsLoc;
|
|
(void)global_indicesOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand ldsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ldsOperands(&ldsRawOperand, 1); ::llvm::SMLoc ldsOperandsLoc;
|
|
(void)ldsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lds_indicesOperands;
|
|
::llvm::SMLoc lds_indicesOperandsLoc;
|
|
(void)lds_indicesOperandsLoc;
|
|
::mlir::Type globalRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> globalTypes(&globalRawType, 1);
|
|
::mlir::Type ldsRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> ldsTypes(&ldsRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
|
|
|
|
globalOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(globalRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
global_indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(global_indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
ldsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(ldsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
lds_indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(lds_indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
globalRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
ldsRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(allResultTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_indicesOperands.size()), 1, static_cast<int32_t>(lds_indicesOperands.size())}), result.getOrAddProperties<MakeDmaBaseOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
result.addTypes(allResultTypes);
|
|
if (parser.resolveOperands(globalOperands, globalTypes, globalOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(global_indicesOperands, odsBuildableType0, global_indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(ldsOperands, ldsTypes, ldsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(lds_indicesOperands, odsBuildableType0, lds_indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeDmaBaseOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getGlobal();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getGlobalIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLds();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getLdsIndices();
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getGlobal().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getLds().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOperation()->getResultTypes();
|
|
}
|
|
|
|
void MakeDmaBaseOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MakeDmaBaseOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::MakeDmaBaseOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::MakeDmaDescriptorOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MakeDmaDescriptorOpGenericAdaptorBase::MakeDmaDescriptorOpGenericAdaptorBase(MakeDmaDescriptorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> MakeDmaDescriptorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeDmaDescriptorOpGenericAdaptorBase::getGlobalStaticSizes() {
|
|
auto attr = getGlobalStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeDmaDescriptorOpGenericAdaptorBase::getGlobalStaticStrides() {
|
|
auto attr = getGlobalStaticStridesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeDmaDescriptorOpGenericAdaptorBase::getSharedStaticSizes() {
|
|
auto attr = getSharedStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
MakeDmaDescriptorOpAdaptor::MakeDmaDescriptorOpAdaptor(MakeDmaDescriptorOp op) : MakeDmaDescriptorOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MakeDmaDescriptorOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_global_static_sizes = getProperties().global_static_sizes; (void)tblgen_global_static_sizes;
|
|
if (!tblgen_global_static_sizes) return emitError(loc, "'amdgpu.make_dma_descriptor' op requires attribute 'global_static_sizes'");
|
|
auto tblgen_global_static_strides = getProperties().global_static_strides; (void)tblgen_global_static_strides;
|
|
if (!tblgen_global_static_strides) return emitError(loc, "'amdgpu.make_dma_descriptor' op requires attribute 'global_static_strides'");
|
|
auto tblgen_shared_static_sizes = getProperties().shared_static_sizes; (void)tblgen_shared_static_sizes;
|
|
if (!tblgen_shared_static_sizes) return emitError(loc, "'amdgpu.make_dma_descriptor' op requires attribute 'shared_static_sizes'");
|
|
|
|
if (tblgen_global_static_sizes && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_global_static_sizes))))
|
|
return emitError(loc, "'amdgpu.make_dma_descriptor' op attribute 'global_static_sizes' failed to satisfy constraint: i64 dense array attribute");
|
|
|
|
if (tblgen_global_static_strides && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_global_static_strides))))
|
|
return emitError(loc, "'amdgpu.make_dma_descriptor' op attribute 'global_static_strides' failed to satisfy constraint: i64 dense array attribute");
|
|
|
|
if (tblgen_shared_static_sizes && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_shared_static_sizes))))
|
|
return emitError(loc, "'amdgpu.make_dma_descriptor' op attribute 'shared_static_sizes' failed to satisfy constraint: i64 dense array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> MakeDmaDescriptorOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getGlobalDynamicSizesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getGlobalDynamicStridesMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getSharedDynamicSizesMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getWorkgroupMaskMutable() {
|
|
auto range = getODSOperandIndexAndLength(4);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getEarlyTimeoutMutable() {
|
|
auto range = getODSOperandIndexAndLength(5);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getPadAmountMutable() {
|
|
auto range = getODSOperandIndexAndLength(6);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getPadIntervalMutable() {
|
|
auto range = getODSOperandIndexAndLength(7);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getAtomicBarrierAddressMutable() {
|
|
auto range = getODSOperandIndexAndLength(8);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(8u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getAtomicBarrierIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(9);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(9u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getGlobalIncrementMutable() {
|
|
auto range = getODSOperandIndexAndLength(10);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(10u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getLdsIncrementMutable() {
|
|
auto range = getODSOperandIndexAndLength(11);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(11u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeDmaDescriptorOp::getIterationCountMutable() {
|
|
auto range = getODSOperandIndexAndLength(12);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(12u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaDescriptorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.global_static_sizes;
|
|
auto attr = dict.get("global_static_sizes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `global_static_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.global_static_strides;
|
|
auto attr = dict.get("global_static_strides");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `global_static_strides` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.shared_static_sizes;
|
|
auto attr = dict.get("shared_static_sizes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `shared_static_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MakeDmaDescriptorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.global_static_sizes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("global_static_sizes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.global_static_strides;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("global_static_strides",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.shared_static_sizes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("shared_static_sizes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MakeDmaDescriptorOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.global_static_sizes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.global_static_strides.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.shared_static_sizes.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MakeDmaDescriptorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "global_static_sizes")
|
|
return prop.global_static_sizes;
|
|
|
|
if (name == "global_static_strides")
|
|
return prop.global_static_strides;
|
|
|
|
if (name == "shared_static_sizes")
|
|
return prop.shared_static_sizes;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "global_static_sizes") {
|
|
prop.global_static_sizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.global_static_sizes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "global_static_strides") {
|
|
prop.global_static_strides = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.global_static_strides)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "shared_static_sizes") {
|
|
prop.shared_static_sizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.shared_static_sizes)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.global_static_sizes) attrs.append("global_static_sizes", prop.global_static_sizes);
|
|
|
|
if (prop.global_static_strides) attrs.append("global_static_strides", prop.global_static_strides);
|
|
|
|
if (prop.shared_static_sizes) attrs.append("shared_static_sizes", prop.shared_static_sizes);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaDescriptorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getGlobalStaticSizesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(attr, "global_static_sizes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getGlobalStaticStridesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(attr, "global_static_strides", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSharedStaticSizesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(attr, "shared_static_sizes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaDescriptorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.global_static_sizes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.global_static_strides)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.shared_static_sizes)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.global_static_sizes);
|
|
writer.writeAttribute(prop.global_static_strides);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
writer.writeAttribute(prop.shared_static_sizes);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeDmaDescriptorOp::getGlobalStaticSizes() {
|
|
auto attr = getGlobalStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeDmaDescriptorOp::getGlobalStaticStrides() {
|
|
auto attr = getGlobalStaticStridesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeDmaDescriptorOp::getSharedStaticSizes() {
|
|
auto attr = getSharedStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::setGlobalStaticSizes(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().global_static_sizes = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::setGlobalStaticStrides(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().global_static_strides = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::setSharedStaticSizes(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().shared_static_sizes = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type desc, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = global_static_sizes;
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = global_static_strides;
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = shared_static_sizes;
|
|
odsState.addTypes(desc);
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type desc, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type desc, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = global_static_sizes;
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = global_static_strides;
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = shared_static_sizes;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = global_static_sizes;
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = global_static_strides;
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = shared_static_sizes;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type desc, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = odsBuilder.getDenseI64ArrayAttr(global_static_sizes);
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = odsBuilder.getDenseI64ArrayAttr(global_static_strides);
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = odsBuilder.getDenseI64ArrayAttr(shared_static_sizes);
|
|
odsState.addTypes(desc);
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type desc, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type desc, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = odsBuilder.getDenseI64ArrayAttr(global_static_sizes);
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = odsBuilder.getDenseI64ArrayAttr(global_static_strides);
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = odsBuilder.getDenseI64ArrayAttr(shared_static_sizes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = odsBuilder.getDenseI64ArrayAttr(global_static_sizes);
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = odsBuilder.getDenseI64ArrayAttr(global_static_strides);
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = odsBuilder.getDenseI64ArrayAttr(shared_static_sizes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MakeDmaDescriptorOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MakeDmaDescriptorOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeDmaDescriptorOp MakeDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaDescriptorOp::verifyInvariantsImpl() {
|
|
auto tblgen_global_static_sizes = getProperties().global_static_sizes; (void)tblgen_global_static_sizes;
|
|
if (!tblgen_global_static_sizes) return emitOpError("requires attribute 'global_static_sizes'");
|
|
auto tblgen_global_static_strides = getProperties().global_static_strides; (void)tblgen_global_static_strides;
|
|
if (!tblgen_global_static_strides) return emitOpError("requires attribute 'global_static_strides'");
|
|
auto tblgen_shared_static_sizes = getProperties().shared_static_sizes; (void)tblgen_shared_static_sizes;
|
|
if (!tblgen_shared_static_sizes) return emitOpError("requires attribute 'shared_static_sizes'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(*this, tblgen_global_static_sizes, "global_static_sizes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(*this, tblgen_global_static_strides, "global_static_strides")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(*this, tblgen_shared_static_sizes, "shared_static_sizes")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU19(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup4 = getODSOperands(4);
|
|
|
|
if (valueGroup4.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup4.size();
|
|
}
|
|
|
|
for (auto v : valueGroup4) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU20(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup5 = getODSOperands(5);
|
|
|
|
if (valueGroup5.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup5.size();
|
|
}
|
|
|
|
for (auto v : valueGroup5) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup6 = getODSOperands(6);
|
|
|
|
if (valueGroup6.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup6.size();
|
|
}
|
|
|
|
for (auto v : valueGroup6) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup7 = getODSOperands(7);
|
|
|
|
if (valueGroup7.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup7.size();
|
|
}
|
|
|
|
for (auto v : valueGroup7) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup8 = getODSOperands(8);
|
|
|
|
if (valueGroup8.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup8.size();
|
|
}
|
|
|
|
for (auto v : valueGroup8) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup9 = getODSOperands(9);
|
|
|
|
for (auto v : valueGroup9) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup10 = getODSOperands(10);
|
|
|
|
if (valueGroup10.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup10.size();
|
|
}
|
|
|
|
for (auto v : valueGroup10) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU21(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup11 = getODSOperands(11);
|
|
|
|
if (valueGroup11.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup11.size();
|
|
}
|
|
|
|
for (auto v : valueGroup11) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup12 = getODSOperands(12);
|
|
|
|
if (valueGroup12.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup12.size();
|
|
}
|
|
|
|
for (auto v : valueGroup12) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU21(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU22(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaDescriptorOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeDmaDescriptorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::amdgpu::TDMDescriptorType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult MakeDmaDescriptorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand baseRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(&baseRawOperand, 1); ::llvm::SMLoc baseOperandsLoc;
|
|
(void)baseOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_dynamic_sizesOperands;
|
|
::llvm::SMLoc global_dynamic_sizesOperandsLoc;
|
|
(void)global_dynamic_sizesOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr global_static_sizesAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_dynamic_stridesOperands;
|
|
::llvm::SMLoc global_dynamic_stridesOperandsLoc;
|
|
(void)global_dynamic_stridesOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr global_static_stridesAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> shared_dynamic_sizesOperands;
|
|
::llvm::SMLoc shared_dynamic_sizesOperandsLoc;
|
|
(void)shared_dynamic_sizesOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr shared_static_sizesAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> pad_amountOperands;
|
|
::llvm::SMLoc pad_amountOperandsLoc;
|
|
(void)pad_amountOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> pad_intervalOperands;
|
|
::llvm::SMLoc pad_intervalOperandsLoc;
|
|
(void)pad_intervalOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> workgroup_maskOperands;
|
|
::llvm::SMLoc workgroup_maskOperandsLoc;
|
|
(void)workgroup_maskOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> early_timeoutOperands;
|
|
::llvm::SMLoc early_timeoutOperandsLoc;
|
|
(void)early_timeoutOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> atomic_barrier_addressOperands;
|
|
::llvm::SMLoc atomic_barrier_addressOperandsLoc;
|
|
(void)atomic_barrier_addressOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> atomic_barrier_indicesOperands;
|
|
::llvm::SMLoc atomic_barrier_indicesOperandsLoc;
|
|
(void)atomic_barrier_indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> atomic_barrier_addressTypes;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_incrementOperands;
|
|
::llvm::SMLoc global_incrementOperandsLoc;
|
|
(void)global_incrementOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lds_incrementOperands;
|
|
::llvm::SMLoc lds_incrementOperandsLoc;
|
|
(void)lds_incrementOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> iteration_countOperands;
|
|
::llvm::SMLoc iteration_countOperandsLoc;
|
|
(void)iteration_countOperandsLoc;
|
|
::mlir::Type baseRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
|
|
|
|
baseOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(baseRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("globalSize"))
|
|
return ::mlir::failure();
|
|
{
|
|
global_dynamic_sizesOperandsLoc = parser.getCurrentLocation();
|
|
auto odsResult = parseDynamicIndexList(parser, global_dynamic_sizesOperands, global_static_sizesAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<MakeDmaDescriptorOp::Properties>().global_static_sizes = global_static_sizesAttr;
|
|
}
|
|
if (parser.parseKeyword("globalStride"))
|
|
return ::mlir::failure();
|
|
{
|
|
global_dynamic_stridesOperandsLoc = parser.getCurrentLocation();
|
|
auto odsResult = parseDynamicIndexList(parser, global_dynamic_stridesOperands, global_static_stridesAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<MakeDmaDescriptorOp::Properties>().global_static_strides = global_static_stridesAttr;
|
|
}
|
|
if (parser.parseKeyword("sharedSize"))
|
|
return ::mlir::failure();
|
|
{
|
|
shared_dynamic_sizesOperandsLoc = parser.getCurrentLocation();
|
|
auto odsResult = parseDynamicIndexList(parser, shared_dynamic_sizesOperands, shared_static_sizesAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<MakeDmaDescriptorOp::Properties>().shared_static_sizes = shared_static_sizesAttr;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("padShared"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
pad_amountOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
pad_amountOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseKeyword("every"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
pad_intervalOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
pad_intervalOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("workgroupMask"))) {
|
|
|
|
{
|
|
workgroup_maskOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
workgroup_maskOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("earlyTimeout"))) {
|
|
|
|
{
|
|
early_timeoutOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
early_timeoutOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("atomicBarrier"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
atomic_barrier_addressOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
atomic_barrier_addressOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
atomic_barrier_indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(atomic_barrier_indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type optionalType;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalType(optionalType);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
atomic_barrier_addressTypes.push_back(optionalType);
|
|
}
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("iterate"))) {
|
|
|
|
{
|
|
global_incrementOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
global_incrementOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
lds_incrementOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
lds_incrementOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
iteration_countOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
iteration_countOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(baseRawType))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(allResultTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_dynamic_sizesOperands.size()), static_cast<int32_t>(global_dynamic_stridesOperands.size()), static_cast<int32_t>(shared_dynamic_sizesOperands.size()), static_cast<int32_t>(workgroup_maskOperands.size()), static_cast<int32_t>(early_timeoutOperands.size()), static_cast<int32_t>(pad_amountOperands.size()), static_cast<int32_t>(pad_intervalOperands.size()), static_cast<int32_t>(atomic_barrier_addressOperands.size()), static_cast<int32_t>(atomic_barrier_indicesOperands.size()), static_cast<int32_t>(global_incrementOperands.size()), static_cast<int32_t>(lds_incrementOperands.size()), static_cast<int32_t>(iteration_countOperands.size())}), result.getOrAddProperties<MakeDmaDescriptorOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
::mlir::Type odsBuildableType1 = ::mlir::VectorType::get({16} ,parser.getBuilder().getIntegerType(1));
|
|
::mlir::Type odsBuildableType2 = parser.getBuilder().getIntegerType(1);
|
|
::mlir::Type odsBuildableType3 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(allResultTypes);
|
|
if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(global_dynamic_sizesOperands, odsBuildableType0, global_dynamic_sizesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(global_dynamic_stridesOperands, odsBuildableType0, global_dynamic_stridesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(shared_dynamic_sizesOperands, odsBuildableType0, shared_dynamic_sizesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!workgroup_maskOperands.empty()) {
|
|
if (parser.resolveOperands(workgroup_maskOperands, odsBuildableType1, workgroup_maskOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!early_timeoutOperands.empty()) {
|
|
if (parser.resolveOperands(early_timeoutOperands, odsBuildableType2, early_timeoutOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!pad_amountOperands.empty()) {
|
|
if (parser.resolveOperands(pad_amountOperands, odsBuildableType3, pad_amountOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!pad_intervalOperands.empty()) {
|
|
if (parser.resolveOperands(pad_intervalOperands, odsBuildableType3, pad_intervalOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!atomic_barrier_addressOperands.empty()) {
|
|
if (parser.resolveOperands(atomic_barrier_addressOperands, atomic_barrier_addressTypes, atomic_barrier_addressOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.resolveOperands(atomic_barrier_indicesOperands, odsBuildableType0, atomic_barrier_indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!global_incrementOperands.empty()) {
|
|
if (parser.resolveOperands(global_incrementOperands, odsBuildableType0, global_incrementOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!lds_incrementOperands.empty()) {
|
|
if (parser.resolveOperands(lds_incrementOperands, odsBuildableType3, lds_incrementOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!iteration_countOperands.empty()) {
|
|
if (parser.resolveOperands(iteration_countOperands, odsBuildableType0, iteration_countOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase();
|
|
_odsPrinter << ' ' << "globalSize";
|
|
_odsPrinter << ' ';
|
|
printDynamicIndexList(_odsPrinter, *this, getGlobalDynamicSizes(), getGlobalStaticSizesAttr());
|
|
_odsPrinter << ' ' << "globalStride";
|
|
_odsPrinter << ' ';
|
|
printDynamicIndexList(_odsPrinter, *this, getGlobalDynamicStrides(), getGlobalStaticStridesAttr());
|
|
_odsPrinter << ' ' << "sharedSize";
|
|
_odsPrinter << ' ';
|
|
printDynamicIndexList(_odsPrinter, *this, getSharedDynamicSizes(), getSharedStaticSizesAttr());
|
|
if (getPadAmount()) {
|
|
_odsPrinter << ' ' << "padShared";
|
|
_odsPrinter << "(";
|
|
if (::mlir::Value value = getPadAmount())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ' ' << "every";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getPadInterval())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ")";
|
|
}
|
|
if (getWorkgroupMask()) {
|
|
_odsPrinter << ' ' << "workgroupMask";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getWorkgroupMask())
|
|
_odsPrinter << value;
|
|
if (getEarlyTimeout()) {
|
|
_odsPrinter << ' ' << "earlyTimeout";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getEarlyTimeout())
|
|
_odsPrinter << value;
|
|
}
|
|
}
|
|
if (getAtomicBarrierAddress()) {
|
|
_odsPrinter << ' ' << "atomicBarrier";
|
|
_odsPrinter << "(";
|
|
if (::mlir::Value value = getAtomicBarrierAddress())
|
|
_odsPrinter << value;
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getAtomicBarrierIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << (getAtomicBarrierAddress() ? ::llvm::ArrayRef<::mlir::Type>(getAtomicBarrierAddress().getType()) : ::llvm::ArrayRef<::mlir::Type>());
|
|
_odsPrinter << ")";
|
|
}
|
|
if (getGlobalIncrement()) {
|
|
_odsPrinter << ' ' << "iterate";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getGlobalIncrement())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getLdsIncrement())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getIterationCount())
|
|
_odsPrinter << value;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("global_static_sizes");
|
|
elidedAttrs.push_back("global_static_strides");
|
|
elidedAttrs.push_back("shared_static_sizes");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase().getType();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOperation()->getResultTypes();
|
|
}
|
|
|
|
void MakeDmaDescriptorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MakeDmaDescriptorOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::MakeDmaDescriptorOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::MakeGatherDmaBaseOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MakeGatherDmaBaseOpGenericAdaptorBase::MakeGatherDmaBaseOpGenericAdaptorBase(MakeGatherDmaBaseOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> MakeGatherDmaBaseOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
MakeGatherDmaBaseOpAdaptor::MakeGatherDmaBaseOpAdaptor(MakeGatherDmaBaseOp op) : MakeGatherDmaBaseOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaBaseOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> MakeGatherDmaBaseOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaBaseOp::getGlobalIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaBaseOp::getLdsIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaBaseOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MakeGatherDmaBaseOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MakeGatherDmaBaseOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MakeGatherDmaBaseOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaBaseOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaBaseOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type base, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
odsState.addOperands(global);
|
|
odsState.addOperands(global_indices);
|
|
odsState.addOperands(lds);
|
|
odsState.addOperands(lds_indices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_indices.size()), 1, static_cast<int32_t>(lds_indices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.addTypes(base);
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type base, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type base, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
odsState.addOperands(global);
|
|
odsState.addOperands(global_indices);
|
|
odsState.addOperands(lds);
|
|
odsState.addOperands(lds_indices);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_indices.size()), 1, static_cast<int32_t>(lds_indices.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value global, ::mlir::ValueRange global_indices, ::mlir::Value lds, ::mlir::ValueRange lds_indices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(global)>(global), std::forward<decltype(global_indices)>(global_indices), std::forward<decltype(lds)>(lds), std::forward<decltype(lds_indices)>(lds_indices));
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MakeGatherDmaBaseOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaBaseOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaBaseOp MakeGatherDmaBaseOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaBaseOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU23(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))
|
|
return emitOpError("failed to verify that all of {global, lds} have same element type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaBaseOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult MakeGatherDmaBaseOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand globalRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> globalOperands(&globalRawOperand, 1); ::llvm::SMLoc globalOperandsLoc;
|
|
(void)globalOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_indicesOperands;
|
|
::llvm::SMLoc global_indicesOperandsLoc;
|
|
(void)global_indicesOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand ldsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> ldsOperands(&ldsRawOperand, 1); ::llvm::SMLoc ldsOperandsLoc;
|
|
(void)ldsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lds_indicesOperands;
|
|
::llvm::SMLoc lds_indicesOperandsLoc;
|
|
(void)lds_indicesOperandsLoc;
|
|
::mlir::Type globalRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> globalTypes(&globalRawType, 1);
|
|
::mlir::Type ldsRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> ldsTypes(&ldsRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
|
|
|
|
globalOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(globalRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
global_indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(global_indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
ldsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(ldsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
lds_indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(lds_indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
globalRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
ldsRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(allResultTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(global_indicesOperands.size()), 1, static_cast<int32_t>(lds_indicesOperands.size())}), result.getOrAddProperties<MakeGatherDmaBaseOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
result.addTypes(allResultTypes);
|
|
if (parser.resolveOperands(globalOperands, globalTypes, globalOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(global_indicesOperands, odsBuildableType0, global_indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(ldsOperands, ldsTypes, ldsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(lds_indicesOperands, odsBuildableType0, lds_indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getGlobal();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getGlobalIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLds();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getLdsIndices();
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getGlobal().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getLds().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOperation()->getResultTypes();
|
|
}
|
|
|
|
void MakeGatherDmaBaseOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MakeGatherDmaBaseOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::MakeGatherDmaBaseOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::MakeGatherDmaDescriptorOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MakeGatherDmaDescriptorOpGenericAdaptorBase::MakeGatherDmaDescriptorOpGenericAdaptorBase(MakeGatherDmaDescriptorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> MakeGatherDmaDescriptorOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeGatherDmaDescriptorOpGenericAdaptorBase::getGlobalStaticSizes() {
|
|
auto attr = getGlobalStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeGatherDmaDescriptorOpGenericAdaptorBase::getGlobalStaticStrides() {
|
|
auto attr = getGlobalStaticStridesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeGatherDmaDescriptorOpGenericAdaptorBase::getSharedStaticSizes() {
|
|
auto attr = getSharedStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
MakeGatherDmaDescriptorOpAdaptor::MakeGatherDmaDescriptorOpAdaptor(MakeGatherDmaDescriptorOp op) : MakeGatherDmaDescriptorOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaDescriptorOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_global_static_sizes = getProperties().global_static_sizes; (void)tblgen_global_static_sizes;
|
|
if (!tblgen_global_static_sizes) return emitError(loc, "'amdgpu.make_gather_dma_descriptor' op requires attribute 'global_static_sizes'");
|
|
auto tblgen_global_static_strides = getProperties().global_static_strides; (void)tblgen_global_static_strides;
|
|
if (!tblgen_global_static_strides) return emitError(loc, "'amdgpu.make_gather_dma_descriptor' op requires attribute 'global_static_strides'");
|
|
auto tblgen_shared_static_sizes = getProperties().shared_static_sizes; (void)tblgen_shared_static_sizes;
|
|
if (!tblgen_shared_static_sizes) return emitError(loc, "'amdgpu.make_gather_dma_descriptor' op requires attribute 'shared_static_sizes'");
|
|
|
|
if (tblgen_global_static_sizes && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_global_static_sizes))))
|
|
return emitError(loc, "'amdgpu.make_gather_dma_descriptor' op attribute 'global_static_sizes' failed to satisfy constraint: i64 dense array attribute");
|
|
|
|
if (tblgen_global_static_strides && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_global_static_strides))))
|
|
return emitError(loc, "'amdgpu.make_gather_dma_descriptor' op attribute 'global_static_strides' failed to satisfy constraint: i64 dense array attribute");
|
|
|
|
if (tblgen_shared_static_sizes && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_shared_static_sizes))))
|
|
return emitError(loc, "'amdgpu.make_gather_dma_descriptor' op attribute 'shared_static_sizes' failed to satisfy constraint: i64 dense array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> MakeGatherDmaDescriptorOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getGlobalDynamicSizesMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getGlobalDynamicStridesMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getSharedDynamicSizesMutable() {
|
|
auto range = getODSOperandIndexAndLength(4);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getWorkgroupMaskMutable() {
|
|
auto range = getODSOperandIndexAndLength(5);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(5u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getEarlyTimeoutMutable() {
|
|
auto range = getODSOperandIndexAndLength(6);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(6u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getPadAmountMutable() {
|
|
auto range = getODSOperandIndexAndLength(7);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(7u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getPadIntervalMutable() {
|
|
auto range = getODSOperandIndexAndLength(8);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(8u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getAtomicBarrierAddressMutable() {
|
|
auto range = getODSOperandIndexAndLength(9);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(9u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getAtomicBarrierIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(10);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(10u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getGlobalIncrementMutable() {
|
|
auto range = getODSOperandIndexAndLength(11);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(11u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getLdsIncrementMutable() {
|
|
auto range = getODSOperandIndexAndLength(12);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(12u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange MakeGatherDmaDescriptorOp::getIterationCountMutable() {
|
|
auto range = getODSOperandIndexAndLength(13);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(13u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaDescriptorOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.global_static_sizes;
|
|
auto attr = dict.get("global_static_sizes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `global_static_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.global_static_strides;
|
|
auto attr = dict.get("global_static_strides");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `global_static_strides` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.shared_static_sizes;
|
|
auto attr = dict.get("shared_static_sizes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `shared_static_sizes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MakeGatherDmaDescriptorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.global_static_sizes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("global_static_sizes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.global_static_strides;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("global_static_strides",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.shared_static_sizes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("shared_static_sizes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MakeGatherDmaDescriptorOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.global_static_sizes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.global_static_strides.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.shared_static_sizes.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MakeGatherDmaDescriptorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "global_static_sizes")
|
|
return prop.global_static_sizes;
|
|
|
|
if (name == "global_static_strides")
|
|
return prop.global_static_strides;
|
|
|
|
if (name == "shared_static_sizes")
|
|
return prop.shared_static_sizes;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "global_static_sizes") {
|
|
prop.global_static_sizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.global_static_sizes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "global_static_strides") {
|
|
prop.global_static_strides = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.global_static_strides)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "shared_static_sizes") {
|
|
prop.shared_static_sizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.shared_static_sizes)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.global_static_sizes) attrs.append("global_static_sizes", prop.global_static_sizes);
|
|
|
|
if (prop.global_static_strides) attrs.append("global_static_strides", prop.global_static_strides);
|
|
|
|
if (prop.shared_static_sizes) attrs.append("shared_static_sizes", prop.shared_static_sizes);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaDescriptorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getGlobalStaticSizesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(attr, "global_static_sizes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getGlobalStaticStridesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(attr, "global_static_strides", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSharedStaticSizesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(attr, "shared_static_sizes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaDescriptorOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.global_static_sizes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.global_static_strides)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.shared_static_sizes)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.global_static_sizes);
|
|
writer.writeAttribute(prop.global_static_strides);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
writer.writeAttribute(prop.shared_static_sizes);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeGatherDmaDescriptorOp::getGlobalStaticSizes() {
|
|
auto attr = getGlobalStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeGatherDmaDescriptorOp::getGlobalStaticStrides() {
|
|
auto attr = getGlobalStaticStridesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::llvm::ArrayRef<int64_t> MakeGatherDmaDescriptorOp::getSharedStaticSizes() {
|
|
auto attr = getSharedStaticSizesAttr();
|
|
return attr;
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::setGlobalStaticSizes(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().global_static_sizes = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::setGlobalStaticStrides(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().global_static_strides = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::setSharedStaticSizes(::llvm::ArrayRef<int64_t> attrValue) {
|
|
getProperties().shared_static_sizes = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type desc, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = global_static_sizes;
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = global_static_strides;
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = shared_static_sizes;
|
|
odsState.addTypes(desc);
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type desc, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type desc, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = global_static_sizes;
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = global_static_strides;
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = shared_static_sizes;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeGatherDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = global_static_sizes;
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = global_static_strides;
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = shared_static_sizes;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::mlir::DenseI64ArrayAttr global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::mlir::DenseI64ArrayAttr global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::mlir::DenseI64ArrayAttr shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type desc, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = odsBuilder.getDenseI64ArrayAttr(global_static_sizes);
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = odsBuilder.getDenseI64ArrayAttr(global_static_strides);
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = odsBuilder.getDenseI64ArrayAttr(shared_static_sizes);
|
|
odsState.addTypes(desc);
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type desc, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type desc, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(desc)>(desc), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = odsBuilder.getDenseI64ArrayAttr(global_static_sizes);
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = odsBuilder.getDenseI64ArrayAttr(global_static_strides);
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = odsBuilder.getDenseI64ArrayAttr(shared_static_sizes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeGatherDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
odsState.addOperands(base);
|
|
odsState.addOperands(indices);
|
|
odsState.addOperands(global_dynamic_sizes);
|
|
odsState.addOperands(global_dynamic_strides);
|
|
odsState.addOperands(shared_dynamic_sizes);
|
|
if (workgroup_mask)
|
|
odsState.addOperands(workgroup_mask);
|
|
if (early_timeout)
|
|
odsState.addOperands(early_timeout);
|
|
if (pad_amount)
|
|
odsState.addOperands(pad_amount);
|
|
if (pad_interval)
|
|
odsState.addOperands(pad_interval);
|
|
if (atomic_barrier_address)
|
|
odsState.addOperands(atomic_barrier_address);
|
|
odsState.addOperands(atomic_barrier_indices);
|
|
if (global_increment)
|
|
odsState.addOperands(global_increment);
|
|
if (lds_increment)
|
|
odsState.addOperands(lds_increment);
|
|
if (iteration_count)
|
|
odsState.addOperands(iteration_count);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(global_dynamic_sizes.size()), static_cast<int32_t>(global_dynamic_strides.size()), static_cast<int32_t>(shared_dynamic_sizes.size()), (workgroup_mask ? 1 : 0), (early_timeout ? 1 : 0), (pad_amount ? 1 : 0), (pad_interval ? 1 : 0), (atomic_barrier_address ? 1 : 0), static_cast<int32_t>(atomic_barrier_indices.size()), (global_increment ? 1 : 0), (lds_increment ? 1 : 0), (iteration_count ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().global_static_sizes = odsBuilder.getDenseI64ArrayAttr(global_static_sizes);
|
|
odsState.getOrAddProperties<Properties>().global_static_strides = odsBuilder.getDenseI64ArrayAttr(global_static_strides);
|
|
odsState.getOrAddProperties<Properties>().shared_static_sizes = odsBuilder.getDenseI64ArrayAttr(shared_static_sizes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value base, ::mlir::Value indices, ::mlir::ValueRange global_dynamic_sizes, ::llvm::ArrayRef<int64_t> global_static_sizes, ::mlir::ValueRange global_dynamic_strides, ::llvm::ArrayRef<int64_t> global_static_strides, ::mlir::ValueRange shared_dynamic_sizes, ::llvm::ArrayRef<int64_t> shared_static_sizes, /*optional*/::mlir::Value workgroup_mask, /*optional*/::mlir::Value early_timeout, /*optional*/::mlir::Value pad_amount, /*optional*/::mlir::Value pad_interval, /*optional*/::mlir::Value atomic_barrier_address, ::mlir::ValueRange atomic_barrier_indices, /*optional*/::mlir::Value global_increment, /*optional*/::mlir::Value lds_increment, /*optional*/::mlir::Value iteration_count) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(base)>(base), std::forward<decltype(indices)>(indices), std::forward<decltype(global_dynamic_sizes)>(global_dynamic_sizes), std::forward<decltype(global_static_sizes)>(global_static_sizes), std::forward<decltype(global_dynamic_strides)>(global_dynamic_strides), std::forward<decltype(global_static_strides)>(global_static_strides), std::forward<decltype(shared_dynamic_sizes)>(shared_dynamic_sizes), std::forward<decltype(shared_static_sizes)>(shared_static_sizes), std::forward<decltype(workgroup_mask)>(workgroup_mask), std::forward<decltype(early_timeout)>(early_timeout), std::forward<decltype(pad_amount)>(pad_amount), std::forward<decltype(pad_interval)>(pad_interval), std::forward<decltype(atomic_barrier_address)>(atomic_barrier_address), std::forward<decltype(atomic_barrier_indices)>(atomic_barrier_indices), std::forward<decltype(global_increment)>(global_increment), std::forward<decltype(lds_increment)>(lds_increment), std::forward<decltype(iteration_count)>(iteration_count));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MakeGatherDmaDescriptorOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MakeGatherDmaDescriptorOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeGatherDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(MakeGatherDmaDescriptorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MakeGatherDmaDescriptorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MakeGatherDmaDescriptorOp MakeGatherDmaDescriptorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaDescriptorOp::verifyInvariantsImpl() {
|
|
auto tblgen_global_static_sizes = getProperties().global_static_sizes; (void)tblgen_global_static_sizes;
|
|
if (!tblgen_global_static_sizes) return emitOpError("requires attribute 'global_static_sizes'");
|
|
auto tblgen_global_static_strides = getProperties().global_static_strides; (void)tblgen_global_static_strides;
|
|
if (!tblgen_global_static_strides) return emitOpError("requires attribute 'global_static_strides'");
|
|
auto tblgen_shared_static_sizes = getProperties().shared_static_sizes; (void)tblgen_shared_static_sizes;
|
|
if (!tblgen_shared_static_sizes) return emitOpError("requires attribute 'shared_static_sizes'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(*this, tblgen_global_static_sizes, "global_static_sizes")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(*this, tblgen_global_static_strides, "global_static_strides")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU14(*this, tblgen_shared_static_sizes, "shared_static_sizes")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU23(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU24(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup4 = getODSOperands(4);
|
|
|
|
for (auto v : valueGroup4) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup5 = getODSOperands(5);
|
|
|
|
if (valueGroup5.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup5.size();
|
|
}
|
|
|
|
for (auto v : valueGroup5) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU20(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup6 = getODSOperands(6);
|
|
|
|
if (valueGroup6.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup6.size();
|
|
}
|
|
|
|
for (auto v : valueGroup6) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup7 = getODSOperands(7);
|
|
|
|
if (valueGroup7.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup7.size();
|
|
}
|
|
|
|
for (auto v : valueGroup7) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup8 = getODSOperands(8);
|
|
|
|
if (valueGroup8.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup8.size();
|
|
}
|
|
|
|
for (auto v : valueGroup8) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup9 = getODSOperands(9);
|
|
|
|
if (valueGroup9.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup9.size();
|
|
}
|
|
|
|
for (auto v : valueGroup9) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU5(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup10 = getODSOperands(10);
|
|
|
|
for (auto v : valueGroup10) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup11 = getODSOperands(11);
|
|
|
|
if (valueGroup11.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup11.size();
|
|
}
|
|
|
|
for (auto v : valueGroup11) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU21(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup12 = getODSOperands(12);
|
|
|
|
if (valueGroup12.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup12.size();
|
|
}
|
|
|
|
for (auto v : valueGroup12) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup13 = getODSOperands(13);
|
|
|
|
if (valueGroup13.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup13.size();
|
|
}
|
|
|
|
for (auto v : valueGroup13) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU21(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU22(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaDescriptorOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult MakeGatherDmaDescriptorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::mlir::amdgpu::TDMDescriptorType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult MakeGatherDmaDescriptorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand baseRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> baseOperands(&baseRawOperand, 1); ::llvm::SMLoc baseOperandsLoc;
|
|
(void)baseOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand indicesRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> indicesOperands(&indicesRawOperand, 1); ::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_dynamic_sizesOperands;
|
|
::llvm::SMLoc global_dynamic_sizesOperandsLoc;
|
|
(void)global_dynamic_sizesOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr global_static_sizesAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_dynamic_stridesOperands;
|
|
::llvm::SMLoc global_dynamic_stridesOperandsLoc;
|
|
(void)global_dynamic_stridesOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr global_static_stridesAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> shared_dynamic_sizesOperands;
|
|
::llvm::SMLoc shared_dynamic_sizesOperandsLoc;
|
|
(void)shared_dynamic_sizesOperandsLoc;
|
|
::mlir::DenseI64ArrayAttr shared_static_sizesAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> pad_amountOperands;
|
|
::llvm::SMLoc pad_amountOperandsLoc;
|
|
(void)pad_amountOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> pad_intervalOperands;
|
|
::llvm::SMLoc pad_intervalOperandsLoc;
|
|
(void)pad_intervalOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> workgroup_maskOperands;
|
|
::llvm::SMLoc workgroup_maskOperandsLoc;
|
|
(void)workgroup_maskOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> early_timeoutOperands;
|
|
::llvm::SMLoc early_timeoutOperandsLoc;
|
|
(void)early_timeoutOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> atomic_barrier_addressOperands;
|
|
::llvm::SMLoc atomic_barrier_addressOperandsLoc;
|
|
(void)atomic_barrier_addressOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> atomic_barrier_indicesOperands;
|
|
::llvm::SMLoc atomic_barrier_indicesOperandsLoc;
|
|
(void)atomic_barrier_indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> atomic_barrier_addressTypes;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> global_incrementOperands;
|
|
::llvm::SMLoc global_incrementOperandsLoc;
|
|
(void)global_incrementOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> lds_incrementOperands;
|
|
::llvm::SMLoc lds_incrementOperandsLoc;
|
|
(void)lds_incrementOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> iteration_countOperands;
|
|
::llvm::SMLoc iteration_countOperandsLoc;
|
|
(void)iteration_countOperandsLoc;
|
|
::mlir::Type baseRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> baseTypes(&baseRawType, 1);
|
|
::mlir::Type indicesRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> indicesTypes(&indicesRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> allResultTypes;
|
|
|
|
baseOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(baseRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(indicesRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("globalSize"))
|
|
return ::mlir::failure();
|
|
{
|
|
global_dynamic_sizesOperandsLoc = parser.getCurrentLocation();
|
|
auto odsResult = parseDynamicIndexList(parser, global_dynamic_sizesOperands, global_static_sizesAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<MakeGatherDmaDescriptorOp::Properties>().global_static_sizes = global_static_sizesAttr;
|
|
}
|
|
if (parser.parseKeyword("globalStride"))
|
|
return ::mlir::failure();
|
|
{
|
|
global_dynamic_stridesOperandsLoc = parser.getCurrentLocation();
|
|
auto odsResult = parseDynamicIndexList(parser, global_dynamic_stridesOperands, global_static_stridesAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<MakeGatherDmaDescriptorOp::Properties>().global_static_strides = global_static_stridesAttr;
|
|
}
|
|
if (parser.parseKeyword("sharedSize"))
|
|
return ::mlir::failure();
|
|
{
|
|
shared_dynamic_sizesOperandsLoc = parser.getCurrentLocation();
|
|
auto odsResult = parseDynamicIndexList(parser, shared_dynamic_sizesOperands, shared_static_sizesAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<MakeGatherDmaDescriptorOp::Properties>().shared_static_sizes = shared_static_sizesAttr;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("padShared"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
pad_amountOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
pad_amountOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseKeyword("every"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
pad_intervalOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
pad_intervalOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("workgroupMask"))) {
|
|
|
|
{
|
|
workgroup_maskOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
workgroup_maskOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("earlyTimeout"))) {
|
|
|
|
{
|
|
early_timeoutOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
early_timeoutOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("atomicBarrier"))) {
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
atomic_barrier_addressOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
atomic_barrier_addressOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
atomic_barrier_indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(atomic_barrier_indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type optionalType;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalType(optionalType);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
atomic_barrier_addressTypes.push_back(optionalType);
|
|
}
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("iterate"))) {
|
|
|
|
{
|
|
global_incrementOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
global_incrementOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
lds_incrementOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
lds_incrementOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
iteration_countOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
iteration_countOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(baseRawType))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
indicesRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(allResultTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(global_dynamic_sizesOperands.size()), static_cast<int32_t>(global_dynamic_stridesOperands.size()), static_cast<int32_t>(shared_dynamic_sizesOperands.size()), static_cast<int32_t>(workgroup_maskOperands.size()), static_cast<int32_t>(early_timeoutOperands.size()), static_cast<int32_t>(pad_amountOperands.size()), static_cast<int32_t>(pad_intervalOperands.size()), static_cast<int32_t>(atomic_barrier_addressOperands.size()), static_cast<int32_t>(atomic_barrier_indicesOperands.size()), static_cast<int32_t>(global_incrementOperands.size()), static_cast<int32_t>(lds_incrementOperands.size()), static_cast<int32_t>(iteration_countOperands.size())}), result.getOrAddProperties<MakeGatherDmaDescriptorOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
::mlir::Type odsBuildableType1 = ::mlir::VectorType::get({16} ,parser.getBuilder().getIntegerType(1));
|
|
::mlir::Type odsBuildableType2 = parser.getBuilder().getIntegerType(1);
|
|
::mlir::Type odsBuildableType3 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(allResultTypes);
|
|
if (parser.resolveOperands(baseOperands, baseTypes, baseOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(global_dynamic_sizesOperands, odsBuildableType0, global_dynamic_sizesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(global_dynamic_stridesOperands, odsBuildableType0, global_dynamic_stridesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(shared_dynamic_sizesOperands, odsBuildableType0, shared_dynamic_sizesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!workgroup_maskOperands.empty()) {
|
|
if (parser.resolveOperands(workgroup_maskOperands, odsBuildableType1, workgroup_maskOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!early_timeoutOperands.empty()) {
|
|
if (parser.resolveOperands(early_timeoutOperands, odsBuildableType2, early_timeoutOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!pad_amountOperands.empty()) {
|
|
if (parser.resolveOperands(pad_amountOperands, odsBuildableType3, pad_amountOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!pad_intervalOperands.empty()) {
|
|
if (parser.resolveOperands(pad_intervalOperands, odsBuildableType3, pad_intervalOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!atomic_barrier_addressOperands.empty()) {
|
|
if (parser.resolveOperands(atomic_barrier_addressOperands, atomic_barrier_addressTypes, atomic_barrier_addressOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.resolveOperands(atomic_barrier_indicesOperands, odsBuildableType0, atomic_barrier_indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!global_incrementOperands.empty()) {
|
|
if (parser.resolveOperands(global_incrementOperands, odsBuildableType0, global_incrementOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!lds_incrementOperands.empty()) {
|
|
if (parser.resolveOperands(lds_incrementOperands, odsBuildableType3, lds_incrementOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!iteration_countOperands.empty()) {
|
|
if (parser.resolveOperands(iteration_countOperands, odsBuildableType0, iteration_countOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << "globalSize";
|
|
_odsPrinter << ' ';
|
|
printDynamicIndexList(_odsPrinter, *this, getGlobalDynamicSizes(), getGlobalStaticSizesAttr());
|
|
_odsPrinter << ' ' << "globalStride";
|
|
_odsPrinter << ' ';
|
|
printDynamicIndexList(_odsPrinter, *this, getGlobalDynamicStrides(), getGlobalStaticStridesAttr());
|
|
_odsPrinter << ' ' << "sharedSize";
|
|
_odsPrinter << ' ';
|
|
printDynamicIndexList(_odsPrinter, *this, getSharedDynamicSizes(), getSharedStaticSizesAttr());
|
|
if (getPadAmount()) {
|
|
_odsPrinter << ' ' << "padShared";
|
|
_odsPrinter << "(";
|
|
if (::mlir::Value value = getPadAmount())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ' ' << "every";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getPadInterval())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ")";
|
|
}
|
|
if (getWorkgroupMask()) {
|
|
_odsPrinter << ' ' << "workgroupMask";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getWorkgroupMask())
|
|
_odsPrinter << value;
|
|
if (getEarlyTimeout()) {
|
|
_odsPrinter << ' ' << "earlyTimeout";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getEarlyTimeout())
|
|
_odsPrinter << value;
|
|
}
|
|
}
|
|
if (getAtomicBarrierAddress()) {
|
|
_odsPrinter << ' ' << "atomicBarrier";
|
|
_odsPrinter << "(";
|
|
if (::mlir::Value value = getAtomicBarrierAddress())
|
|
_odsPrinter << value;
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getAtomicBarrierIndices();
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << (getAtomicBarrierAddress() ? ::llvm::ArrayRef<::mlir::Type>(getAtomicBarrierAddress().getType()) : ::llvm::ArrayRef<::mlir::Type>());
|
|
_odsPrinter << ")";
|
|
}
|
|
if (getGlobalIncrement()) {
|
|
_odsPrinter << ' ' << "iterate";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getGlobalIncrement())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getLdsIncrement())
|
|
_odsPrinter << value;
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getIterationCount())
|
|
_odsPrinter << value;
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("global_static_sizes");
|
|
elidedAttrs.push_back("global_static_strides");
|
|
elidedAttrs.push_back("shared_static_sizes");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBase().getType();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getIndices().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getOperation()->getResultTypes();
|
|
}
|
|
|
|
void MakeGatherDmaDescriptorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MakeGatherDmaDescriptorOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::MakeGatherDmaDescriptorOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::MemoryCounterWaitOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
MemoryCounterWaitOpGenericAdaptorBase::MemoryCounterWaitOpGenericAdaptorBase(MemoryCounterWaitOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOpGenericAdaptorBase::getLoad() {
|
|
auto attr = getLoadAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOpGenericAdaptorBase::getStore() {
|
|
auto attr = getStoreAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOpGenericAdaptorBase::getDs() {
|
|
auto attr = getDsAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOpGenericAdaptorBase::getExp() {
|
|
auto attr = getExpAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOpGenericAdaptorBase::getTensor() {
|
|
auto attr = getTensorAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
MemoryCounterWaitOpAdaptor::MemoryCounterWaitOpAdaptor(MemoryCounterWaitOp op) : MemoryCounterWaitOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult MemoryCounterWaitOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_ds = getProperties().ds; (void)tblgen_ds;
|
|
auto tblgen_exp = getProperties().exp; (void)tblgen_exp;
|
|
auto tblgen_load = getProperties().load; (void)tblgen_load;
|
|
auto tblgen_store = getProperties().store; (void)tblgen_store;
|
|
auto tblgen_tensor = getProperties().tensor; (void)tblgen_tensor;
|
|
|
|
if (tblgen_load && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_load))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_load).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.memory_counter_wait' op attribute 'load' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_store && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_store))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_store).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.memory_counter_wait' op attribute 'store' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_ds && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_ds))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_ds).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.memory_counter_wait' op attribute 'ds' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_exp && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_exp))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_exp).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.memory_counter_wait' op attribute 'exp' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_tensor && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_tensor))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_tensor).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.memory_counter_wait' op attribute 'tensor' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MemoryCounterWaitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.ds;
|
|
auto attr = dict.get("ds");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `ds` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.exp;
|
|
auto attr = dict.get("exp");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `exp` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.load;
|
|
auto attr = dict.get("load");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `load` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.store;
|
|
auto attr = dict.get("store");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `store` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.tensor;
|
|
auto attr = dict.get("tensor");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `tensor` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute MemoryCounterWaitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.ds;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("ds",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.exp;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("exp",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.load;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("load",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.store;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("store",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.tensor;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("tensor",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code MemoryCounterWaitOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.ds.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.exp.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.load.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.store.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.tensor.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> MemoryCounterWaitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "ds")
|
|
return prop.ds;
|
|
|
|
if (name == "exp")
|
|
return prop.exp;
|
|
|
|
if (name == "load")
|
|
return prop.load;
|
|
|
|
if (name == "store")
|
|
return prop.store;
|
|
|
|
if (name == "tensor")
|
|
return prop.tensor;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void MemoryCounterWaitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "ds") {
|
|
prop.ds = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ds)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "exp") {
|
|
prop.exp = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.exp)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "load") {
|
|
prop.load = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.load)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "store") {
|
|
prop.store = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.store)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "tensor") {
|
|
prop.tensor = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tensor)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void MemoryCounterWaitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.ds) attrs.append("ds", prop.ds);
|
|
|
|
if (prop.exp) attrs.append("exp", prop.exp);
|
|
|
|
if (prop.load) attrs.append("load", prop.load);
|
|
|
|
if (prop.store) attrs.append("store", prop.store);
|
|
|
|
if (prop.tensor) attrs.append("tensor", prop.tensor);
|
|
}
|
|
|
|
::llvm::LogicalResult MemoryCounterWaitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getDsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "ds", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getExpAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "exp", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getLoadAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "load", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getStoreAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "store", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTensorAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "tensor", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MemoryCounterWaitOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.ds)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.exp)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.load)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.store)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.tensor)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MemoryCounterWaitOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.ds);
|
|
|
|
writer.writeOptionalAttribute(prop.exp);
|
|
|
|
writer.writeOptionalAttribute(prop.load);
|
|
|
|
writer.writeOptionalAttribute(prop.store);
|
|
|
|
writer.writeOptionalAttribute(prop.tensor);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOp::getLoad() {
|
|
auto attr = getLoadAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOp::getStore() {
|
|
auto attr = getStoreAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOp::getDs() {
|
|
auto attr = getDsAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOp::getExp() {
|
|
auto attr = getExpAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
::std::optional<uint32_t> MemoryCounterWaitOp::getTensor() {
|
|
auto attr = getTensorAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void MemoryCounterWaitOp::setLoad(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().load;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MemoryCounterWaitOp::setStore(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().store;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MemoryCounterWaitOp::setDs(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().ds;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MemoryCounterWaitOp::setExp(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().exp;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MemoryCounterWaitOp::setTensor(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().tensor;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void MemoryCounterWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::IntegerAttr load, /*optional*/::mlir::IntegerAttr store, /*optional*/::mlir::IntegerAttr ds, /*optional*/::mlir::IntegerAttr exp, /*optional*/::mlir::IntegerAttr tensor) {
|
|
if (load) {
|
|
odsState.getOrAddProperties<Properties>().load = load;
|
|
}
|
|
if (store) {
|
|
odsState.getOrAddProperties<Properties>().store = store;
|
|
}
|
|
if (ds) {
|
|
odsState.getOrAddProperties<Properties>().ds = ds;
|
|
}
|
|
if (exp) {
|
|
odsState.getOrAddProperties<Properties>().exp = exp;
|
|
}
|
|
if (tensor) {
|
|
odsState.getOrAddProperties<Properties>().tensor = tensor;
|
|
}
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::IntegerAttr load, /*optional*/::mlir::IntegerAttr store, /*optional*/::mlir::IntegerAttr ds, /*optional*/::mlir::IntegerAttr exp, /*optional*/::mlir::IntegerAttr tensor) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(load)>(load), std::forward<decltype(store)>(store), std::forward<decltype(ds)>(ds), std::forward<decltype(exp)>(exp), std::forward<decltype(tensor)>(tensor));
|
|
auto __res__ = ::llvm::dyn_cast<MemoryCounterWaitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::IntegerAttr load, /*optional*/::mlir::IntegerAttr store, /*optional*/::mlir::IntegerAttr ds, /*optional*/::mlir::IntegerAttr exp, /*optional*/::mlir::IntegerAttr tensor) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(load)>(load), std::forward<decltype(store)>(store), std::forward<decltype(ds)>(ds), std::forward<decltype(exp)>(exp), std::forward<decltype(tensor)>(tensor));
|
|
}
|
|
|
|
void MemoryCounterWaitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr load, /*optional*/::mlir::IntegerAttr store, /*optional*/::mlir::IntegerAttr ds, /*optional*/::mlir::IntegerAttr exp, /*optional*/::mlir::IntegerAttr tensor) {
|
|
if (load) {
|
|
odsState.getOrAddProperties<Properties>().load = load;
|
|
}
|
|
if (store) {
|
|
odsState.getOrAddProperties<Properties>().store = store;
|
|
}
|
|
if (ds) {
|
|
odsState.getOrAddProperties<Properties>().ds = ds;
|
|
}
|
|
if (exp) {
|
|
odsState.getOrAddProperties<Properties>().exp = exp;
|
|
}
|
|
if (tensor) {
|
|
odsState.getOrAddProperties<Properties>().tensor = tensor;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr load, /*optional*/::mlir::IntegerAttr store, /*optional*/::mlir::IntegerAttr ds, /*optional*/::mlir::IntegerAttr exp, /*optional*/::mlir::IntegerAttr tensor) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(load)>(load), std::forward<decltype(store)>(store), std::forward<decltype(ds)>(ds), std::forward<decltype(exp)>(exp), std::forward<decltype(tensor)>(tensor));
|
|
auto __res__ = ::llvm::dyn_cast<MemoryCounterWaitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr load, /*optional*/::mlir::IntegerAttr store, /*optional*/::mlir::IntegerAttr ds, /*optional*/::mlir::IntegerAttr exp, /*optional*/::mlir::IntegerAttr tensor) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(load)>(load), std::forward<decltype(store)>(store), std::forward<decltype(ds)>(ds), std::forward<decltype(exp)>(exp), std::forward<decltype(tensor)>(tensor));
|
|
}
|
|
|
|
void MemoryCounterWaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<MemoryCounterWaitOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<MemoryCounterWaitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void MemoryCounterWaitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<MemoryCounterWaitOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
MemoryCounterWaitOp MemoryCounterWaitOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult MemoryCounterWaitOp::verifyInvariantsImpl() {
|
|
auto tblgen_ds = getProperties().ds; (void)tblgen_ds;
|
|
auto tblgen_exp = getProperties().exp; (void)tblgen_exp;
|
|
auto tblgen_load = getProperties().load; (void)tblgen_load;
|
|
auto tblgen_store = getProperties().store; (void)tblgen_store;
|
|
auto tblgen_tensor = getProperties().tensor; (void)tblgen_tensor;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_load, "load")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_store, "store")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_ds, "ds")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_exp, "exp")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_tensor, "tensor")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult MemoryCounterWaitOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult MemoryCounterWaitOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::IntegerAttr loadAttr;
|
|
::mlir::IntegerAttr storeAttr;
|
|
::mlir::IntegerAttr dsAttr;
|
|
::mlir::IntegerAttr expAttr;
|
|
::mlir::IntegerAttr tensorAttr;
|
|
bool loadClause = false;
|
|
bool storeClause = false;
|
|
bool dsClause = false;
|
|
bool expClause = false;
|
|
bool tensorClause = false;
|
|
while(true) {
|
|
if (succeeded(parser.parseOptionalKeyword("load"))) {
|
|
|
|
if (loadClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`load` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
loadClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::OptionalParseResult parseResultloadAttr =
|
|
parser.parseOptionalAttribute(loadAttr, parser.getBuilder().getIntegerType(32));
|
|
if (parseResultloadAttr.has_value() && failed(*parseResultloadAttr))
|
|
return ::mlir::failure();
|
|
if (parseResultloadAttr.has_value() && succeeded(*parseResultloadAttr))
|
|
if (loadAttr) result.getOrAddProperties<MemoryCounterWaitOp::Properties>().load = loadAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else if (succeeded(parser.parseOptionalKeyword("store"))) {
|
|
|
|
if (storeClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`store` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
storeClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::OptionalParseResult parseResultstoreAttr =
|
|
parser.parseOptionalAttribute(storeAttr, parser.getBuilder().getIntegerType(32));
|
|
if (parseResultstoreAttr.has_value() && failed(*parseResultstoreAttr))
|
|
return ::mlir::failure();
|
|
if (parseResultstoreAttr.has_value() && succeeded(*parseResultstoreAttr))
|
|
if (storeAttr) result.getOrAddProperties<MemoryCounterWaitOp::Properties>().store = storeAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else if (succeeded(parser.parseOptionalKeyword("ds"))) {
|
|
|
|
if (dsClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`ds` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
dsClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::OptionalParseResult parseResultdsAttr =
|
|
parser.parseOptionalAttribute(dsAttr, parser.getBuilder().getIntegerType(32));
|
|
if (parseResultdsAttr.has_value() && failed(*parseResultdsAttr))
|
|
return ::mlir::failure();
|
|
if (parseResultdsAttr.has_value() && succeeded(*parseResultdsAttr))
|
|
if (dsAttr) result.getOrAddProperties<MemoryCounterWaitOp::Properties>().ds = dsAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else if (succeeded(parser.parseOptionalKeyword("exp"))) {
|
|
|
|
if (expClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`exp` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
expClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::OptionalParseResult parseResultexpAttr =
|
|
parser.parseOptionalAttribute(expAttr, parser.getBuilder().getIntegerType(32));
|
|
if (parseResultexpAttr.has_value() && failed(*parseResultexpAttr))
|
|
return ::mlir::failure();
|
|
if (parseResultexpAttr.has_value() && succeeded(*parseResultexpAttr))
|
|
if (expAttr) result.getOrAddProperties<MemoryCounterWaitOp::Properties>().exp = expAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else if (succeeded(parser.parseOptionalKeyword("tensor"))) {
|
|
|
|
if (tensorClause) {
|
|
return parser.emitError(parser.getNameLoc())
|
|
<< "`tensor` clause can appear at most once in the expansion of the "
|
|
"oilist directive";
|
|
}
|
|
tensorClause = true;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
::mlir::OptionalParseResult parseResulttensorAttr =
|
|
parser.parseOptionalAttribute(tensorAttr, parser.getBuilder().getIntegerType(32));
|
|
if (parseResulttensorAttr.has_value() && failed(*parseResulttensorAttr))
|
|
return ::mlir::failure();
|
|
if (parseResulttensorAttr.has_value() && succeeded(*parseResulttensorAttr))
|
|
if (tensorAttr) result.getOrAddProperties<MemoryCounterWaitOp::Properties>().tensor = tensorAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void MemoryCounterWaitOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
if (false || (getLoadAttr())) {
|
|
_odsPrinter << ' ' << "load";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getLoadAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
if (false || (getStoreAttr())) {
|
|
_odsPrinter << ' ' << "store";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getStoreAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
if (false || (getDsAttr())) {
|
|
_odsPrinter << ' ' << "ds";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getDsAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
if (false || (getExpAttr())) {
|
|
_odsPrinter << ' ' << "exp";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getExpAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
if (false || (getTensorAttr())) {
|
|
_odsPrinter << ' ' << "tensor";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getTensorAttr());
|
|
_odsPrinter << ")";
|
|
}
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("load");
|
|
elidedAttrs.push_back("store");
|
|
elidedAttrs.push_back("ds");
|
|
elidedAttrs.push_back("exp");
|
|
elidedAttrs.push_back("tensor");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::MemoryCounterWaitOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::MemoryCounterWaitOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::PackedScaledTruncOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PackedScaledTruncOpGenericAdaptorBase::PackedScaledTruncOpGenericAdaptorBase(PackedScaledTruncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> PackedScaledTruncOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
uint32_t PackedScaledTruncOpGenericAdaptorBase::getIndex() {
|
|
auto attr = getIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
PackedScaledTruncOpAdaptor::PackedScaledTruncOpAdaptor(PackedScaledTruncOp op) : PackedScaledTruncOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PackedScaledTruncOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_index = getProperties().index; (void)tblgen_index;
|
|
if (!tblgen_index) return emitError(loc, "'amdgpu.packed_scaled_trunc' op requires attribute 'index'");
|
|
|
|
if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getInt() <= 7))))
|
|
return emitError(loc, "'amdgpu.packed_scaled_trunc' op attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 7");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> PackedScaledTruncOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange PackedScaledTruncOp::getExistingMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult PackedScaledTruncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.index;
|
|
auto attr = dict.get("index");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `index` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PackedScaledTruncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.index;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("index",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PackedScaledTruncOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.index.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PackedScaledTruncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "index")
|
|
return prop.index;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PackedScaledTruncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "index") {
|
|
prop.index = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.index)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void PackedScaledTruncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.index) attrs.append("index", prop.index);
|
|
}
|
|
|
|
::llvm::LogicalResult PackedScaledTruncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU15(attr, "index", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PackedScaledTruncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.index)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PackedScaledTruncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.index);
|
|
}
|
|
|
|
uint32_t PackedScaledTruncOp::getIndex() {
|
|
auto attr = getIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void PackedScaledTruncOp::setIndex(uint32_t attrValue) {
|
|
getProperties().index = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void PackedScaledTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().index = index;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedScaledTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedScaledTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().index = index;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedScaledTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedScaledTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t index, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t index, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedScaledTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t index, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedScaledTruncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t index, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t index, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedScaledTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t index, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedScaledTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PackedScaledTruncOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PackedScaledTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PackedScaledTruncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PackedScaledTruncOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedScaledTruncOp PackedScaledTruncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PackedScaledTruncOp::verifyInvariantsImpl() {
|
|
auto tblgen_index = getProperties().index; (void)tblgen_index;
|
|
if (!tblgen_index) return emitOpError("requires attribute 'index'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU15(*this, tblgen_index, "index")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU25(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU26(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
if (valueGroup2.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup2.size();
|
|
}
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU27(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU27(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PackedScaledTruncOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult PackedScaledTruncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
|
|
(void)sourceOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> existingOperands;
|
|
::llvm::SMLoc existingOperandsLoc;
|
|
(void)existingOperandsLoc;
|
|
::mlir::IntegerAttr indexAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand scaleRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scaleOperands(&scaleRawOperand, 1); ::llvm::SMLoc scaleOperandsLoc;
|
|
(void)scaleOperandsLoc;
|
|
::mlir::Type sourceRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> existingTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
sourceOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("into"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
existingOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
existingOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (!existingOperands.empty()) {
|
|
} else {
|
|
if (parser.parseKeyword("undef"))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (indexAttr) result.getOrAddProperties<PackedScaledTruncOp::Properties>().index = indexAttr;
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
scaleOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(scaleRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("into"))) {
|
|
|
|
{
|
|
::mlir::Type optionalType;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalType(optionalType);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
existingTypes.push_back(optionalType);
|
|
}
|
|
}
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type();
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(scaleOperands, odsBuildableType0, scaleOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!existingOperands.empty()) {
|
|
if (parser.resolveOperands(existingOperands, existingTypes, existingOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PackedScaledTruncOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("index");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSource();
|
|
_odsPrinter << ' ' << "into";
|
|
if (getExisting()) {
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getExisting())
|
|
_odsPrinter << value;
|
|
} else {
|
|
_odsPrinter << ' ' << "undef";
|
|
}
|
|
_odsPrinter << "[";
|
|
_odsPrinter.printAttributeWithoutType(getIndexAttr());
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getScale();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSource().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
if (getExisting()) {
|
|
_odsPrinter << ' ' << "into";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << (getExisting() ? ::llvm::ArrayRef<::mlir::Type>(getExisting().getType()) : ::llvm::ArrayRef<::mlir::Type>());
|
|
}
|
|
}
|
|
|
|
void PackedScaledTruncOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PackedScaledTruncOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::PackedScaledTruncOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::PackedStochRoundFp8Op definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PackedStochRoundFp8OpGenericAdaptorBase::PackedStochRoundFp8OpGenericAdaptorBase(PackedStochRoundFp8Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> PackedStochRoundFp8OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
uint32_t PackedStochRoundFp8OpGenericAdaptorBase::getStoreIndex() {
|
|
auto attr = getStoreIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
PackedStochRoundFp8OpAdaptor::PackedStochRoundFp8OpAdaptor(PackedStochRoundFp8Op op) : PackedStochRoundFp8OpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PackedStochRoundFp8OpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_storeIndex = getProperties().storeIndex; (void)tblgen_storeIndex;
|
|
if (!tblgen_storeIndex) return emitError(loc, "'amdgpu.packed_stoch_round_fp8' op requires attribute 'storeIndex'");
|
|
|
|
if (tblgen_storeIndex && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_storeIndex))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_storeIndex).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_storeIndex).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_storeIndex).getInt() <= 3))))
|
|
return emitError(loc, "'amdgpu.packed_stoch_round_fp8' op attribute 'storeIndex' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> PackedStochRoundFp8Op::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange PackedStochRoundFp8Op::getExistingMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult PackedStochRoundFp8Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.storeIndex;
|
|
auto attr = dict.get("storeIndex");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `storeIndex` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PackedStochRoundFp8Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.storeIndex;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("storeIndex",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PackedStochRoundFp8Op::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.storeIndex.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PackedStochRoundFp8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "storeIndex")
|
|
return prop.storeIndex;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "storeIndex") {
|
|
prop.storeIndex = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.storeIndex)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.storeIndex) attrs.append("storeIndex", prop.storeIndex);
|
|
}
|
|
|
|
::llvm::LogicalResult PackedStochRoundFp8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getStoreIndexAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(attr, "storeIndex", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PackedStochRoundFp8Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.storeIndex)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.storeIndex);
|
|
}
|
|
|
|
uint32_t PackedStochRoundFp8Op::getStoreIndex() {
|
|
auto attr = getStoreIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::setStoreIndex(uint32_t attrValue) {
|
|
getProperties().storeIndex = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(stochiasticParam);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().storeIndex = storeIndex;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedStochRoundFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(stochiasticParam);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().storeIndex = storeIndex;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedStochRoundFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, ::mlir::IntegerAttr storeIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(stochiasticParam);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().storeIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), storeIndex);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedStochRoundFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(stochiasticParam);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
odsState.getOrAddProperties<Properties>().storeIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), storeIndex);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedStochRoundFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value stochiasticParam, uint32_t storeIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(stochiasticParam)>(stochiasticParam), std::forward<decltype(storeIndex)>(storeIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PackedStochRoundFp8Op::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PackedStochRoundFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PackedStochRoundFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedStochRoundFp8Op PackedStochRoundFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PackedStochRoundFp8Op::verifyInvariantsImpl() {
|
|
auto tblgen_storeIndex = getProperties().storeIndex; (void)tblgen_storeIndex;
|
|
if (!tblgen_storeIndex) return emitOpError("requires attribute 'storeIndex'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(*this, tblgen_storeIndex, "storeIndex")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU26(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
if (valueGroup2.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup2.size();
|
|
}
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU28(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU28(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PackedStochRoundFp8Op::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult PackedStochRoundFp8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
|
|
(void)sourceOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand stochiasticParamRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> stochiasticParamOperands(&stochiasticParamRawOperand, 1); ::llvm::SMLoc stochiasticParamOperandsLoc;
|
|
(void)stochiasticParamOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> existingOperands;
|
|
::llvm::SMLoc existingOperandsLoc;
|
|
(void)existingOperandsLoc;
|
|
::mlir::IntegerAttr storeIndexAttr;
|
|
::mlir::Type sourceRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> existingTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
sourceOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
stochiasticParamOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(stochiasticParamRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("into"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
existingOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
existingOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (!existingOperands.empty()) {
|
|
} else {
|
|
if (parser.parseKeyword("undef"))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(storeIndexAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (storeIndexAttr) result.getOrAddProperties<PackedStochRoundFp8Op::Properties>().storeIndex = storeIndexAttr;
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::FloatType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("into"))) {
|
|
|
|
{
|
|
::mlir::Type optionalType;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalType(optionalType);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
existingTypes.push_back(optionalType);
|
|
}
|
|
}
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(stochiasticParamOperands, odsBuildableType0, stochiasticParamOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!existingOperands.empty()) {
|
|
if (parser.resolveOperands(existingOperands, existingTypes, existingOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("storeIndex");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSource();
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getStochiasticParam();
|
|
_odsPrinter << ' ' << "into";
|
|
if (getExisting()) {
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getExisting())
|
|
_odsPrinter << value;
|
|
} else {
|
|
_odsPrinter << ' ' << "undef";
|
|
}
|
|
_odsPrinter << "[";
|
|
_odsPrinter.printAttributeWithoutType(getStoreIndexAttr());
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSource().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
if (getExisting()) {
|
|
_odsPrinter << ' ' << "into";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << (getExisting() ? ::llvm::ArrayRef<::mlir::Type>(getExisting().getType()) : ::llvm::ArrayRef<::mlir::Type>());
|
|
}
|
|
}
|
|
|
|
void PackedStochRoundFp8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PackedStochRoundFp8Op)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::PackedStochRoundFp8OpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::PackedTrunc2xFp8Op definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PackedTrunc2xFp8OpGenericAdaptorBase::PackedTrunc2xFp8OpGenericAdaptorBase(PackedTrunc2xFp8Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> PackedTrunc2xFp8OpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
uint32_t PackedTrunc2xFp8OpGenericAdaptorBase::getWordIndex() {
|
|
auto attr = getWordIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
PackedTrunc2xFp8OpAdaptor::PackedTrunc2xFp8OpAdaptor(PackedTrunc2xFp8Op op) : PackedTrunc2xFp8OpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PackedTrunc2xFp8OpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_wordIndex = getProperties().wordIndex; (void)tblgen_wordIndex;
|
|
if (!tblgen_wordIndex) return emitError(loc, "'amdgpu.packed_trunc_2xfp8' op requires attribute 'wordIndex'");
|
|
|
|
if (tblgen_wordIndex && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_wordIndex))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_wordIndex).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_wordIndex).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_wordIndex).getInt() <= 1))))
|
|
return emitError(loc, "'amdgpu.packed_trunc_2xfp8' op attribute 'wordIndex' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 1");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> PackedTrunc2xFp8Op::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange PackedTrunc2xFp8Op::getSourceBMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange PackedTrunc2xFp8Op::getExistingMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult PackedTrunc2xFp8Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.wordIndex;
|
|
auto attr = dict.get("wordIndex");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `wordIndex` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PackedTrunc2xFp8Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.wordIndex;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("wordIndex",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PackedTrunc2xFp8Op::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.wordIndex.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PackedTrunc2xFp8Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "wordIndex")
|
|
return prop.wordIndex;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "wordIndex") {
|
|
prop.wordIndex = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.wordIndex)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.wordIndex) attrs.append("wordIndex", prop.wordIndex);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult PackedTrunc2xFp8Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getWordIndexAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU16(attr, "wordIndex", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PackedTrunc2xFp8Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.wordIndex)))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
writer.writeAttribute(prop.wordIndex);
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
uint32_t PackedTrunc2xFp8Op::getWordIndex() {
|
|
auto attr = getWordIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::setWordIndex(uint32_t attrValue) {
|
|
getProperties().wordIndex = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(sourceA);
|
|
if (sourceB)
|
|
odsState.addOperands(sourceB);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().wordIndex = wordIndex;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedTrunc2xFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(sourceA);
|
|
if (sourceB)
|
|
odsState.addOperands(sourceB);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().wordIndex = wordIndex;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedTrunc2xFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, ::mlir::IntegerAttr wordIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(sourceA);
|
|
if (sourceB)
|
|
odsState.addOperands(sourceB);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().wordIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), wordIndex);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedTrunc2xFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) {
|
|
odsState.addOperands(sourceA);
|
|
if (sourceB)
|
|
odsState.addOperands(sourceB);
|
|
if (existing)
|
|
odsState.addOperands(existing);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, (sourceB ? 1 : 0), (existing ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().wordIndex = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), wordIndex);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
auto __res__ = ::llvm::dyn_cast<PackedTrunc2xFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value sourceA, /*optional*/::mlir::Value sourceB, uint32_t wordIndex, /*optional*/::mlir::Value existing) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(wordIndex)>(wordIndex), std::forward<decltype(existing)>(existing));
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PackedTrunc2xFp8Op::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PackedTrunc2xFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PackedTrunc2xFp8Op>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PackedTrunc2xFp8Op PackedTrunc2xFp8Op::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PackedTrunc2xFp8Op::verifyInvariantsImpl() {
|
|
auto tblgen_wordIndex = getProperties().wordIndex; (void)tblgen_wordIndex;
|
|
if (!tblgen_wordIndex) return emitOpError("requires attribute 'wordIndex'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU16(*this, tblgen_wordIndex, "wordIndex")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU26(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
if (valueGroup1.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup1.size();
|
|
}
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU26(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
if (valueGroup2.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup2.size();
|
|
}
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU28(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU28(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PackedTrunc2xFp8Op::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult PackedTrunc2xFp8Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sourceBOperands;
|
|
::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> existingOperands;
|
|
::llvm::SMLoc existingOperandsLoc;
|
|
(void)existingOperandsLoc;
|
|
::mlir::IntegerAttr wordIndexAttr;
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> existingTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sourceBOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (!sourceBOperands.empty()) {
|
|
} else {
|
|
if (parser.parseKeyword("undef"))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseKeyword("into"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
existingOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
existingOperands.push_back(operand);
|
|
}
|
|
}
|
|
if (!existingOperands.empty()) {
|
|
} else {
|
|
if (parser.parseKeyword("undef"))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("word"))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(wordIndexAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (wordIndexAttr) result.getOrAddProperties<PackedTrunc2xFp8Op::Properties>().wordIndex = wordIndexAttr;
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::FloatType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("into"))) {
|
|
|
|
{
|
|
::mlir::Type optionalType;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalType(optionalType);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
existingTypes.push_back(optionalType);
|
|
}
|
|
}
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(sourceBOperands.size()), static_cast<int32_t>(existingOperands.size())}), result.getOrAddProperties<PackedTrunc2xFp8Op::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type();
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sourceBOperands.empty()) {
|
|
if (parser.resolveOperands(sourceBOperands, odsBuildableType0, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
if (!existingOperands.empty()) {
|
|
if (parser.resolveOperands(existingOperands, existingTypes, existingOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
elidedAttrs.push_back("wordIndex");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ",";
|
|
if (getSourceB()) {
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSourceB())
|
|
_odsPrinter << value;
|
|
} else {
|
|
_odsPrinter << ' ' << "undef";
|
|
}
|
|
_odsPrinter << ' ' << "into";
|
|
if (getExisting()) {
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getExisting())
|
|
_odsPrinter << value;
|
|
} else {
|
|
_odsPrinter << ' ' << "undef";
|
|
}
|
|
_odsPrinter << "[";
|
|
_odsPrinter << "word";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getWordIndexAttr());
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::FloatType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
if (getExisting()) {
|
|
_odsPrinter << ' ' << "into";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << (getExisting() ? ::llvm::ArrayRef<::mlir::Type>(getExisting().getType()) : ::llvm::ArrayRef<::mlir::Type>());
|
|
}
|
|
}
|
|
|
|
void PackedTrunc2xFp8Op::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PackedTrunc2xFp8Op)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::PackedTrunc2xFp8OpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::PermlaneSwapOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PermlaneSwapOpGenericAdaptorBase::PermlaneSwapOpGenericAdaptorBase(PermlaneSwapOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t PermlaneSwapOpGenericAdaptorBase::getRowLength() {
|
|
auto attr = getRowLengthAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::BoolAttr PermlaneSwapOpGenericAdaptorBase::getFetchInactiveAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().fetch_inactive);
|
|
return attr;
|
|
}
|
|
|
|
bool PermlaneSwapOpGenericAdaptorBase::getFetchInactive() {
|
|
auto attr = getFetchInactiveAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::BoolAttr PermlaneSwapOpGenericAdaptorBase::getBoundCtrlAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().bound_ctrl);
|
|
return attr;
|
|
}
|
|
|
|
bool PermlaneSwapOpGenericAdaptorBase::getBoundCtrl() {
|
|
auto attr = getBoundCtrlAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
PermlaneSwapOpAdaptor::PermlaneSwapOpAdaptor(PermlaneSwapOp op) : PermlaneSwapOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PermlaneSwapOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_bound_ctrl = getProperties().bound_ctrl; (void)tblgen_bound_ctrl;
|
|
auto tblgen_fetch_inactive = getProperties().fetch_inactive; (void)tblgen_fetch_inactive;
|
|
auto tblgen_row_length = getProperties().row_length; (void)tblgen_row_length;
|
|
if (!tblgen_row_length) return emitError(loc, "'amdgpu.permlane_swap' op requires attribute 'row_length'");
|
|
|
|
if (tblgen_row_length && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_row_length))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_row_length).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.permlane_swap' op attribute 'row_length' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_fetch_inactive && !((::llvm::isa<::mlir::BoolAttr>(tblgen_fetch_inactive))))
|
|
return emitError(loc, "'amdgpu.permlane_swap' op attribute 'fetch_inactive' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_bound_ctrl && !((::llvm::isa<::mlir::BoolAttr>(tblgen_bound_ctrl))))
|
|
return emitError(loc, "'amdgpu.permlane_swap' op attribute 'bound_ctrl' failed to satisfy constraint: bool attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneSwapOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.bound_ctrl;
|
|
auto attr = dict.get("bound_ctrl");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `bound_ctrl` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fetch_inactive;
|
|
auto attr = dict.get("fetch_inactive");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fetch_inactive` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.row_length;
|
|
auto attr = dict.get("row_length");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `row_length` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PermlaneSwapOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.bound_ctrl;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("bound_ctrl",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.fetch_inactive;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fetch_inactive",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.row_length;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("row_length",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PermlaneSwapOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.bound_ctrl.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.fetch_inactive.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.row_length.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PermlaneSwapOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "bound_ctrl")
|
|
return prop.bound_ctrl;
|
|
|
|
if (name == "fetch_inactive")
|
|
return prop.fetch_inactive;
|
|
|
|
if (name == "row_length")
|
|
return prop.row_length;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PermlaneSwapOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "bound_ctrl") {
|
|
prop.bound_ctrl = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.bound_ctrl)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "fetch_inactive") {
|
|
prop.fetch_inactive = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fetch_inactive)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "row_length") {
|
|
prop.row_length = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.row_length)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void PermlaneSwapOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.bound_ctrl) attrs.append("bound_ctrl", prop.bound_ctrl);
|
|
|
|
if (prop.fetch_inactive) attrs.append("fetch_inactive", prop.fetch_inactive);
|
|
|
|
if (prop.row_length) attrs.append("row_length", prop.row_length);
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneSwapOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundCtrlAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "bound_ctrl", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFetchInactiveAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "fetch_inactive", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getRowLengthAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "row_length", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneSwapOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.bound_ctrl)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fetch_inactive)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.row_length)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PermlaneSwapOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.bound_ctrl);
|
|
|
|
writer.writeOptionalAttribute(prop.fetch_inactive);
|
|
writer.writeAttribute(prop.row_length);
|
|
}
|
|
|
|
uint32_t PermlaneSwapOp::getRowLength() {
|
|
auto attr = getRowLengthAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
bool PermlaneSwapOp::getFetchInactive() {
|
|
auto attr = getFetchInactiveAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool PermlaneSwapOp::getBoundCtrl() {
|
|
auto attr = getBoundCtrlAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void PermlaneSwapOp::setRowLength(uint32_t attrValue) {
|
|
getProperties().row_length = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void PermlaneSwapOp::setFetchInactive(bool attrValue) {
|
|
getProperties().fetch_inactive = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void PermlaneSwapOp::setBoundCtrl(bool attrValue) {
|
|
getProperties().bound_ctrl = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().row_length = row_length;
|
|
if (fetch_inactive) {
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = fetch_inactive;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().row_length = row_length;
|
|
if (fetch_inactive) {
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = fetch_inactive;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneSwapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().row_length = row_length;
|
|
if (fetch_inactive) {
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = fetch_inactive;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::IntegerAttr row_length, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().row_length = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), row_length);
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = odsBuilder.getBoolAttr(fetch_inactive);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().row_length = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), row_length);
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = odsBuilder.getBoolAttr(fetch_inactive);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneSwapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().row_length = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), row_length);
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = odsBuilder.getBoolAttr(fetch_inactive);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, uint32_t row_length, bool fetch_inactive, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(row_length)>(row_length), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PermlaneSwapOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PermlaneSwapOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneSwapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void PermlaneSwapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneSwapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneSwapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneSwapOp PermlaneSwapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void PermlaneSwapOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.fetch_inactive)
|
|
properties.fetch_inactive = odsBuilder.getBoolAttr(false);
|
|
if (!properties.bound_ctrl)
|
|
properties.bound_ctrl = odsBuilder.getBoolAttr(false);
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneSwapOp::verifyInvariantsImpl() {
|
|
auto tblgen_bound_ctrl = getProperties().bound_ctrl; (void)tblgen_bound_ctrl;
|
|
auto tblgen_fetch_inactive = getProperties().fetch_inactive; (void)tblgen_fetch_inactive;
|
|
auto tblgen_row_length = getProperties().row_length; (void)tblgen_row_length;
|
|
if (!tblgen_row_length) return emitOpError("requires attribute 'row_length'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_row_length, "row_length")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_fetch_inactive, "fetch_inactive")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_bound_ctrl, "bound_ctrl")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU29(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU29(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {result, src} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneSwapOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneSwapOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult PermlaneSwapOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::mlir::IntegerAttr row_lengthAttr;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(row_lengthAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (row_lengthAttr) result.getOrAddProperties<PermlaneSwapOp::Properties>().row_length = row_lengthAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(srcOperands, resultTypes[0], srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PermlaneSwapOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getRowLengthAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("row_length");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFetchInactiveAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(false)))
|
|
elidedAttrs.push_back("fetch_inactive");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundCtrlAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(false)))
|
|
elidedAttrs.push_back("bound_ctrl");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void PermlaneSwapOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PermlaneSwapOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::PermlaneSwapOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::PermlaneVarOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PermlaneVarOpGenericAdaptorBase::PermlaneVarOpGenericAdaptorBase(PermlaneVarOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::BoolAttr PermlaneVarOpGenericAdaptorBase::getCrossAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().cross);
|
|
return attr;
|
|
}
|
|
|
|
bool PermlaneVarOpGenericAdaptorBase::getCross() {
|
|
auto attr = getCrossAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::BoolAttr PermlaneVarOpGenericAdaptorBase::getFetchInactiveAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().fetch_inactive);
|
|
return attr;
|
|
}
|
|
|
|
bool PermlaneVarOpGenericAdaptorBase::getFetchInactive() {
|
|
auto attr = getFetchInactiveAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::BoolAttr PermlaneVarOpGenericAdaptorBase::getBoundCtrlAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().bound_ctrl);
|
|
return attr;
|
|
}
|
|
|
|
bool PermlaneVarOpGenericAdaptorBase::getBoundCtrl() {
|
|
auto attr = getBoundCtrlAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
PermlaneVarOpAdaptor::PermlaneVarOpAdaptor(PermlaneVarOp op) : PermlaneVarOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PermlaneVarOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_bound_ctrl = getProperties().bound_ctrl; (void)tblgen_bound_ctrl;
|
|
auto tblgen_cross = getProperties().cross; (void)tblgen_cross;
|
|
auto tblgen_fetch_inactive = getProperties().fetch_inactive; (void)tblgen_fetch_inactive;
|
|
|
|
if (tblgen_cross && !((::llvm::isa<::mlir::BoolAttr>(tblgen_cross))))
|
|
return emitError(loc, "'amdgpu.permlane_var' op attribute 'cross' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_fetch_inactive && !((::llvm::isa<::mlir::BoolAttr>(tblgen_fetch_inactive))))
|
|
return emitError(loc, "'amdgpu.permlane_var' op attribute 'fetch_inactive' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_bound_ctrl && !((::llvm::isa<::mlir::BoolAttr>(tblgen_bound_ctrl))))
|
|
return emitError(loc, "'amdgpu.permlane_var' op attribute 'bound_ctrl' failed to satisfy constraint: bool attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneVarOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.bound_ctrl;
|
|
auto attr = dict.get("bound_ctrl");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `bound_ctrl` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.cross;
|
|
auto attr = dict.get("cross");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cross` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fetch_inactive;
|
|
auto attr = dict.get("fetch_inactive");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fetch_inactive` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PermlaneVarOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.bound_ctrl;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("bound_ctrl",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.cross;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("cross",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.fetch_inactive;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fetch_inactive",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PermlaneVarOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.bound_ctrl.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.cross.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.fetch_inactive.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PermlaneVarOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "bound_ctrl")
|
|
return prop.bound_ctrl;
|
|
|
|
if (name == "cross")
|
|
return prop.cross;
|
|
|
|
if (name == "fetch_inactive")
|
|
return prop.fetch_inactive;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PermlaneVarOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "bound_ctrl") {
|
|
prop.bound_ctrl = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.bound_ctrl)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "cross") {
|
|
prop.cross = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cross)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "fetch_inactive") {
|
|
prop.fetch_inactive = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fetch_inactive)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void PermlaneVarOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.bound_ctrl) attrs.append("bound_ctrl", prop.bound_ctrl);
|
|
|
|
if (prop.cross) attrs.append("cross", prop.cross);
|
|
|
|
if (prop.fetch_inactive) attrs.append("fetch_inactive", prop.fetch_inactive);
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneVarOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundCtrlAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "bound_ctrl", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCrossAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "cross", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFetchInactiveAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "fetch_inactive", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneVarOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.bound_ctrl)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.cross)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.fetch_inactive)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PermlaneVarOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.bound_ctrl);
|
|
|
|
writer.writeOptionalAttribute(prop.cross);
|
|
|
|
writer.writeOptionalAttribute(prop.fetch_inactive);
|
|
}
|
|
|
|
bool PermlaneVarOp::getCross() {
|
|
auto attr = getCrossAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool PermlaneVarOp::getFetchInactive() {
|
|
auto attr = getFetchInactiveAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
bool PermlaneVarOp::getBoundCtrl() {
|
|
auto attr = getBoundCtrlAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void PermlaneVarOp::setCross(bool attrValue) {
|
|
getProperties().cross = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void PermlaneVarOp::setFetchInactive(bool attrValue) {
|
|
getProperties().fetch_inactive = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void PermlaneVarOp::setBoundCtrl(bool attrValue) {
|
|
getProperties().bound_ctrl = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(selector);
|
|
if (cross) {
|
|
odsState.getOrAddProperties<Properties>().cross = cross;
|
|
}
|
|
if (fetch_inactive) {
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = fetch_inactive;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(selector);
|
|
if (cross) {
|
|
odsState.getOrAddProperties<Properties>().cross = cross;
|
|
}
|
|
if (fetch_inactive) {
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = fetch_inactive;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneVarOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(selector);
|
|
if (cross) {
|
|
odsState.getOrAddProperties<Properties>().cross = cross;
|
|
}
|
|
if (fetch_inactive) {
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = fetch_inactive;
|
|
}
|
|
if (bound_ctrl) {
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = bound_ctrl;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value selector, ::mlir::BoolAttr cross, ::mlir::BoolAttr fetch_inactive, ::mlir::BoolAttr bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(selector);
|
|
odsState.getOrAddProperties<Properties>().cross = odsBuilder.getBoolAttr(cross);
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = odsBuilder.getBoolAttr(fetch_inactive);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(selector);
|
|
odsState.getOrAddProperties<Properties>().cross = odsBuilder.getBoolAttr(cross);
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = odsBuilder.getBoolAttr(fetch_inactive);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneVarOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(selector);
|
|
odsState.getOrAddProperties<Properties>().cross = odsBuilder.getBoolAttr(cross);
|
|
odsState.getOrAddProperties<Properties>().fetch_inactive = odsBuilder.getBoolAttr(fetch_inactive);
|
|
odsState.getOrAddProperties<Properties>().bound_ctrl = odsBuilder.getBoolAttr(bound_ctrl);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value selector, bool cross, bool fetch_inactive, bool bound_ctrl) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(selector)>(selector), std::forward<decltype(cross)>(cross), std::forward<decltype(fetch_inactive)>(fetch_inactive), std::forward<decltype(bound_ctrl)>(bound_ctrl));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PermlaneVarOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PermlaneVarOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneVarOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void PermlaneVarOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PermlaneVarOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PermlaneVarOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PermlaneVarOp PermlaneVarOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void PermlaneVarOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.cross)
|
|
properties.cross = odsBuilder.getBoolAttr(false);
|
|
if (!properties.fetch_inactive)
|
|
properties.fetch_inactive = odsBuilder.getBoolAttr(false);
|
|
if (!properties.bound_ctrl)
|
|
properties.bound_ctrl = odsBuilder.getBoolAttr(false);
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneVarOp::verifyInvariantsImpl() {
|
|
auto tblgen_bound_ctrl = getProperties().bound_ctrl; (void)tblgen_bound_ctrl;
|
|
auto tblgen_cross = getProperties().cross; (void)tblgen_cross;
|
|
auto tblgen_fetch_inactive = getProperties().fetch_inactive; (void)tblgen_fetch_inactive;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_cross, "cross")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_fetch_inactive, "fetch_inactive")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_bound_ctrl, "bound_ctrl")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU29(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU29(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {result, src} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneVarOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult PermlaneVarOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult PermlaneVarOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand selectorRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> selectorOperands(&selectorRawOperand, 1); ::llvm::SMLoc selectorOperandsLoc;
|
|
(void)selectorOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
selectorOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(selectorRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(srcOperands, resultTypes[0], srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(selectorOperands, odsBuildableType0, selectorOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PermlaneVarOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSelector();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getCrossAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(false)))
|
|
elidedAttrs.push_back("cross");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getFetchInactiveAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(false)))
|
|
elidedAttrs.push_back("fetch_inactive");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundCtrlAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(false)))
|
|
elidedAttrs.push_back("bound_ctrl");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void PermlaneVarOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::PermlaneVarOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::PermlaneVarOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::RawBufferAtomicCmpswapOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
RawBufferAtomicCmpswapOpGenericAdaptorBase::RawBufferAtomicCmpswapOpGenericAdaptorBase(RawBufferAtomicCmpswapOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicCmpswapOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr RawBufferAtomicCmpswapOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool RawBufferAtomicCmpswapOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicCmpswapOpGenericAdaptorBase::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
RawBufferAtomicCmpswapOpAdaptor::RawBufferAtomicCmpswapOpAdaptor(RawBufferAtomicCmpswapOp op) : RawBufferAtomicCmpswapOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicCmpswapOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_cmpswap' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_cmpswap' op attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicCmpswapOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicCmpswapOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicCmpswapOp::getSgprOffsetMutable() {
|
|
auto range = getODSOperandIndexAndLength(4);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(4u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicCmpswapOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indexOffset;
|
|
auto attr = dict.get("indexOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute RawBufferAtomicCmpswapOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.indexOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indexOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code RawBufferAtomicCmpswapOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.indexOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> RawBufferAtomicCmpswapOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "indexOffset")
|
|
return prop.indexOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "indexOffset") {
|
|
prop.indexOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indexOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicCmpswapOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "indexOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicCmpswapOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
writer.writeOptionalAttribute(prop.indexOffset);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool RawBufferAtomicCmpswapOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicCmpswapOp::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::setIndexOffset(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().indexOffset;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(value);
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicCmpswapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(value);
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type value, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicCmpswapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(cmp);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::Value cmp, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(cmp)>(cmp), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicCmpswapOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicCmpswapOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicCmpswapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicCmpswapOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicCmpswapOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicCmpswapOp RawBufferAtomicCmpswapOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicCmpswapOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_indexOffset, "indexOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU30(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup4 = getODSOperands(4);
|
|
|
|
if (valueGroup4.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup4.size();
|
|
}
|
|
|
|
for (auto v : valueGroup4) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {src, cmp, value} have same type");
|
|
if (!(((getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(2).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))))))
|
|
return emitOpError("failed to verify that all of {value, memref} have same element type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicCmpswapOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicCmpswapOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 1)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[1].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult RawBufferAtomicCmpswapOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand cmpRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> cmpOperands(&cmpRawOperand, 1); ::llvm::SMLoc cmpOperandsLoc;
|
|
(void)cmpOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand memrefRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(&memrefRawOperand, 1); ::llvm::SMLoc memrefOperandsLoc;
|
|
(void)memrefOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands;
|
|
::llvm::SMLoc sgprOffsetOperandsLoc;
|
|
(void)sgprOffsetOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Type memrefRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> memrefTypes(&memrefRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> indicesTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
cmpOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(cmpRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
memrefOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(memrefRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) {
|
|
|
|
{
|
|
sgprOffsetOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sgprOffsetOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
memrefRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(indicesTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, 1, static_cast<int32_t>(indicesOperands.size()), static_cast<int32_t>(sgprOffsetOperands.size())}), result.getOrAddProperties<RawBufferAtomicCmpswapOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(valueTypes);
|
|
if (parser.resolveOperands(srcOperands, valueTypes[0], srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(cmpOperands, valueTypes[0], cmpOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sgprOffsetOperands.empty()) {
|
|
if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getCmp();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getMemref();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
if (getSgprOffset()) {
|
|
_odsPrinter << ' ' << "sgprOffset";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSgprOffset())
|
|
_odsPrinter << value;
|
|
}
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getMemref().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getIndices().getTypes();
|
|
}
|
|
|
|
void RawBufferAtomicCmpswapOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(2);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(2);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicCmpswapOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::RawBufferAtomicCmpswapOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::RawBufferAtomicFaddOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
RawBufferAtomicFaddOpGenericAdaptorBase::RawBufferAtomicFaddOpGenericAdaptorBase(RawBufferAtomicFaddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicFaddOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr RawBufferAtomicFaddOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool RawBufferAtomicFaddOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicFaddOpGenericAdaptorBase::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
RawBufferAtomicFaddOpAdaptor::RawBufferAtomicFaddOpAdaptor(RawBufferAtomicFaddOp op) : RawBufferAtomicFaddOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFaddOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_fadd' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_fadd' op attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicFaddOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicFaddOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicFaddOp::getSgprOffsetMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFaddOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indexOffset;
|
|
auto attr = dict.get("indexOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute RawBufferAtomicFaddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.indexOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indexOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code RawBufferAtomicFaddOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.indexOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> RawBufferAtomicFaddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "indexOffset")
|
|
return prop.indexOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "indexOffset") {
|
|
prop.indexOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indexOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFaddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "indexOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFaddOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
writer.writeOptionalAttribute(prop.indexOffset);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool RawBufferAtomicFaddOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicFaddOp::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::setIndexOffset(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().indexOffset;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFaddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFaddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicFaddOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicFaddOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFaddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFaddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFaddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFaddOp RawBufferAtomicFaddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFaddOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_indexOffset, "indexOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU31(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU30(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
if (valueGroup3.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup3.size();
|
|
}
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU31(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))
|
|
return emitOpError("failed to verify that all of {value, memref} have same element type");
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {oldValue, value} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFaddOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFaddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult RawBufferAtomicFaddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand memrefRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(&memrefRawOperand, 1); ::llvm::SMLoc memrefOperandsLoc;
|
|
(void)memrefOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands;
|
|
::llvm::SMLoc sgprOffsetOperandsLoc;
|
|
(void)sgprOffsetOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Type memrefRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> memrefTypes(&memrefRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> indicesTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
memrefOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(memrefRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) {
|
|
|
|
{
|
|
sgprOffsetOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sgprOffsetOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
memrefRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(indicesTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indicesOperands.size()), static_cast<int32_t>(sgprOffsetOperands.size())}), result.getOrAddProperties<RawBufferAtomicFaddOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(valueTypes[0]);
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sgprOffsetOperands.empty()) {
|
|
if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getMemref();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
if (getSgprOffset()) {
|
|
_odsPrinter << ' ' << "sgprOffset";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSgprOffset())
|
|
_odsPrinter << value;
|
|
}
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getMemref().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getIndices().getTypes();
|
|
}
|
|
|
|
void RawBufferAtomicFaddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicFaddOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::RawBufferAtomicFaddOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::RawBufferAtomicFmaxOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
RawBufferAtomicFmaxOpGenericAdaptorBase::RawBufferAtomicFmaxOpGenericAdaptorBase(RawBufferAtomicFmaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicFmaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr RawBufferAtomicFmaxOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool RawBufferAtomicFmaxOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicFmaxOpGenericAdaptorBase::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
RawBufferAtomicFmaxOpAdaptor::RawBufferAtomicFmaxOpAdaptor(RawBufferAtomicFmaxOp op) : RawBufferAtomicFmaxOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFmaxOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_fmax' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_fmax' op attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicFmaxOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicFmaxOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicFmaxOp::getSgprOffsetMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFmaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indexOffset;
|
|
auto attr = dict.get("indexOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute RawBufferAtomicFmaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.indexOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indexOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code RawBufferAtomicFmaxOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.indexOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> RawBufferAtomicFmaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "indexOffset")
|
|
return prop.indexOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "indexOffset") {
|
|
prop.indexOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indexOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFmaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "indexOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFmaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
writer.writeOptionalAttribute(prop.indexOffset);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool RawBufferAtomicFmaxOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicFmaxOp::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::setIndexOffset(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().indexOffset;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicFmaxOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicFmaxOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicFmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicFmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicFmaxOp RawBufferAtomicFmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFmaxOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_indexOffset, "indexOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU32(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU30(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
if (valueGroup3.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup3.size();
|
|
}
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU32(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))
|
|
return emitOpError("failed to verify that all of {value, memref} have same element type");
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {oldValue, value} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFmaxOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicFmaxOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult RawBufferAtomicFmaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand memrefRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(&memrefRawOperand, 1); ::llvm::SMLoc memrefOperandsLoc;
|
|
(void)memrefOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands;
|
|
::llvm::SMLoc sgprOffsetOperandsLoc;
|
|
(void)sgprOffsetOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Type memrefRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> memrefTypes(&memrefRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> indicesTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
memrefOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(memrefRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) {
|
|
|
|
{
|
|
sgprOffsetOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sgprOffsetOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
memrefRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(indicesTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indicesOperands.size()), static_cast<int32_t>(sgprOffsetOperands.size())}), result.getOrAddProperties<RawBufferAtomicFmaxOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(valueTypes[0]);
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sgprOffsetOperands.empty()) {
|
|
if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getMemref();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
if (getSgprOffset()) {
|
|
_odsPrinter << ' ' << "sgprOffset";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSgprOffset())
|
|
_odsPrinter << value;
|
|
}
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getMemref().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getIndices().getTypes();
|
|
}
|
|
|
|
void RawBufferAtomicFmaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicFmaxOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::RawBufferAtomicFmaxOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::RawBufferAtomicSmaxOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
RawBufferAtomicSmaxOpGenericAdaptorBase::RawBufferAtomicSmaxOpGenericAdaptorBase(RawBufferAtomicSmaxOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicSmaxOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr RawBufferAtomicSmaxOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool RawBufferAtomicSmaxOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicSmaxOpGenericAdaptorBase::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
RawBufferAtomicSmaxOpAdaptor::RawBufferAtomicSmaxOpAdaptor(RawBufferAtomicSmaxOp op) : RawBufferAtomicSmaxOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicSmaxOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_smax' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_smax' op attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicSmaxOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicSmaxOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicSmaxOp::getSgprOffsetMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicSmaxOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indexOffset;
|
|
auto attr = dict.get("indexOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute RawBufferAtomicSmaxOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.indexOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indexOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code RawBufferAtomicSmaxOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.indexOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> RawBufferAtomicSmaxOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "indexOffset")
|
|
return prop.indexOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "indexOffset") {
|
|
prop.indexOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indexOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicSmaxOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "indexOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicSmaxOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
writer.writeOptionalAttribute(prop.indexOffset);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool RawBufferAtomicSmaxOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicSmaxOp::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::setIndexOffset(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().indexOffset;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicSmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicSmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicSmaxOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicSmaxOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicSmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicSmaxOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicSmaxOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicSmaxOp RawBufferAtomicSmaxOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicSmaxOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_indexOffset, "indexOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU30(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
if (valueGroup3.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup3.size();
|
|
}
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {oldValue, value} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicSmaxOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicSmaxOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult RawBufferAtomicSmaxOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand memrefRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(&memrefRawOperand, 1); ::llvm::SMLoc memrefOperandsLoc;
|
|
(void)memrefOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands;
|
|
::llvm::SMLoc sgprOffsetOperandsLoc;
|
|
(void)sgprOffsetOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Type memrefRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> memrefTypes(&memrefRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> indicesTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
memrefOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(memrefRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) {
|
|
|
|
{
|
|
sgprOffsetOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sgprOffsetOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
memrefRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(indicesTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indicesOperands.size()), static_cast<int32_t>(sgprOffsetOperands.size())}), result.getOrAddProperties<RawBufferAtomicSmaxOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(valueTypes[0]);
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sgprOffsetOperands.empty()) {
|
|
if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getMemref();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
if (getSgprOffset()) {
|
|
_odsPrinter << ' ' << "sgprOffset";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSgprOffset())
|
|
_odsPrinter << value;
|
|
}
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getMemref().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getIndices().getTypes();
|
|
}
|
|
|
|
void RawBufferAtomicSmaxOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicSmaxOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::RawBufferAtomicSmaxOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::RawBufferAtomicUminOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
RawBufferAtomicUminOpGenericAdaptorBase::RawBufferAtomicUminOpGenericAdaptorBase(RawBufferAtomicUminOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicUminOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr RawBufferAtomicUminOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool RawBufferAtomicUminOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicUminOpGenericAdaptorBase::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
RawBufferAtomicUminOpAdaptor::RawBufferAtomicUminOpAdaptor(RawBufferAtomicUminOp op) : RawBufferAtomicUminOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicUminOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_umin' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_atomic_umin' op attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferAtomicUminOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicUminOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferAtomicUminOp::getSgprOffsetMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicUminOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indexOffset;
|
|
auto attr = dict.get("indexOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute RawBufferAtomicUminOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.indexOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indexOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code RawBufferAtomicUminOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.indexOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> RawBufferAtomicUminOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "indexOffset")
|
|
return prop.indexOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "indexOffset") {
|
|
prop.indexOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indexOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicUminOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "indexOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicUminOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
writer.writeOptionalAttribute(prop.indexOffset);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool RawBufferAtomicUminOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferAtomicUminOp::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::setIndexOffset(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().indexOffset;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicUminOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(oldValue);
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type oldValue, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(oldValue)>(oldValue), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicUminOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicUminOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferAtomicUminOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicUminOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(RawBufferAtomicUminOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferAtomicUminOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferAtomicUminOp RawBufferAtomicUminOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicUminOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_indexOffset, "indexOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU30(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
if (valueGroup3.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup3.size();
|
|
}
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {oldValue, value} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicUminOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferAtomicUminOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult RawBufferAtomicUminOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand memrefRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(&memrefRawOperand, 1); ::llvm::SMLoc memrefOperandsLoc;
|
|
(void)memrefOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands;
|
|
::llvm::SMLoc sgprOffsetOperandsLoc;
|
|
(void)sgprOffsetOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Type memrefRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> memrefTypes(&memrefRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> indicesTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
memrefOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(memrefRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) {
|
|
|
|
{
|
|
sgprOffsetOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sgprOffsetOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
memrefRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(indicesTypes))
|
|
return ::mlir::failure();
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indicesOperands.size()), static_cast<int32_t>(sgprOffsetOperands.size())}), result.getOrAddProperties<RawBufferAtomicUminOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(valueTypes[0]);
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sgprOffsetOperands.empty()) {
|
|
if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getMemref();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
if (getSgprOffset()) {
|
|
_odsPrinter << ' ' << "sgprOffset";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSgprOffset())
|
|
_odsPrinter << value;
|
|
}
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getMemref().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getIndices().getTypes();
|
|
}
|
|
|
|
void RawBufferAtomicUminOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferAtomicUminOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::RawBufferAtomicUminOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::RawBufferLoadOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
RawBufferLoadOpGenericAdaptorBase::RawBufferLoadOpGenericAdaptorBase(RawBufferLoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr RawBufferLoadOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool RawBufferLoadOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferLoadOpGenericAdaptorBase::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
RawBufferLoadOpAdaptor::RawBufferLoadOpAdaptor(RawBufferLoadOp op) : RawBufferLoadOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult RawBufferLoadOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_load' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_load' op attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferLoadOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferLoadOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferLoadOp::getSgprOffsetMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indexOffset;
|
|
auto attr = dict.get("indexOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute RawBufferLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.indexOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indexOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code RawBufferLoadOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.indexOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> RawBufferLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "indexOffset")
|
|
return prop.indexOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void RawBufferLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "indexOffset") {
|
|
prop.indexOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indexOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void RawBufferLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "indexOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferLoadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferLoadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
writer.writeOptionalAttribute(prop.indexOffset);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool RawBufferLoadOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferLoadOp::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void RawBufferLoadOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void RawBufferLoadOp::setIndexOffset(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().indexOffset;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(value);
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
odsState.addTypes(value);
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferLoadOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferLoadOp RawBufferLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferLoadOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferLoadOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_indexOffset, "indexOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU30(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
if (valueGroup2.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup2.size();
|
|
}
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((getElementTypeOrSelf((*this->getODSResults(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSResults(0).begin()))))))
|
|
return emitOpError("failed to verify that all of {value, memref} have same element type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferLoadOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult RawBufferLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand memrefRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(&memrefRawOperand, 1); ::llvm::SMLoc memrefOperandsLoc;
|
|
(void)memrefOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands;
|
|
::llvm::SMLoc sgprOffsetOperandsLoc;
|
|
(void)sgprOffsetOperandsLoc;
|
|
::mlir::Type memrefRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> memrefTypes(&memrefRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> indicesTypes;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
memrefOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(memrefRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) {
|
|
|
|
{
|
|
sgprOffsetOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sgprOffsetOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
memrefRawType = type;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalComma())) {
|
|
|
|
if (parser.parseTypeList(indicesTypes))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, static_cast<int32_t>(indicesOperands.size()), static_cast<int32_t>(sgprOffsetOperands.size())}), result.getOrAddProperties<RawBufferLoadOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
result.addTypes(valueTypes);
|
|
if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sgprOffsetOperands.empty()) {
|
|
if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getMemref();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
if (getSgprOffset()) {
|
|
_odsPrinter << ' ' << "sgprOffset";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSgprOffset())
|
|
_odsPrinter << value;
|
|
}
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getMemref().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
if (!getIndices().empty()) {
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getIndices().getTypes();
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void RawBufferLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferLoadOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::RawBufferLoadOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::RawBufferStoreOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
RawBufferStoreOpGenericAdaptorBase::RawBufferStoreOpGenericAdaptorBase(RawBufferStoreOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferStoreOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::BoolAttr RawBufferStoreOpGenericAdaptorBase::getBoundsCheckAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(getProperties().boundsCheck);
|
|
return attr;
|
|
}
|
|
|
|
bool RawBufferStoreOpGenericAdaptorBase::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferStoreOpGenericAdaptorBase::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
RawBufferStoreOpAdaptor::RawBufferStoreOpAdaptor(RawBufferStoreOp op) : RawBufferStoreOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult RawBufferStoreOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (tblgen_boundsCheck && !((::llvm::isa<::mlir::BoolAttr>(tblgen_boundsCheck))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_store' op attribute 'boundsCheck' failed to satisfy constraint: bool attribute");
|
|
|
|
if (tblgen_indexOffset && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_indexOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_indexOffset).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.raw_buffer_store' op attribute 'indexOffset' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> RawBufferStoreOp::getODSOperandIndexAndLength(unsigned index) {
|
|
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
|
|
|
|
unsigned start = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
start += sizeAttr[i];
|
|
return {start, sizeAttr[index]};
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferStoreOp::getIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(2);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::mlir::MutableOperandRange RawBufferStoreOp::getSgprOffsetMutable() {
|
|
auto range = getODSOperandIndexAndLength(3);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferStoreOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.boundsCheck;
|
|
auto attr = dict.get("boundsCheck");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `boundsCheck` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.indexOffset;
|
|
auto attr = dict.get("indexOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `indexOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
|
|
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
|
|
return convertFromAttribute(propStorage, propAttr, emitError);
|
|
};
|
|
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
|
|
;
|
|
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, [&]() {
|
|
return emitError() << "for `operandSegmentSizes`: ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute RawBufferStoreOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.boundsCheck;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("boundsCheck",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.indexOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("indexOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.operandSegmentSizes;
|
|
auto attr = [&]() -> ::mlir::Attribute {
|
|
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
|
|
}();
|
|
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code RawBufferStoreOp::computePropertiesHash(const Properties &prop) {
|
|
auto hash_operandSegmentSizes_ = [] (const auto &propStorage) -> llvm::hash_code {
|
|
using ::llvm::hash_value;
|
|
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
|
|
};
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.boundsCheck.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.indexOffset.getAsOpaquePointer()),
|
|
hash_operandSegmentSizes_(prop.operandSegmentSizes));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> RawBufferStoreOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "boundsCheck")
|
|
return prop.boundsCheck;
|
|
|
|
if (name == "indexOffset")
|
|
return prop.indexOffset;
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
|
|
return std::nullopt;
|
|
}
|
|
|
|
void RawBufferStoreOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "boundsCheck") {
|
|
prop.boundsCheck = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.boundsCheck)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "indexOffset") {
|
|
prop.indexOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.indexOffset)>>(value);
|
|
return;
|
|
}
|
|
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
|
|
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
|
|
if (!arrAttr) return;
|
|
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
|
|
return;
|
|
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
|
|
return;
|
|
}
|
|
}
|
|
|
|
void RawBufferStoreOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.boundsCheck) attrs.append("boundsCheck", prop.boundsCheck);
|
|
|
|
if (prop.indexOffset) attrs.append("indexOffset", prop.indexOffset);
|
|
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferStoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBoundsCheckAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(attr, "boundsCheck", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "indexOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferStoreOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.boundsCheck)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.indexOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
::mlir::DenseI32ArrayAttr attr;
|
|
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
|
|
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
|
|
reader.emitError("size mismatch for operand/result_segment_size");
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
auto readProp = [&]() {
|
|
|
|
if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
|
|
;
|
|
return ::mlir::success();
|
|
};
|
|
if (::mlir::failed(readProp()))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferStoreOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.boundsCheck);
|
|
|
|
writer.writeOptionalAttribute(prop.indexOffset);
|
|
|
|
if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.operandSegmentSizes;
|
|
|
|
if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
|
|
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
|
|
;
|
|
}
|
|
}
|
|
|
|
bool RawBufferStoreOp::getBoundsCheck() {
|
|
auto attr = getBoundsCheckAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::std::optional<uint32_t> RawBufferStoreOp::getIndexOffset() {
|
|
auto attr = getIndexOffsetAttr();
|
|
return attr ? ::std::optional<uint32_t>(attr.getValue().getZExtValue()) : (::std::nullopt);
|
|
}
|
|
|
|
void RawBufferStoreOp::setBoundsCheck(bool attrValue) {
|
|
getProperties().boundsCheck = ::mlir::Builder((*this)->getContext()).getBoolAttr(attrValue);
|
|
}
|
|
|
|
void RawBufferStoreOp::setIndexOffset(::std::optional<uint32_t> attrValue) {
|
|
auto &odsProp = getProperties().indexOffset;
|
|
if (attrValue)
|
|
odsProp = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), *attrValue);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferStoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
if (boundsCheck) {
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = boundsCheck;
|
|
}
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferStoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, ::mlir::BoolAttr boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferStoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferStoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
odsState.addOperands(value);
|
|
odsState.addOperands(memref);
|
|
odsState.addOperands(indices);
|
|
if (sgprOffset)
|
|
odsState.addOperands(sgprOffset);
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indices.size()), (sgprOffset ? 1 : 0)}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
|
|
odsState.getOrAddProperties<Properties>().boundsCheck = odsBuilder.getBoolAttr(boundsCheck);
|
|
if (indexOffset) {
|
|
odsState.getOrAddProperties<Properties>().indexOffset = indexOffset;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferStoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value memref, ::mlir::ValueRange indices, bool boundsCheck, /*optional*/::mlir::IntegerAttr indexOffset, /*optional*/::mlir::Value sgprOffset) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(memref)>(memref), std::forward<decltype(indices)>(indices), std::forward<decltype(boundsCheck)>(boundsCheck), std::forward<decltype(indexOffset)>(indexOffset), std::forward<decltype(sgprOffset)>(sgprOffset));
|
|
}
|
|
|
|
void RawBufferStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<RawBufferStoreOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferStoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void RawBufferStoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<RawBufferStoreOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
RawBufferStoreOp RawBufferStoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void RawBufferStoreOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.boundsCheck)
|
|
properties.boundsCheck = odsBuilder.getBoolAttr(true);
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferStoreOp::verifyInvariantsImpl() {
|
|
auto tblgen_boundsCheck = getProperties().boundsCheck; (void)tblgen_boundsCheck;
|
|
auto tblgen_indexOffset = getProperties().indexOffset; (void)tblgen_indexOffset;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU4(*this, tblgen_boundsCheck, "boundsCheck")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_indexOffset, "indexOffset")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU30(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
if (valueGroup3.size() > 1) {
|
|
return emitOpError("operand group starting at #") << index
|
|
<< " requires 0 or 1 element, but found " << valueGroup3.size();
|
|
}
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))
|
|
return emitOpError("failed to verify that all of {value, memref} have same element type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult RawBufferStoreOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult RawBufferStoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
|
|
(void)valueOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand memrefRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> memrefOperands(&memrefRawOperand, 1); ::llvm::SMLoc memrefOperandsLoc;
|
|
(void)memrefOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
|
|
::llvm::SMLoc indicesOperandsLoc;
|
|
(void)indicesOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> sgprOffsetOperands;
|
|
::llvm::SMLoc sgprOffsetOperandsLoc;
|
|
(void)sgprOffsetOperandsLoc;
|
|
::mlir::Type valueRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
|
|
::mlir::Type memrefRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> memrefTypes(&memrefRawType, 1);
|
|
::llvm::SmallVector<::mlir::Type, 1> indicesTypes;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
valueOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(valueRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
memrefOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(memrefRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
indicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(indicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (::mlir::succeeded(parser.parseOptionalKeyword("sgprOffset"))) {
|
|
|
|
{
|
|
sgprOffsetOperandsLoc = parser.getCurrentLocation();
|
|
::mlir::OpAsmParser::UnresolvedOperand operand;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalOperand(operand);
|
|
if (parseResult.has_value()) {
|
|
if (failed(*parseResult))
|
|
return ::mlir::failure();
|
|
sgprOffsetOperands.push_back(operand);
|
|
}
|
|
}
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
valueRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
memrefRawType = type;
|
|
}
|
|
if (::mlir::succeeded(parser.parseOptionalComma())) {
|
|
|
|
if (parser.parseTypeList(indicesTypes))
|
|
return ::mlir::failure();
|
|
}
|
|
::llvm::copy(::llvm::ArrayRef<int32_t>({1, 1, static_cast<int32_t>(indicesOperands.size()), static_cast<int32_t>(sgprOffsetOperands.size())}), result.getOrAddProperties<RawBufferStoreOp::Properties>().operandSegmentSizes.begin());
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(32);
|
|
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(indicesOperands, indicesTypes, indicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (!sgprOffsetOperands.empty()) {
|
|
if (parser.resolveOperands(sgprOffsetOperands, odsBuildableType0, sgprOffsetOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void RawBufferStoreOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("operandSegmentSizes");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getBoundsCheckAttr();
|
|
if(attr && (attr == odsBuilder.getBoolAttr(true)))
|
|
elidedAttrs.push_back("boundsCheck");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getValue();
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getMemref();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getIndices();
|
|
_odsPrinter << "]";
|
|
if (getSgprOffset()) {
|
|
_odsPrinter << ' ' << "sgprOffset";
|
|
_odsPrinter << ' ';
|
|
if (::mlir::Value value = getSgprOffset())
|
|
_odsPrinter << value;
|
|
}
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getValue().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getMemref().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
if (!getIndices().empty()) {
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getIndices().getTypes();
|
|
}
|
|
}
|
|
|
|
void RawBufferStoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(1);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::RawBufferStoreOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::RawBufferStoreOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::ScaledExtPackedMatrixOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ScaledExtPackedMatrixOpGenericAdaptorBase::ScaledExtPackedMatrixOpGenericAdaptorBase(ScaledExtPackedMatrixOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t ScaledExtPackedMatrixOpGenericAdaptorBase::getBlockSize() {
|
|
auto attr = getBlockSizeAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledExtPackedMatrixOpGenericAdaptorBase::getFirstScaleLane() {
|
|
auto attr = getFirstScaleLaneAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledExtPackedMatrixOpGenericAdaptorBase::getFirstScaleByte() {
|
|
auto attr = getFirstScaleByteAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ScaledExtPackedMatrixOpAdaptor::ScaledExtPackedMatrixOpAdaptor(ScaledExtPackedMatrixOp op) : ScaledExtPackedMatrixOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedMatrixOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_blockSize = getProperties().blockSize; (void)tblgen_blockSize;
|
|
if (!tblgen_blockSize) return emitError(loc, "'amdgpu.scaled_ext_packed_matrix' op requires attribute 'blockSize'");
|
|
auto tblgen_firstScaleByte = getProperties().firstScaleByte; (void)tblgen_firstScaleByte;
|
|
if (!tblgen_firstScaleByte) return emitError(loc, "'amdgpu.scaled_ext_packed_matrix' op requires attribute 'firstScaleByte'");
|
|
auto tblgen_firstScaleLane = getProperties().firstScaleLane; (void)tblgen_firstScaleLane;
|
|
if (!tblgen_firstScaleLane) return emitError(loc, "'amdgpu.scaled_ext_packed_matrix' op requires attribute 'firstScaleLane'");
|
|
|
|
if (tblgen_blockSize && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_blockSize))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_blockSize).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_blockSize).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_ext_packed_matrix' op attribute 'blockSize' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}");
|
|
|
|
if (tblgen_firstScaleLane && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_firstScaleLane))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_firstScaleLane).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({0, 16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_firstScaleLane).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_ext_packed_matrix' op attribute 'firstScaleLane' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {0, 16}");
|
|
|
|
if (tblgen_firstScaleByte && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_firstScaleByte))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_firstScaleByte).getType().isSignlessInteger(32)))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_firstScaleByte).getInt() >= 0)) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_firstScaleByte).getInt() <= 3))))
|
|
return emitError(loc, "'amdgpu.scaled_ext_packed_matrix' op attribute 'firstScaleByte' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedMatrixOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.blockSize;
|
|
auto attr = dict.get("blockSize");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `blockSize` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.firstScaleByte;
|
|
auto attr = dict.get("firstScaleByte");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `firstScaleByte` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.firstScaleLane;
|
|
auto attr = dict.get("firstScaleLane");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `firstScaleLane` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ScaledExtPackedMatrixOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.blockSize;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("blockSize",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.firstScaleByte;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("firstScaleByte",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.firstScaleLane;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("firstScaleLane",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ScaledExtPackedMatrixOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.blockSize.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.firstScaleByte.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.firstScaleLane.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ScaledExtPackedMatrixOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "blockSize")
|
|
return prop.blockSize;
|
|
|
|
if (name == "firstScaleByte")
|
|
return prop.firstScaleByte;
|
|
|
|
if (name == "firstScaleLane")
|
|
return prop.firstScaleLane;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "blockSize") {
|
|
prop.blockSize = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.blockSize)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "firstScaleByte") {
|
|
prop.firstScaleByte = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.firstScaleByte)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "firstScaleLane") {
|
|
prop.firstScaleLane = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.firstScaleLane)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.blockSize) attrs.append("blockSize", prop.blockSize);
|
|
|
|
if (prop.firstScaleByte) attrs.append("firstScaleByte", prop.firstScaleByte);
|
|
|
|
if (prop.firstScaleLane) attrs.append("firstScaleLane", prop.firstScaleLane);
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedMatrixOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBlockSizeAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(attr, "blockSize", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFirstScaleByteAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU19(attr, "firstScaleByte", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFirstScaleLaneAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU18(attr, "firstScaleLane", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedMatrixOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.blockSize)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.firstScaleByte)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.firstScaleLane)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.blockSize);
|
|
writer.writeAttribute(prop.firstScaleByte);
|
|
writer.writeAttribute(prop.firstScaleLane);
|
|
}
|
|
|
|
uint32_t ScaledExtPackedMatrixOp::getBlockSize() {
|
|
auto attr = getBlockSizeAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledExtPackedMatrixOp::getFirstScaleLane() {
|
|
auto attr = getFirstScaleLaneAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledExtPackedMatrixOp::getFirstScaleByte() {
|
|
auto attr = getFirstScaleByteAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::setBlockSize(uint32_t attrValue) {
|
|
getProperties().blockSize = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::setFirstScaleLane(uint32_t attrValue) {
|
|
getProperties().firstScaleLane = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::setFirstScaleByte(uint32_t attrValue) {
|
|
getProperties().firstScaleByte = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr blockSize, ::mlir::IntegerAttr firstScaleLane, ::mlir::IntegerAttr firstScaleByte) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().blockSize = blockSize;
|
|
odsState.getOrAddProperties<Properties>().firstScaleLane = firstScaleLane;
|
|
odsState.getOrAddProperties<Properties>().firstScaleByte = firstScaleByte;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr blockSize, ::mlir::IntegerAttr firstScaleLane, ::mlir::IntegerAttr firstScaleByte) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedMatrixOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr blockSize, ::mlir::IntegerAttr firstScaleLane, ::mlir::IntegerAttr firstScaleByte) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr blockSize, ::mlir::IntegerAttr firstScaleLane, ::mlir::IntegerAttr firstScaleByte) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().blockSize = blockSize;
|
|
odsState.getOrAddProperties<Properties>().firstScaleLane = firstScaleLane;
|
|
odsState.getOrAddProperties<Properties>().firstScaleByte = firstScaleByte;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr blockSize, ::mlir::IntegerAttr firstScaleLane, ::mlir::IntegerAttr firstScaleByte) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedMatrixOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr blockSize, ::mlir::IntegerAttr firstScaleLane, ::mlir::IntegerAttr firstScaleByte) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t blockSize, uint32_t firstScaleLane, uint32_t firstScaleByte) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().blockSize = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), blockSize);
|
|
odsState.getOrAddProperties<Properties>().firstScaleLane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), firstScaleLane);
|
|
odsState.getOrAddProperties<Properties>().firstScaleByte = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), firstScaleByte);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t blockSize, uint32_t firstScaleLane, uint32_t firstScaleByte) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedMatrixOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t blockSize, uint32_t firstScaleLane, uint32_t firstScaleByte) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t blockSize, uint32_t firstScaleLane, uint32_t firstScaleByte) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().blockSize = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), blockSize);
|
|
odsState.getOrAddProperties<Properties>().firstScaleLane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), firstScaleLane);
|
|
odsState.getOrAddProperties<Properties>().firstScaleByte = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), firstScaleByte);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t blockSize, uint32_t firstScaleLane, uint32_t firstScaleByte) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedMatrixOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t blockSize, uint32_t firstScaleLane, uint32_t firstScaleByte) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(blockSize)>(blockSize), std::forward<decltype(firstScaleLane)>(firstScaleLane), std::forward<decltype(firstScaleByte)>(firstScaleByte));
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ScaledExtPackedMatrixOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedMatrixOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedMatrixOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedMatrixOp ScaledExtPackedMatrixOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedMatrixOp::verifyInvariantsImpl() {
|
|
auto tblgen_blockSize = getProperties().blockSize; (void)tblgen_blockSize;
|
|
if (!tblgen_blockSize) return emitOpError("requires attribute 'blockSize'");
|
|
auto tblgen_firstScaleByte = getProperties().firstScaleByte; (void)tblgen_firstScaleByte;
|
|
if (!tblgen_firstScaleByte) return emitOpError("requires attribute 'firstScaleByte'");
|
|
auto tblgen_firstScaleLane = getProperties().firstScaleLane; (void)tblgen_firstScaleLane;
|
|
if (!tblgen_firstScaleLane) return emitOpError("requires attribute 'firstScaleLane'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(*this, tblgen_blockSize, "blockSize")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU18(*this, tblgen_firstScaleLane, "firstScaleLane")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU19(*this, tblgen_firstScaleByte, "firstScaleByte")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU33(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU34(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU35(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) && (::llvm::cast<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()).getShape()) == (::llvm::cast<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()).getShape()))))
|
|
return emitOpError("failed to verify that all of {source, res} have same shape");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedMatrixOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ScaledExtPackedMatrixOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
|
|
(void)sourceOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand scaleRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scaleOperands(&scaleRawOperand, 1); ::llvm::SMLoc scaleOperandsLoc;
|
|
(void)scaleOperandsLoc;
|
|
::mlir::IntegerAttr blockSizeAttr;
|
|
::mlir::IntegerAttr firstScaleLaneAttr;
|
|
::mlir::IntegerAttr firstScaleByteAttr;
|
|
::mlir::Type sourceRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
|
|
::mlir::Type scaleRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> scaleTypes(&scaleRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
sourceOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("scale"))
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
scaleOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(scaleRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("blockSize"))
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(blockSizeAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (blockSizeAttr) result.getOrAddProperties<ScaledExtPackedMatrixOp::Properties>().blockSize = blockSizeAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("firstScaleLane"))
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(firstScaleLaneAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (firstScaleLaneAttr) result.getOrAddProperties<ScaledExtPackedMatrixOp::Properties>().firstScaleLane = firstScaleLaneAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("firstScaleByte"))
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(firstScaleByteAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (firstScaleByteAttr) result.getOrAddProperties<ScaledExtPackedMatrixOp::Properties>().firstScaleByte = firstScaleByteAttr;
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
scaleRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(scaleOperands, scaleTypes, scaleOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("blockSize");
|
|
elidedAttrs.push_back("firstScaleLane");
|
|
elidedAttrs.push_back("firstScaleByte");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSource();
|
|
_odsPrinter << ' ' << "scale";
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getScale();
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << "blockSize";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getBlockSizeAttr());
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << "firstScaleLane";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getFirstScaleLaneAttr());
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << "firstScaleByte";
|
|
_odsPrinter << "(";
|
|
_odsPrinter.printAttributeWithoutType(getFirstScaleByteAttr());
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSource().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getScale().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ScaledExtPackedMatrixOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::ScaledExtPackedMatrixOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::ScaledExtPackedMatrixOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::ScaledExtPackedOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ScaledExtPackedOpGenericAdaptorBase::ScaledExtPackedOpGenericAdaptorBase(ScaledExtPackedOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t ScaledExtPackedOpGenericAdaptorBase::getIndex() {
|
|
auto attr = getIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ScaledExtPackedOpAdaptor::ScaledExtPackedOpAdaptor(ScaledExtPackedOp op) : ScaledExtPackedOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_index = getProperties().index; (void)tblgen_index;
|
|
if (!tblgen_index) return emitError(loc, "'amdgpu.scaled_ext_packed' op requires attribute 'index'");
|
|
|
|
if (tblgen_index && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getInt() <= 7))))
|
|
return emitError(loc, "'amdgpu.scaled_ext_packed' op attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 7");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.index;
|
|
auto attr = dict.get("index");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `index` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ScaledExtPackedOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.index;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("index",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ScaledExtPackedOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.index.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ScaledExtPackedOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "index")
|
|
return prop.index;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ScaledExtPackedOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "index") {
|
|
prop.index = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.index)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ScaledExtPackedOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.index) attrs.append("index", prop.index);
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getIndexAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU15(attr, "index", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.index)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledExtPackedOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.index);
|
|
}
|
|
|
|
uint32_t ScaledExtPackedOp::getIndex() {
|
|
auto attr = getIndexAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void ScaledExtPackedOp::setIndex(uint32_t attrValue) {
|
|
getProperties().index = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledExtPackedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().index = index;
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ScaledExtPackedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().index = index;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, ::mlir::IntegerAttr index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ScaledExtPackedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t index) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
|
|
odsState.addTypes(res);
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res, ::mlir::Value source, ::mlir::Value scale, uint32_t index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(res)>(res), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ScaledExtPackedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t index) {
|
|
odsState.addOperands(source);
|
|
odsState.addOperands(scale);
|
|
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t index) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value scale, uint32_t index) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(scale)>(scale), std::forward<decltype(index)>(index));
|
|
}
|
|
|
|
void ScaledExtPackedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ScaledExtPackedOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ScaledExtPackedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledExtPackedOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledExtPackedOp ScaledExtPackedOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedOp::verifyInvariantsImpl() {
|
|
auto tblgen_index = getProperties().index; (void)tblgen_index;
|
|
if (!tblgen_index) return emitOpError("requires attribute 'index'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU15(*this, tblgen_index, "index")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU36(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU26(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU37(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledExtPackedOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ScaledExtPackedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
|
|
(void)sourceOperandsLoc;
|
|
::mlir::IntegerAttr indexAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand scaleRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scaleOperands(&scaleRawOperand, 1); ::llvm::SMLoc scaleOperandsLoc;
|
|
(void)scaleOperandsLoc;
|
|
::mlir::Type sourceRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
|
|
::mlir::Type resRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
sourceOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(indexAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (indexAttr) result.getOrAddProperties<ScaledExtPackedOp::Properties>().index = indexAttr;
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
scaleOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(scaleRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceRawType = type;
|
|
}
|
|
if (parser.parseKeyword("to"))
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getF32Type();
|
|
result.addTypes(resTypes);
|
|
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(scaleOperands, odsBuildableType0, scaleOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledExtPackedOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("index");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSource();
|
|
_odsPrinter << "[";
|
|
_odsPrinter.printAttributeWithoutType(getIndexAttr());
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getScale();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSource().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "to";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getRes().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ScaledExtPackedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::ScaledExtPackedOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::ScaledExtPackedOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::ScaledMFMAOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ScaledMFMAOpGenericAdaptorBase::ScaledMFMAOpGenericAdaptorBase(ScaledMFMAOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t ScaledMFMAOpGenericAdaptorBase::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOpGenericAdaptorBase::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOpGenericAdaptorBase::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOpGenericAdaptorBase::getScalesIdxA() {
|
|
auto attr = getScalesIdxAAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOpGenericAdaptorBase::getScalesIdxB() {
|
|
auto attr = getScalesIdxBAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ScaledMFMAOpAdaptor::ScaledMFMAOpAdaptor(ScaledMFMAOp op) : ScaledMFMAOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ScaledMFMAOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitError(loc, "'amdgpu.scaled_mfma' op requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitError(loc, "'amdgpu.scaled_mfma' op requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitError(loc, "'amdgpu.scaled_mfma' op requires attribute 'n'");
|
|
auto tblgen_scalesIdxA = getProperties().scalesIdxA; (void)tblgen_scalesIdxA;
|
|
if (!tblgen_scalesIdxA) return emitError(loc, "'amdgpu.scaled_mfma' op requires attribute 'scalesIdxA'");
|
|
auto tblgen_scalesIdxB = getProperties().scalesIdxB; (void)tblgen_scalesIdxB;
|
|
if (!tblgen_scalesIdxB) return emitError(loc, "'amdgpu.scaled_mfma' op requires attribute 'scalesIdxB'");
|
|
|
|
if (tblgen_m && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_mfma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}");
|
|
|
|
if (tblgen_n && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_mfma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}");
|
|
|
|
if (tblgen_k && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({64, 128}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_mfma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {64, 128}");
|
|
|
|
if (tblgen_scalesIdxA && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_scalesIdxA))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_scalesIdxA).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_scalesIdxA).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_scalesIdxA).getInt() <= 3))))
|
|
return emitError(loc, "'amdgpu.scaled_mfma' op attribute 'scalesIdxA' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3");
|
|
|
|
if (tblgen_scalesIdxB && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_scalesIdxB))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_scalesIdxB).getType().isSignlessInteger(32)))) && ((!::llvm::cast<::mlir::IntegerAttr>(tblgen_scalesIdxB).getValue().isNegative())) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_scalesIdxB).getInt() <= 3))))
|
|
return emitError(loc, "'amdgpu.scaled_mfma' op attribute 'scalesIdxB' failed to satisfy constraint: 32-bit signless integer attribute whose value is non-negative whose maximum value is 3");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledMFMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.k;
|
|
auto attr = dict.get("k");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `k` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.m;
|
|
auto attr = dict.get("m");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `m` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.n;
|
|
auto attr = dict.get("n");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `n` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.scalesIdxA;
|
|
auto attr = dict.get("scalesIdxA");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `scalesIdxA` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.scalesIdxB;
|
|
auto attr = dict.get("scalesIdxB");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `scalesIdxB` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ScaledMFMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.k;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("k",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.m;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("m",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.n;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("n",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.scalesIdxA;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("scalesIdxA",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.scalesIdxB;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("scalesIdxB",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ScaledMFMAOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.k.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.m.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.n.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.scalesIdxA.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.scalesIdxB.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ScaledMFMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "k")
|
|
return prop.k;
|
|
|
|
if (name == "m")
|
|
return prop.m;
|
|
|
|
if (name == "n")
|
|
return prop.n;
|
|
|
|
if (name == "scalesIdxA")
|
|
return prop.scalesIdxA;
|
|
|
|
if (name == "scalesIdxB")
|
|
return prop.scalesIdxB;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ScaledMFMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "k") {
|
|
prop.k = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.k)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "m") {
|
|
prop.m = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.m)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "n") {
|
|
prop.n = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.n)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "scalesIdxA") {
|
|
prop.scalesIdxA = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.scalesIdxA)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "scalesIdxB") {
|
|
prop.scalesIdxB = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.scalesIdxB)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ScaledMFMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.k) attrs.append("k", prop.k);
|
|
|
|
if (prop.m) attrs.append("m", prop.m);
|
|
|
|
if (prop.n) attrs.append("n", prop.n);
|
|
|
|
if (prop.scalesIdxA) attrs.append("scalesIdxA", prop.scalesIdxA);
|
|
|
|
if (prop.scalesIdxB) attrs.append("scalesIdxB", prop.scalesIdxB);
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledMFMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getKAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU20(attr, "k", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(attr, "m", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(attr, "n", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getScalesIdxAAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(attr, "scalesIdxA", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getScalesIdxBAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(attr, "scalesIdxB", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledMFMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.k)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.m)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.n)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.scalesIdxA)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.scalesIdxB)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledMFMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.k);
|
|
writer.writeAttribute(prop.m);
|
|
writer.writeAttribute(prop.n);
|
|
writer.writeAttribute(prop.scalesIdxA);
|
|
writer.writeAttribute(prop.scalesIdxB);
|
|
}
|
|
|
|
uint32_t ScaledMFMAOp::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOp::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOp::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOp::getScalesIdxA() {
|
|
auto attr = getScalesIdxAAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledMFMAOp::getScalesIdxB() {
|
|
auto attr = getScalesIdxBAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void ScaledMFMAOp::setM(uint32_t attrValue) {
|
|
getProperties().m = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledMFMAOp::setN(uint32_t attrValue) {
|
|
getProperties().n = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledMFMAOp::setK(uint32_t attrValue) {
|
|
getProperties().k = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledMFMAOp::setScalesIdxA(uint32_t attrValue) {
|
|
getProperties().scalesIdxA = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledMFMAOp::setScalesIdxB(uint32_t attrValue) {
|
|
getProperties().scalesIdxB = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scalesA);
|
|
odsState.addOperands(scalesB);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
odsState.getOrAddProperties<Properties>().scalesIdxA = scalesIdxA;
|
|
odsState.getOrAddProperties<Properties>().scalesIdxB = scalesIdxB;
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scalesA);
|
|
odsState.addOperands(scalesB);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
odsState.getOrAddProperties<Properties>().scalesIdxA = scalesIdxA;
|
|
odsState.getOrAddProperties<Properties>().scalesIdxB = scalesIdxB;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scalesA);
|
|
odsState.addOperands(scalesB);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
odsState.getOrAddProperties<Properties>().scalesIdxA = scalesIdxA;
|
|
odsState.getOrAddProperties<Properties>().scalesIdxB = scalesIdxB;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, ::mlir::IntegerAttr scalesIdxA, ::mlir::IntegerAttr scalesIdxB) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scalesA);
|
|
odsState.addOperands(scalesB);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().scalesIdxA = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), scalesIdxA);
|
|
odsState.getOrAddProperties<Properties>().scalesIdxB = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), scalesIdxB);
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scalesA);
|
|
odsState.addOperands(scalesB);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().scalesIdxA = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), scalesIdxA);
|
|
odsState.getOrAddProperties<Properties>().scalesIdxB = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), scalesIdxB);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scalesA);
|
|
odsState.addOperands(scalesB);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().scalesIdxA = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), scalesIdxA);
|
|
odsState.getOrAddProperties<Properties>().scalesIdxB = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), scalesIdxB);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scalesA, ::mlir::Value scalesB, uint32_t scalesIdxA, uint32_t scalesIdxB) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scalesA)>(scalesA), std::forward<decltype(scalesB)>(scalesB), std::forward<decltype(scalesIdxA)>(scalesIdxA), std::forward<decltype(scalesIdxB)>(scalesIdxB));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ScaledMFMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ScaledMFMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void ScaledMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledMFMAOp ScaledMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledMFMAOp::verifyInvariantsImpl() {
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitOpError("requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitOpError("requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitOpError("requires attribute 'n'");
|
|
auto tblgen_scalesIdxA = getProperties().scalesIdxA; (void)tblgen_scalesIdxA;
|
|
if (!tblgen_scalesIdxA) return emitOpError("requires attribute 'scalesIdxA'");
|
|
auto tblgen_scalesIdxB = getProperties().scalesIdxB; (void)tblgen_scalesIdxB;
|
|
if (!tblgen_scalesIdxB) return emitOpError("requires attribute 'scalesIdxB'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(*this, tblgen_m, "m")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(*this, tblgen_n, "n")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU20(*this, tblgen_k, "k")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(*this, tblgen_scalesIdxA, "scalesIdxA")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU6(*this, tblgen_scalesIdxB, "scalesIdxB")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU38(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU38(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU39(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU40(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup4 = getODSOperands(4);
|
|
|
|
for (auto v : valueGroup4) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU40(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU39(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {destC, destD} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledMFMAOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledMFMAOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult ScaledMFMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::IntegerAttr mAttr;
|
|
::mlir::IntegerAttr nAttr;
|
|
::mlir::IntegerAttr kAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand scalesARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scalesAOperands(&scalesARawOperand, 1); ::llvm::SMLoc scalesAOperandsLoc;
|
|
(void)scalesAOperandsLoc;
|
|
::mlir::IntegerAttr scalesIdxAAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand scalesBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scalesBOperands(&scalesBRawOperand, 1); ::llvm::SMLoc scalesBOperandsLoc;
|
|
(void)scalesBOperandsLoc;
|
|
::mlir::IntegerAttr scalesIdxBAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(&sourceBRawOperand, 1); ::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand destCRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(&destCRawOperand, 1); ::llvm::SMLoc destCOperandsLoc;
|
|
(void)destCOperandsLoc;
|
|
::mlir::Type scalesARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> scalesATypes(&scalesARawType, 1);
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type scalesBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> scalesBTypes(&scalesBRawType, 1);
|
|
::mlir::Type sourceBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceBTypes(&sourceBRawType, 1);
|
|
::mlir::Type destCRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> destCTypes(&destCRawType, 1);
|
|
{
|
|
auto odsResult = parseMNKDimensionList(parser, mAttr, nAttr, kAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<ScaledMFMAOp::Properties>().m = mAttr;
|
|
result.getOrAddProperties<ScaledMFMAOp::Properties>().n = nAttr;
|
|
result.getOrAddProperties<ScaledMFMAOp::Properties>().k = kAttr;
|
|
}
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
scalesAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(scalesARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(scalesIdxAAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (scalesIdxAAttr) result.getOrAddProperties<ScaledMFMAOp::Properties>().scalesIdxA = scalesIdxAAttr;
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
scalesBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(scalesBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(scalesIdxBAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (scalesIdxBAttr) result.getOrAddProperties<ScaledMFMAOp::Properties>().scalesIdxB = scalesIdxBAttr;
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
destCOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(destCRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
scalesARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
scalesBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
destCRawType = type;
|
|
}
|
|
result.addTypes(destCTypes[0]);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(scalesAOperands, scalesATypes, scalesAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(scalesBOperands, scalesBTypes, scalesBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledMFMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
printMNKDimensionList(_odsPrinter, *this, getMAttr(), getNAttr(), getKAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getScalesA();
|
|
_odsPrinter << "[";
|
|
_odsPrinter.printAttributeWithoutType(getScalesIdxAAttr());
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ' << "(";
|
|
_odsPrinter << getScalesB();
|
|
_odsPrinter << "[";
|
|
_odsPrinter.printAttributeWithoutType(getScalesIdxBAttr());
|
|
_odsPrinter << "]";
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceB();
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestC();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("m");
|
|
elidedAttrs.push_back("n");
|
|
elidedAttrs.push_back("k");
|
|
elidedAttrs.push_back("scalesIdxA");
|
|
elidedAttrs.push_back("scalesIdxB");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getScalesA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getScalesB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDestC().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ScaledMFMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::ScaledMFMAOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::ScaledMFMAOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::ScaledWMMAOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ScaledWMMAOpGenericAdaptorBase::ScaledWMMAOpGenericAdaptorBase(ScaledWMMAOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t ScaledWMMAOpGenericAdaptorBase::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOpGenericAdaptorBase::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOpGenericAdaptorBase::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOpGenericAdaptorBase::getAFirstScaleLane() {
|
|
auto attr = getAFirstScaleLaneAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOpGenericAdaptorBase::getBFirstScaleLane() {
|
|
auto attr = getBFirstScaleLaneAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ScaledWMMAOpAdaptor::ScaledWMMAOpAdaptor(ScaledWMMAOp op) : ScaledWMMAOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ScaledWMMAOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_a_first_scale_lane = getProperties().a_first_scale_lane; (void)tblgen_a_first_scale_lane;
|
|
if (!tblgen_a_first_scale_lane) return emitError(loc, "'amdgpu.scaled_wmma' op requires attribute 'a_first_scale_lane'");
|
|
auto tblgen_b_first_scale_lane = getProperties().b_first_scale_lane; (void)tblgen_b_first_scale_lane;
|
|
if (!tblgen_b_first_scale_lane) return emitError(loc, "'amdgpu.scaled_wmma' op requires attribute 'b_first_scale_lane'");
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitError(loc, "'amdgpu.scaled_wmma' op requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitError(loc, "'amdgpu.scaled_wmma' op requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitError(loc, "'amdgpu.scaled_wmma' op requires attribute 'n'");
|
|
|
|
if (tblgen_m && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_wmma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}");
|
|
|
|
if (tblgen_n && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_wmma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16}");
|
|
|
|
if (tblgen_k && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({128}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_wmma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {128}");
|
|
|
|
if (tblgen_a_first_scale_lane && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_a_first_scale_lane))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_a_first_scale_lane).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({0, 16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_a_first_scale_lane).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_wmma' op attribute 'a_first_scale_lane' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {0, 16}");
|
|
|
|
if (tblgen_b_first_scale_lane && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_b_first_scale_lane))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_b_first_scale_lane).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({0, 16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_b_first_scale_lane).getInt())))))
|
|
return emitError(loc, "'amdgpu.scaled_wmma' op attribute 'b_first_scale_lane' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {0, 16}");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledWMMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.a_first_scale_lane;
|
|
auto attr = dict.get("a_first_scale_lane");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `a_first_scale_lane` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.b_first_scale_lane;
|
|
auto attr = dict.get("b_first_scale_lane");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `b_first_scale_lane` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.k;
|
|
auto attr = dict.get("k");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `k` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.m;
|
|
auto attr = dict.get("m");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `m` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.n;
|
|
auto attr = dict.get("n");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `n` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ScaledWMMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.a_first_scale_lane;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("a_first_scale_lane",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.b_first_scale_lane;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("b_first_scale_lane",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.k;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("k",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.m;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("m",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.n;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("n",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ScaledWMMAOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.a_first_scale_lane.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.b_first_scale_lane.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.k.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.m.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.n.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ScaledWMMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "a_first_scale_lane")
|
|
return prop.a_first_scale_lane;
|
|
|
|
if (name == "b_first_scale_lane")
|
|
return prop.b_first_scale_lane;
|
|
|
|
if (name == "k")
|
|
return prop.k;
|
|
|
|
if (name == "m")
|
|
return prop.m;
|
|
|
|
if (name == "n")
|
|
return prop.n;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ScaledWMMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "a_first_scale_lane") {
|
|
prop.a_first_scale_lane = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.a_first_scale_lane)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "b_first_scale_lane") {
|
|
prop.b_first_scale_lane = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.b_first_scale_lane)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "k") {
|
|
prop.k = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.k)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "m") {
|
|
prop.m = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.m)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "n") {
|
|
prop.n = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.n)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ScaledWMMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.a_first_scale_lane) attrs.append("a_first_scale_lane", prop.a_first_scale_lane);
|
|
|
|
if (prop.b_first_scale_lane) attrs.append("b_first_scale_lane", prop.b_first_scale_lane);
|
|
|
|
if (prop.k) attrs.append("k", prop.k);
|
|
|
|
if (prop.m) attrs.append("m", prop.m);
|
|
|
|
if (prop.n) attrs.append("n", prop.n);
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledWMMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAFirstScaleLaneAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU18(attr, "a_first_scale_lane", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getBFirstScaleLaneAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU18(attr, "b_first_scale_lane", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getKAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU22(attr, "k", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(attr, "m", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(attr, "n", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledWMMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.a_first_scale_lane)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.b_first_scale_lane)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.k)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.m)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.n)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledWMMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.a_first_scale_lane);
|
|
writer.writeAttribute(prop.b_first_scale_lane);
|
|
writer.writeAttribute(prop.k);
|
|
writer.writeAttribute(prop.m);
|
|
writer.writeAttribute(prop.n);
|
|
}
|
|
|
|
uint32_t ScaledWMMAOp::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOp::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOp::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOp::getAFirstScaleLane() {
|
|
auto attr = getAFirstScaleLaneAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t ScaledWMMAOp::getBFirstScaleLane() {
|
|
auto attr = getBFirstScaleLaneAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void ScaledWMMAOp::setM(uint32_t attrValue) {
|
|
getProperties().m = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledWMMAOp::setN(uint32_t attrValue) {
|
|
getProperties().n = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledWMMAOp::setK(uint32_t attrValue) {
|
|
getProperties().k = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledWMMAOp::setAFirstScaleLane(uint32_t attrValue) {
|
|
getProperties().a_first_scale_lane = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledWMMAOp::setBFirstScaleLane(uint32_t attrValue) {
|
|
getProperties().b_first_scale_lane = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scaleA);
|
|
odsState.addOperands(scaleB);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
odsState.getOrAddProperties<Properties>().a_first_scale_lane = a_first_scale_lane;
|
|
odsState.getOrAddProperties<Properties>().b_first_scale_lane = b_first_scale_lane;
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scaleA);
|
|
odsState.addOperands(scaleB);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
odsState.getOrAddProperties<Properties>().a_first_scale_lane = a_first_scale_lane;
|
|
odsState.getOrAddProperties<Properties>().b_first_scale_lane = b_first_scale_lane;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scaleA);
|
|
odsState.addOperands(scaleB);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
odsState.getOrAddProperties<Properties>().a_first_scale_lane = a_first_scale_lane;
|
|
odsState.getOrAddProperties<Properties>().b_first_scale_lane = b_first_scale_lane;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, ::mlir::IntegerAttr a_first_scale_lane, ::mlir::Value scaleB, ::mlir::IntegerAttr b_first_scale_lane) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scaleA);
|
|
odsState.addOperands(scaleB);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().a_first_scale_lane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), a_first_scale_lane);
|
|
odsState.getOrAddProperties<Properties>().b_first_scale_lane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), b_first_scale_lane);
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scaleA);
|
|
odsState.addOperands(scaleB);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().a_first_scale_lane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), a_first_scale_lane);
|
|
odsState.getOrAddProperties<Properties>().b_first_scale_lane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), b_first_scale_lane);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(scaleA);
|
|
odsState.addOperands(scaleB);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().a_first_scale_lane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), a_first_scale_lane);
|
|
odsState.getOrAddProperties<Properties>().b_first_scale_lane = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), b_first_scale_lane);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value scaleA, uint32_t a_first_scale_lane, ::mlir::Value scaleB, uint32_t b_first_scale_lane) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(scaleA)>(scaleA), std::forward<decltype(a_first_scale_lane)>(a_first_scale_lane), std::forward<decltype(scaleB)>(scaleB), std::forward<decltype(b_first_scale_lane)>(b_first_scale_lane));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ScaledWMMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ScaledWMMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void ScaledWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 5u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ScaledWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ScaledWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ScaledWMMAOp ScaledWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledWMMAOp::verifyInvariantsImpl() {
|
|
auto tblgen_a_first_scale_lane = getProperties().a_first_scale_lane; (void)tblgen_a_first_scale_lane;
|
|
if (!tblgen_a_first_scale_lane) return emitOpError("requires attribute 'a_first_scale_lane'");
|
|
auto tblgen_b_first_scale_lane = getProperties().b_first_scale_lane; (void)tblgen_b_first_scale_lane;
|
|
if (!tblgen_b_first_scale_lane) return emitOpError("requires attribute 'b_first_scale_lane'");
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitOpError("requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitOpError("requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitOpError("requires attribute 'n'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(*this, tblgen_m, "m")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(*this, tblgen_n, "n")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU22(*this, tblgen_k, "k")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU18(*this, tblgen_a_first_scale_lane, "a_first_scale_lane")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU18(*this, tblgen_b_first_scale_lane, "b_first_scale_lane")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU41(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU41(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU42(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU43(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup4 = getODSOperands(4);
|
|
|
|
for (auto v : valueGroup4) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU43(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU42(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {destC, destD} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledWMMAOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult ScaledWMMAOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult ScaledWMMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::IntegerAttr mAttr;
|
|
::mlir::IntegerAttr nAttr;
|
|
::mlir::IntegerAttr kAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand scaleARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scaleAOperands(&scaleARawOperand, 1); ::llvm::SMLoc scaleAOperandsLoc;
|
|
(void)scaleAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand scaleBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> scaleBOperands(&scaleBRawOperand, 1); ::llvm::SMLoc scaleBOperandsLoc;
|
|
(void)scaleBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(&sourceBRawOperand, 1); ::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand destCRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(&destCRawOperand, 1); ::llvm::SMLoc destCOperandsLoc;
|
|
(void)destCOperandsLoc;
|
|
::mlir::Type scaleARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> scaleATypes(&scaleARawType, 1);
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type scaleBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> scaleBTypes(&scaleBRawType, 1);
|
|
::mlir::Type sourceBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceBTypes(&sourceBRawType, 1);
|
|
::mlir::Type destCRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> destCTypes(&destCRawType, 1);
|
|
{
|
|
auto odsResult = parseMNKDimensionList(parser, mAttr, nAttr, kAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<ScaledWMMAOp::Properties>().m = mAttr;
|
|
result.getOrAddProperties<ScaledWMMAOp::Properties>().n = nAttr;
|
|
result.getOrAddProperties<ScaledWMMAOp::Properties>().k = kAttr;
|
|
}
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
scaleAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(scaleARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
scaleBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(scaleBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
destCOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(destCRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
scaleARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::VectorType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
scaleBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
destCRawType = type;
|
|
}
|
|
result.addTypes(destCTypes[0]);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(scaleAOperands, scaleATypes, scaleAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(scaleBOperands, scaleBTypes, scaleBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ScaledWMMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
printMNKDimensionList(_odsPrinter, *this, getMAttr(), getNAttr(), getKAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getScaleA();
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ' << "(";
|
|
_odsPrinter << getScaleB();
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceB();
|
|
_odsPrinter << ")";
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestC();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("m");
|
|
elidedAttrs.push_back("n");
|
|
elidedAttrs.push_back("k");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getScaleA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getScaleB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::VectorType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDestC().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ScaledWMMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::ScaledWMMAOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::ScaledWMMAOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::SchedBarrierOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SchedBarrierOpGenericAdaptorBase::SchedBarrierOpGenericAdaptorBase(SchedBarrierOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::ROCDL::SchedGroupMask SchedBarrierOpGenericAdaptorBase::getOpts() {
|
|
auto attr = getOptsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
SchedBarrierOpAdaptor::SchedBarrierOpAdaptor(SchedBarrierOp op) : SchedBarrierOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SchedBarrierOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_opts = getProperties().opts; (void)tblgen_opts;
|
|
if (!tblgen_opts) return emitError(loc, "'amdgpu.sched_barrier' op requires attribute 'opts'");
|
|
|
|
if (tblgen_opts && !((::llvm::isa<::mlir::ROCDL::SchedGroupMaskAttr>(tblgen_opts))))
|
|
return emitError(loc, "'amdgpu.sched_barrier' op attribute 'opts' failed to satisfy constraint: instruction type mask for scheduling barriers");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SchedBarrierOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.opts;
|
|
auto attr = dict.get("opts");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `opts` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SchedBarrierOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.opts;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("opts",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SchedBarrierOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.opts.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SchedBarrierOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "opts")
|
|
return prop.opts;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SchedBarrierOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "opts") {
|
|
prop.opts = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.opts)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SchedBarrierOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.opts) attrs.append("opts", prop.opts);
|
|
}
|
|
|
|
::llvm::LogicalResult SchedBarrierOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOptsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU23(attr, "opts", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SchedBarrierOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.opts)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SchedBarrierOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.opts);
|
|
}
|
|
|
|
::mlir::ROCDL::SchedGroupMask SchedBarrierOp::getOpts() {
|
|
auto attr = getOptsAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void SchedBarrierOp::setOpts(::mlir::ROCDL::SchedGroupMask attrValue) {
|
|
getProperties().opts = ::mlir::ROCDL::SchedGroupMaskAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void SchedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ROCDL::SchedGroupMaskAttr opts) {
|
|
odsState.getOrAddProperties<Properties>().opts = opts;
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ROCDL::SchedGroupMaskAttr opts) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(opts)>(opts));
|
|
auto __res__ = ::llvm::dyn_cast<SchedBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ROCDL::SchedGroupMaskAttr opts) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(opts)>(opts));
|
|
}
|
|
|
|
void SchedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ROCDL::SchedGroupMaskAttr opts) {
|
|
odsState.getOrAddProperties<Properties>().opts = opts;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ROCDL::SchedGroupMaskAttr opts) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(opts)>(opts));
|
|
auto __res__ = ::llvm::dyn_cast<SchedBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ROCDL::SchedGroupMaskAttr opts) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(opts)>(opts));
|
|
}
|
|
|
|
void SchedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ROCDL::SchedGroupMask opts) {
|
|
odsState.getOrAddProperties<Properties>().opts = ::mlir::ROCDL::SchedGroupMaskAttr::get(odsBuilder.getContext(), opts);
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ROCDL::SchedGroupMask opts) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(opts)>(opts));
|
|
auto __res__ = ::llvm::dyn_cast<SchedBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ROCDL::SchedGroupMask opts) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(opts)>(opts));
|
|
}
|
|
|
|
void SchedBarrierOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ROCDL::SchedGroupMask opts) {
|
|
odsState.getOrAddProperties<Properties>().opts = ::mlir::ROCDL::SchedGroupMaskAttr::get(odsBuilder.getContext(), opts);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ROCDL::SchedGroupMask opts) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(opts)>(opts));
|
|
auto __res__ = ::llvm::dyn_cast<SchedBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ROCDL::SchedGroupMask opts) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(opts)>(opts));
|
|
}
|
|
|
|
void SchedBarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SchedBarrierOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SchedBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SchedBarrierOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SchedBarrierOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SchedBarrierOp SchedBarrierOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SchedBarrierOp::verifyInvariantsImpl() {
|
|
auto tblgen_opts = getProperties().opts; (void)tblgen_opts;
|
|
if (!tblgen_opts) return emitOpError("requires attribute 'opts'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU23(*this, tblgen_opts, "opts")))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SchedBarrierOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult SchedBarrierOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::ROCDL::SchedGroupMaskAttr optsAttr;
|
|
if (parser.parseKeyword("allow"))
|
|
return ::mlir::failure();
|
|
if (parser.parseEqual())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(optsAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (optsAttr) result.getOrAddProperties<SchedBarrierOp::Properties>().opts = optsAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SchedBarrierOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ' << "allow";
|
|
_odsPrinter << ' ' << "=";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getOptsAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("opts");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::SchedBarrierOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::SchedBarrierOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::SparseMFMAOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SparseMFMAOpGenericAdaptorBase::SparseMFMAOpGenericAdaptorBase(SparseMFMAOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t SparseMFMAOpGenericAdaptorBase::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseMFMAOpGenericAdaptorBase::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseMFMAOpGenericAdaptorBase::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::IntegerAttr SparseMFMAOpGenericAdaptorBase::getCbszAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().cbsz);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t SparseMFMAOpGenericAdaptorBase::getCbsz() {
|
|
auto attr = getCbszAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::IntegerAttr SparseMFMAOpGenericAdaptorBase::getAbidAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().abid);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t SparseMFMAOpGenericAdaptorBase::getAbid() {
|
|
auto attr = getAbidAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
SparseMFMAOpAdaptor::SparseMFMAOpAdaptor(SparseMFMAOp op) : SparseMFMAOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SparseMFMAOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_abid = getProperties().abid; (void)tblgen_abid;
|
|
auto tblgen_cbsz = getProperties().cbsz; (void)tblgen_cbsz;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitError(loc, "'amdgpu.sparse_mfma' op requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitError(loc, "'amdgpu.sparse_mfma' op requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitError(loc, "'amdgpu.sparse_mfma' op requires attribute 'n'");
|
|
|
|
if (tblgen_m && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getInt())))))
|
|
return emitError(loc, "'amdgpu.sparse_mfma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}");
|
|
|
|
if (tblgen_n && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getInt())))))
|
|
return emitError(loc, "'amdgpu.sparse_mfma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}");
|
|
|
|
if (tblgen_k && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16, 32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getInt())))))
|
|
return emitError(loc, "'amdgpu.sparse_mfma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32, 64, 128}");
|
|
|
|
if (tblgen_cbsz && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_cbsz))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_cbsz).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.sparse_mfma' op attribute 'cbsz' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_abid && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_abid))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_abid).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.sparse_mfma' op attribute 'abid' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseMFMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.abid;
|
|
auto attr = dict.get("abid");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `abid` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.cbsz;
|
|
auto attr = dict.get("cbsz");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `cbsz` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.k;
|
|
auto attr = dict.get("k");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `k` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.m;
|
|
auto attr = dict.get("m");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `m` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.n;
|
|
auto attr = dict.get("n");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `n` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SparseMFMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.abid;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("abid",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.cbsz;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("cbsz",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.k;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("k",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.m;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("m",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.n;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("n",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SparseMFMAOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.abid.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.cbsz.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.k.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.m.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.n.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SparseMFMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "abid")
|
|
return prop.abid;
|
|
|
|
if (name == "cbsz")
|
|
return prop.cbsz;
|
|
|
|
if (name == "k")
|
|
return prop.k;
|
|
|
|
if (name == "m")
|
|
return prop.m;
|
|
|
|
if (name == "n")
|
|
return prop.n;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SparseMFMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "abid") {
|
|
prop.abid = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.abid)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "cbsz") {
|
|
prop.cbsz = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cbsz)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "k") {
|
|
prop.k = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.k)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "m") {
|
|
prop.m = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.m)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "n") {
|
|
prop.n = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.n)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SparseMFMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.abid) attrs.append("abid", prop.abid);
|
|
|
|
if (prop.cbsz) attrs.append("cbsz", prop.cbsz);
|
|
|
|
if (prop.k) attrs.append("k", prop.k);
|
|
|
|
if (prop.m) attrs.append("m", prop.m);
|
|
|
|
if (prop.n) attrs.append("n", prop.n);
|
|
}
|
|
|
|
::llvm::LogicalResult SparseMFMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAbidAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "abid", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getCbszAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "cbsz", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getKAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU24(attr, "k", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(attr, "m", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(attr, "n", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseMFMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.abid)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.cbsz)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.k)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.m)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.n)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SparseMFMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.abid);
|
|
|
|
writer.writeOptionalAttribute(prop.cbsz);
|
|
writer.writeAttribute(prop.k);
|
|
writer.writeAttribute(prop.m);
|
|
writer.writeAttribute(prop.n);
|
|
}
|
|
|
|
uint32_t SparseMFMAOp::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseMFMAOp::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseMFMAOp::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseMFMAOp::getCbsz() {
|
|
auto attr = getCbszAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseMFMAOp::getAbid() {
|
|
auto attr = getAbidAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void SparseMFMAOp::setM(uint32_t attrValue) {
|
|
getProperties().m = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseMFMAOp::setN(uint32_t attrValue) {
|
|
getProperties().n = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseMFMAOp::setK(uint32_t attrValue) {
|
|
getProperties().k = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseMFMAOp::setCbsz(uint32_t attrValue) {
|
|
getProperties().cbsz = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseMFMAOp::setAbid(uint32_t attrValue) {
|
|
getProperties().abid = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (cbsz) {
|
|
odsState.getOrAddProperties<Properties>().cbsz = cbsz;
|
|
}
|
|
if (abid) {
|
|
odsState.getOrAddProperties<Properties>().abid = abid;
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (cbsz) {
|
|
odsState.getOrAddProperties<Properties>().cbsz = cbsz;
|
|
}
|
|
if (abid) {
|
|
odsState.getOrAddProperties<Properties>().abid = abid;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (cbsz) {
|
|
odsState.getOrAddProperties<Properties>().cbsz = cbsz;
|
|
}
|
|
if (abid) {
|
|
odsState.getOrAddProperties<Properties>().abid = abid;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, ::mlir::IntegerAttr cbsz, ::mlir::IntegerAttr abid) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz);
|
|
odsState.getOrAddProperties<Properties>().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid);
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz);
|
|
odsState.getOrAddProperties<Properties>().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), cbsz);
|
|
odsState.getOrAddProperties<Properties>().abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), abid);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, uint32_t cbsz, uint32_t abid) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(cbsz)>(cbsz), std::forward<decltype(abid)>(abid));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SparseMFMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SparseMFMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SparseMFMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseMFMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseMFMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseMFMAOp SparseMFMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SparseMFMAOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.cbsz)
|
|
properties.cbsz = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0);
|
|
if (!properties.abid)
|
|
properties.abid = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0);
|
|
}
|
|
|
|
::llvm::LogicalResult SparseMFMAOp::verifyInvariantsImpl() {
|
|
auto tblgen_abid = getProperties().abid; (void)tblgen_abid;
|
|
auto tblgen_cbsz = getProperties().cbsz; (void)tblgen_cbsz;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitOpError("requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitOpError("requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitOpError("requires attribute 'n'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(*this, tblgen_m, "m")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU17(*this, tblgen_n, "n")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU24(*this, tblgen_k, "k")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_cbsz, "cbsz")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_abid, "abid")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU44(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU45(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU46(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU47(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU46(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {destC, destD} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseMFMAOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseMFMAOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult SparseMFMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::IntegerAttr mAttr;
|
|
::mlir::IntegerAttr nAttr;
|
|
::mlir::IntegerAttr kAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(&sourceBRawOperand, 1); ::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand destCRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(&destCRawOperand, 1); ::llvm::SMLoc destCOperandsLoc;
|
|
(void)destCOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sparseIdxRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sparseIdxOperands(&sparseIdxRawOperand, 1); ::llvm::SMLoc sparseIdxOperandsLoc;
|
|
(void)sparseIdxOperandsLoc;
|
|
::mlir::Type sparseIdxRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sparseIdxTypes(&sparseIdxRawType, 1);
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type sourceBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceBTypes(&sourceBRawType, 1);
|
|
::mlir::Type destCRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> destCTypes(&destCRawType, 1);
|
|
{
|
|
auto odsResult = parseMNKDimensionList(parser, mAttr, nAttr, kAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<SparseMFMAOp::Properties>().m = mAttr;
|
|
result.getOrAddProperties<SparseMFMAOp::Properties>().n = nAttr;
|
|
result.getOrAddProperties<SparseMFMAOp::Properties>().k = kAttr;
|
|
}
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
destCOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(destCRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("sparse"))
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
sparseIdxOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sparseIdxRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sparseIdxRawType = type;
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
destCRawType = type;
|
|
}
|
|
result.addTypes(destCTypes[0]);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sparseIdxOperands, sparseIdxTypes, sparseIdxOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SparseMFMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
printMNKDimensionList(_odsPrinter, *this, getMAttr(), getNAttr(), getKAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceB();
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestC();
|
|
_odsPrinter << ' ' << "sparse";
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getSparseIdx();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSparseIdx().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ")";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("m");
|
|
elidedAttrs.push_back("n");
|
|
elidedAttrs.push_back("k");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getCbszAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0)))
|
|
elidedAttrs.push_back("cbsz");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getAbidAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0)))
|
|
elidedAttrs.push_back("abid");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDestC().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SparseMFMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::SparseMFMAOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::SparseMFMAOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::SparseWMMAOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SparseWMMAOpGenericAdaptorBase::SparseWMMAOpGenericAdaptorBase(SparseWMMAOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t SparseWMMAOpGenericAdaptorBase::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseWMMAOpGenericAdaptorBase::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseWMMAOpGenericAdaptorBase::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::UnitAttr SparseWMMAOpGenericAdaptorBase::getUnsignedAAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedA);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool SparseWMMAOpGenericAdaptorBase::getUnsignedA() {
|
|
auto attr = getUnsignedAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr SparseWMMAOpGenericAdaptorBase::getUnsignedBAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedB);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool SparseWMMAOpGenericAdaptorBase::getUnsignedB() {
|
|
auto attr = getUnsignedBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr SparseWMMAOpGenericAdaptorBase::getReuseAAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().reuseA);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool SparseWMMAOpGenericAdaptorBase::getReuseA() {
|
|
auto attr = getReuseAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr SparseWMMAOpGenericAdaptorBase::getReuseBAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().reuseB);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool SparseWMMAOpGenericAdaptorBase::getReuseB() {
|
|
auto attr = getReuseBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr SparseWMMAOpGenericAdaptorBase::getClampAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().clamp);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool SparseWMMAOpGenericAdaptorBase::getClamp() {
|
|
auto attr = getClampAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr SparseWMMAOpGenericAdaptorBase::getWave64Attr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().wave64);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool SparseWMMAOpGenericAdaptorBase::getWave64() {
|
|
auto attr = getWave64Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
SparseWMMAOpAdaptor::SparseWMMAOpAdaptor(SparseWMMAOp op) : SparseWMMAOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SparseWMMAOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitError(loc, "'amdgpu.sparse_wmma' op requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitError(loc, "'amdgpu.sparse_wmma' op requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitError(loc, "'amdgpu.sparse_wmma' op requires attribute 'n'");
|
|
auto tblgen_reuseA = getProperties().reuseA; (void)tblgen_reuseA;
|
|
auto tblgen_reuseB = getProperties().reuseB; (void)tblgen_reuseB;
|
|
auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA;
|
|
auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB;
|
|
auto tblgen_wave64 = getProperties().wave64; (void)tblgen_wave64;
|
|
|
|
if (tblgen_m && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getInt())))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16}");
|
|
|
|
if (tblgen_n && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getInt())))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16}");
|
|
|
|
if (tblgen_k && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getInt())))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {32, 64, 128}");
|
|
|
|
if (tblgen_unsignedA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedA))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'unsignedA' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_unsignedB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedB))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'unsignedB' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_reuseA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_reuseA))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'reuseA' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_reuseB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_reuseB))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'reuseB' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_clamp && !((::llvm::isa<::mlir::UnitAttr>(tblgen_clamp))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'clamp' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_wave64 && !((::llvm::isa<::mlir::UnitAttr>(tblgen_wave64))))
|
|
return emitError(loc, "'amdgpu.sparse_wmma' op attribute 'wave64' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseWMMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.clamp;
|
|
auto attr = dict.get("clamp");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `clamp` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.k;
|
|
auto attr = dict.get("k");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `k` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.m;
|
|
auto attr = dict.get("m");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `m` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.n;
|
|
auto attr = dict.get("n");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `n` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.reuseA;
|
|
auto attr = dict.get("reuseA");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `reuseA` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.reuseB;
|
|
auto attr = dict.get("reuseB");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `reuseB` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unsignedA;
|
|
auto attr = dict.get("unsignedA");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unsignedA` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unsignedB;
|
|
auto attr = dict.get("unsignedB");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unsignedB` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.wave64;
|
|
auto attr = dict.get("wave64");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `wave64` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SparseWMMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.clamp;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("clamp",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.k;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("k",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.m;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("m",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.n;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("n",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.reuseA;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("reuseA",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.reuseB;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("reuseB",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unsignedA;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unsignedA",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unsignedB;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unsignedB",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.wave64;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("wave64",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SparseWMMAOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.clamp.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.k.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.m.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.n.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.reuseA.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.reuseB.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unsignedA.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unsignedB.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.wave64.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SparseWMMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "clamp")
|
|
return prop.clamp;
|
|
|
|
if (name == "k")
|
|
return prop.k;
|
|
|
|
if (name == "m")
|
|
return prop.m;
|
|
|
|
if (name == "n")
|
|
return prop.n;
|
|
|
|
if (name == "reuseA")
|
|
return prop.reuseA;
|
|
|
|
if (name == "reuseB")
|
|
return prop.reuseB;
|
|
|
|
if (name == "unsignedA")
|
|
return prop.unsignedA;
|
|
|
|
if (name == "unsignedB")
|
|
return prop.unsignedB;
|
|
|
|
if (name == "wave64")
|
|
return prop.wave64;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SparseWMMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "clamp") {
|
|
prop.clamp = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.clamp)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "k") {
|
|
prop.k = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.k)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "m") {
|
|
prop.m = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.m)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "n") {
|
|
prop.n = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.n)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "reuseA") {
|
|
prop.reuseA = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.reuseA)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "reuseB") {
|
|
prop.reuseB = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.reuseB)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unsignedA") {
|
|
prop.unsignedA = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unsignedA)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unsignedB") {
|
|
prop.unsignedB = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unsignedB)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "wave64") {
|
|
prop.wave64 = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.wave64)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SparseWMMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.clamp) attrs.append("clamp", prop.clamp);
|
|
|
|
if (prop.k) attrs.append("k", prop.k);
|
|
|
|
if (prop.m) attrs.append("m", prop.m);
|
|
|
|
if (prop.n) attrs.append("n", prop.n);
|
|
|
|
if (prop.reuseA) attrs.append("reuseA", prop.reuseA);
|
|
|
|
if (prop.reuseB) attrs.append("reuseB", prop.reuseB);
|
|
|
|
if (prop.unsignedA) attrs.append("unsignedA", prop.unsignedA);
|
|
|
|
if (prop.unsignedB) attrs.append("unsignedB", prop.unsignedB);
|
|
|
|
if (prop.wave64) attrs.append("wave64", prop.wave64);
|
|
}
|
|
|
|
::llvm::LogicalResult SparseWMMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getClampAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "clamp", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getKAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU25(attr, "k", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(attr, "m", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(attr, "n", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getReuseAAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "reuseA", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getReuseBAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "reuseB", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnsignedAAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "unsignedA", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnsignedBAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "unsignedB", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getWave64AttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "wave64", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseWMMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.clamp)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.k)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.m)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.n)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.reuseA)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.reuseB)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedA)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedB)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.wave64)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SparseWMMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.clamp);
|
|
writer.writeAttribute(prop.k);
|
|
writer.writeAttribute(prop.m);
|
|
writer.writeAttribute(prop.n);
|
|
|
|
writer.writeOptionalAttribute(prop.reuseA);
|
|
|
|
writer.writeOptionalAttribute(prop.reuseB);
|
|
|
|
writer.writeOptionalAttribute(prop.unsignedA);
|
|
|
|
writer.writeOptionalAttribute(prop.unsignedB);
|
|
|
|
writer.writeOptionalAttribute(prop.wave64);
|
|
}
|
|
|
|
uint32_t SparseWMMAOp::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseWMMAOp::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SparseWMMAOp::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
bool SparseWMMAOp::getUnsignedA() {
|
|
auto attr = getUnsignedAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool SparseWMMAOp::getUnsignedB() {
|
|
auto attr = getUnsignedBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool SparseWMMAOp::getReuseA() {
|
|
auto attr = getReuseAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool SparseWMMAOp::getReuseB() {
|
|
auto attr = getReuseBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool SparseWMMAOp::getClamp() {
|
|
auto attr = getClampAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool SparseWMMAOp::getWave64() {
|
|
auto attr = getWave64Attr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void SparseWMMAOp::setM(uint32_t attrValue) {
|
|
getProperties().m = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseWMMAOp::setN(uint32_t attrValue) {
|
|
getProperties().n = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseWMMAOp::setK(uint32_t attrValue) {
|
|
getProperties().k = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SparseWMMAOp::setUnsignedA(bool attrValue) {
|
|
auto &odsProp = getProperties().unsignedA;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void SparseWMMAOp::setUnsignedB(bool attrValue) {
|
|
auto &odsProp = getProperties().unsignedB;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void SparseWMMAOp::setReuseA(bool attrValue) {
|
|
auto &odsProp = getProperties().reuseA;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void SparseWMMAOp::setReuseB(bool attrValue) {
|
|
auto &odsProp = getProperties().reuseB;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void SparseWMMAOp::setClamp(bool attrValue) {
|
|
auto &odsProp = getProperties().clamp;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void SparseWMMAOp::setWave64(bool attrValue) {
|
|
auto &odsProp = getProperties().wave64;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (reuseA) {
|
|
odsState.getOrAddProperties<Properties>().reuseA = reuseA;
|
|
}
|
|
if (reuseB) {
|
|
odsState.getOrAddProperties<Properties>().reuseB = reuseB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
if (wave64) {
|
|
odsState.getOrAddProperties<Properties>().wave64 = wave64;
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (reuseA) {
|
|
odsState.getOrAddProperties<Properties>().reuseA = reuseA;
|
|
}
|
|
if (reuseB) {
|
|
odsState.getOrAddProperties<Properties>().reuseB = reuseB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
if (wave64) {
|
|
odsState.getOrAddProperties<Properties>().wave64 = wave64;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (reuseA) {
|
|
odsState.getOrAddProperties<Properties>().reuseA = reuseA;
|
|
}
|
|
if (reuseB) {
|
|
odsState.getOrAddProperties<Properties>().reuseB = reuseB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
if (wave64) {
|
|
odsState.getOrAddProperties<Properties>().wave64 = wave64;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr reuseA, /*optional*/::mlir::UnitAttr reuseB, /*optional*/::mlir::UnitAttr clamp, /*optional*/::mlir::UnitAttr wave64) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (reuseA) {
|
|
odsState.getOrAddProperties<Properties>().reuseA = ((reuseA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (reuseB) {
|
|
odsState.getOrAddProperties<Properties>().reuseB = ((reuseB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (wave64) {
|
|
odsState.getOrAddProperties<Properties>().wave64 = ((wave64) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (reuseA) {
|
|
odsState.getOrAddProperties<Properties>().reuseA = ((reuseA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (reuseB) {
|
|
odsState.getOrAddProperties<Properties>().reuseB = ((reuseB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (wave64) {
|
|
odsState.getOrAddProperties<Properties>().wave64 = ((wave64) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.addOperands(sparseIdx);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (reuseA) {
|
|
odsState.getOrAddProperties<Properties>().reuseA = ((reuseA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (reuseB) {
|
|
odsState.getOrAddProperties<Properties>().reuseB = ((reuseB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (wave64) {
|
|
odsState.getOrAddProperties<Properties>().wave64 = ((wave64) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::Value sparseIdx, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool reuseA, /*optional*/bool reuseB, /*optional*/bool clamp, /*optional*/bool wave64) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(sparseIdx)>(sparseIdx), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(reuseA)>(reuseA), std::forward<decltype(reuseB)>(reuseB), std::forward<decltype(clamp)>(clamp), std::forward<decltype(wave64)>(wave64));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SparseWMMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SparseWMMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SparseWMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 4u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SparseWMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SparseWMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SparseWMMAOp SparseWMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SparseWMMAOp::verifyInvariantsImpl() {
|
|
auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitOpError("requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitOpError("requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitOpError("requires attribute 'n'");
|
|
auto tblgen_reuseA = getProperties().reuseA; (void)tblgen_reuseA;
|
|
auto tblgen_reuseB = getProperties().reuseB; (void)tblgen_reuseB;
|
|
auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA;
|
|
auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB;
|
|
auto tblgen_wave64 = getProperties().wave64; (void)tblgen_wave64;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(*this, tblgen_m, "m")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(*this, tblgen_n, "n")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU25(*this, tblgen_k, "k")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_unsignedA, "unsignedA")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_unsignedB, "unsignedB")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_reuseA, "reuseA")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_reuseB, "reuseB")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_clamp, "clamp")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_wave64, "wave64")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU48(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU49(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU50(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup3 = getODSOperands(3);
|
|
|
|
for (auto v : valueGroup3) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU51(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU50(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {destC, destD} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseWMMAOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult SparseWMMAOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult SparseWMMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::IntegerAttr mAttr;
|
|
::mlir::IntegerAttr nAttr;
|
|
::mlir::IntegerAttr kAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(&sourceBRawOperand, 1); ::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand destCRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(&destCRawOperand, 1); ::llvm::SMLoc destCOperandsLoc;
|
|
(void)destCOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sparseIdxRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sparseIdxOperands(&sparseIdxRawOperand, 1); ::llvm::SMLoc sparseIdxOperandsLoc;
|
|
(void)sparseIdxOperandsLoc;
|
|
::mlir::Type sparseIdxRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sparseIdxTypes(&sparseIdxRawType, 1);
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type sourceBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceBTypes(&sourceBRawType, 1);
|
|
::mlir::Type destCRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> destCTypes(&destCRawType, 1);
|
|
{
|
|
auto odsResult = parseMNKDimensionList(parser, mAttr, nAttr, kAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<SparseWMMAOp::Properties>().m = mAttr;
|
|
result.getOrAddProperties<SparseWMMAOp::Properties>().n = nAttr;
|
|
result.getOrAddProperties<SparseWMMAOp::Properties>().k = kAttr;
|
|
}
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
destCOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(destCRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseKeyword("sparse"))
|
|
return ::mlir::failure();
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
sparseIdxOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sparseIdxRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sparseIdxRawType = type;
|
|
}
|
|
if (parser.parseRParen())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
destCRawType = type;
|
|
}
|
|
result.addTypes(destCTypes[0]);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sparseIdxOperands, sparseIdxTypes, sparseIdxOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SparseWMMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
printMNKDimensionList(_odsPrinter, *this, getMAttr(), getNAttr(), getKAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceB();
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestC();
|
|
_odsPrinter << ' ' << "sparse";
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getSparseIdx();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSparseIdx().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ")";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("m");
|
|
elidedAttrs.push_back("n");
|
|
elidedAttrs.push_back("k");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getUnsignedAAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("unsignedA");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getUnsignedBAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("unsignedB");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getReuseAAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("reuseA");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getReuseBAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("reuseB");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getClampAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("clamp");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getWave64Attr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("wave64");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDestC().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SparseWMMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::SparseWMMAOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::SparseWMMAOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::SwizzleBitModeOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
SwizzleBitModeOpGenericAdaptorBase::SwizzleBitModeOpGenericAdaptorBase(SwizzleBitModeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t SwizzleBitModeOpGenericAdaptorBase::getAndMask() {
|
|
auto attr = getAndMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SwizzleBitModeOpGenericAdaptorBase::getOrMask() {
|
|
auto attr = getOrMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SwizzleBitModeOpGenericAdaptorBase::getXorMask() {
|
|
auto attr = getXorMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
SwizzleBitModeOpAdaptor::SwizzleBitModeOpAdaptor(SwizzleBitModeOp op) : SwizzleBitModeOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult SwizzleBitModeOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_and_mask = getProperties().and_mask; (void)tblgen_and_mask;
|
|
if (!tblgen_and_mask) return emitError(loc, "'amdgpu.swizzle_bitmode' op requires attribute 'and_mask'");
|
|
auto tblgen_or_mask = getProperties().or_mask; (void)tblgen_or_mask;
|
|
if (!tblgen_or_mask) return emitError(loc, "'amdgpu.swizzle_bitmode' op requires attribute 'or_mask'");
|
|
auto tblgen_xor_mask = getProperties().xor_mask; (void)tblgen_xor_mask;
|
|
if (!tblgen_xor_mask) return emitError(loc, "'amdgpu.swizzle_bitmode' op requires attribute 'xor_mask'");
|
|
|
|
if (tblgen_and_mask && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_and_mask))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_and_mask).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.swizzle_bitmode' op attribute 'and_mask' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_or_mask && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_or_mask))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_or_mask).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.swizzle_bitmode' op attribute 'or_mask' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
|
|
if (tblgen_xor_mask && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_xor_mask))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_xor_mask).getType().isSignlessInteger(32)))))
|
|
return emitError(loc, "'amdgpu.swizzle_bitmode' op attribute 'xor_mask' failed to satisfy constraint: 32-bit signless integer attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SwizzleBitModeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.and_mask;
|
|
auto attr = dict.get("and_mask");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `and_mask` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.or_mask;
|
|
auto attr = dict.get("or_mask");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `or_mask` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.xor_mask;
|
|
auto attr = dict.get("xor_mask");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `xor_mask` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute SwizzleBitModeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.and_mask;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("and_mask",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.or_mask;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("or_mask",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.xor_mask;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("xor_mask",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code SwizzleBitModeOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.and_mask.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.or_mask.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.xor_mask.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> SwizzleBitModeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "and_mask")
|
|
return prop.and_mask;
|
|
|
|
if (name == "or_mask")
|
|
return prop.or_mask;
|
|
|
|
if (name == "xor_mask")
|
|
return prop.xor_mask;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SwizzleBitModeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "and_mask") {
|
|
prop.and_mask = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.and_mask)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "or_mask") {
|
|
prop.or_mask = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.or_mask)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "xor_mask") {
|
|
prop.xor_mask = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.xor_mask)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SwizzleBitModeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.and_mask) attrs.append("and_mask", prop.and_mask);
|
|
|
|
if (prop.or_mask) attrs.append("or_mask", prop.or_mask);
|
|
|
|
if (prop.xor_mask) attrs.append("xor_mask", prop.xor_mask);
|
|
}
|
|
|
|
::llvm::LogicalResult SwizzleBitModeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getAndMaskAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "and_mask", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getOrMaskAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "or_mask", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getXorMaskAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(attr, "xor_mask", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SwizzleBitModeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.and_mask)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.or_mask)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.xor_mask)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SwizzleBitModeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.and_mask);
|
|
writer.writeAttribute(prop.or_mask);
|
|
writer.writeAttribute(prop.xor_mask);
|
|
}
|
|
|
|
uint32_t SwizzleBitModeOp::getAndMask() {
|
|
auto attr = getAndMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SwizzleBitModeOp::getOrMask() {
|
|
auto attr = getOrMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t SwizzleBitModeOp::getXorMask() {
|
|
auto attr = getXorMaskAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
void SwizzleBitModeOp::setAndMask(uint32_t attrValue) {
|
|
getProperties().and_mask = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SwizzleBitModeOp::setOrMask(uint32_t attrValue) {
|
|
getProperties().or_mask = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SwizzleBitModeOp::setXorMask(uint32_t attrValue) {
|
|
getProperties().xor_mask = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().and_mask = and_mask;
|
|
odsState.getOrAddProperties<Properties>().or_mask = or_mask;
|
|
odsState.getOrAddProperties<Properties>().xor_mask = xor_mask;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().and_mask = and_mask;
|
|
odsState.getOrAddProperties<Properties>().or_mask = or_mask;
|
|
odsState.getOrAddProperties<Properties>().xor_mask = xor_mask;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SwizzleBitModeOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().and_mask = and_mask;
|
|
odsState.getOrAddProperties<Properties>().or_mask = or_mask;
|
|
odsState.getOrAddProperties<Properties>().xor_mask = xor_mask;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::IntegerAttr and_mask, ::mlir::IntegerAttr or_mask, ::mlir::IntegerAttr xor_mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().and_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), and_mask);
|
|
odsState.getOrAddProperties<Properties>().or_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), or_mask);
|
|
odsState.getOrAddProperties<Properties>().xor_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), xor_mask);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().and_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), and_mask);
|
|
odsState.getOrAddProperties<Properties>().or_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), or_mask);
|
|
odsState.getOrAddProperties<Properties>().xor_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), xor_mask);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SwizzleBitModeOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
odsState.addOperands(src);
|
|
odsState.getOrAddProperties<Properties>().and_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), and_mask);
|
|
odsState.getOrAddProperties<Properties>().or_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), or_mask);
|
|
odsState.getOrAddProperties<Properties>().xor_mask = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), xor_mask);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, uint32_t and_mask, uint32_t or_mask, uint32_t xor_mask) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(and_mask)>(and_mask), std::forward<decltype(or_mask)>(or_mask), std::forward<decltype(xor_mask)>(xor_mask));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SwizzleBitModeOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<SwizzleBitModeOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SwizzleBitModeOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void SwizzleBitModeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(SwizzleBitModeOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<SwizzleBitModeOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
SwizzleBitModeOp SwizzleBitModeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult SwizzleBitModeOp::verifyInvariantsImpl() {
|
|
auto tblgen_and_mask = getProperties().and_mask; (void)tblgen_and_mask;
|
|
if (!tblgen_and_mask) return emitOpError("requires attribute 'and_mask'");
|
|
auto tblgen_or_mask = getProperties().or_mask; (void)tblgen_or_mask;
|
|
if (!tblgen_or_mask) return emitOpError("requires attribute 'or_mask'");
|
|
auto tblgen_xor_mask = getProperties().xor_mask; (void)tblgen_xor_mask;
|
|
if (!tblgen_xor_mask) return emitOpError("requires attribute 'xor_mask'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_and_mask, "and_mask")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_or_mask, "or_mask")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU3(*this, tblgen_xor_mask, "xor_mask")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU29(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU29(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()) && ((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {result, src} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult SwizzleBitModeOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult SwizzleBitModeOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult SwizzleBitModeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::mlir::IntegerAttr and_maskAttr;
|
|
::mlir::IntegerAttr or_maskAttr;
|
|
::mlir::IntegerAttr xor_maskAttr;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(and_maskAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (and_maskAttr) result.getOrAddProperties<SwizzleBitModeOp::Properties>().and_mask = and_maskAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(or_maskAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (or_maskAttr) result.getOrAddProperties<SwizzleBitModeOp::Properties>().or_mask = or_maskAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(xor_maskAttr, parser.getBuilder().getIntegerType(32))) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (xor_maskAttr) result.getOrAddProperties<SwizzleBitModeOp::Properties>().xor_mask = xor_maskAttr;
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(srcOperands, resultTypes[0], srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void SwizzleBitModeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getAndMaskAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getOrMaskAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getXorMaskAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("and_mask");
|
|
elidedAttrs.push_back("or_mask");
|
|
elidedAttrs.push_back("xor_mask");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void SwizzleBitModeOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::SwizzleBitModeOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::SwizzleBitModeOpGenericAdaptorBase::Properties)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::TensorLoadToLDSOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
TensorLoadToLDSOpGenericAdaptorBase::TensorLoadToLDSOpGenericAdaptorBase(TensorLoadToLDSOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
TensorLoadToLDSOpAdaptor::TensorLoadToLDSOpAdaptor(TensorLoadToLDSOp op) : TensorLoadToLDSOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult TensorLoadToLDSOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TensorLoadToLDSOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute TensorLoadToLDSOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code TensorLoadToLDSOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> TensorLoadToLDSOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void TensorLoadToLDSOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void TensorLoadToLDSOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult TensorLoadToLDSOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TensorLoadToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value desc) {
|
|
odsState.addOperands(desc);
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value desc) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(desc)>(desc));
|
|
auto __res__ = ::llvm::dyn_cast<TensorLoadToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value desc) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(desc)>(desc));
|
|
}
|
|
|
|
void TensorLoadToLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value desc) {
|
|
odsState.addOperands(desc);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value desc) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(desc)>(desc));
|
|
auto __res__ = ::llvm::dyn_cast<TensorLoadToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value desc) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(desc)>(desc));
|
|
}
|
|
|
|
void TensorLoadToLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<TensorLoadToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void TensorLoadToLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<TensorLoadToLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorLoadToLDSOp TensorLoadToLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult TensorLoadToLDSOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU22(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TensorLoadToLDSOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult TensorLoadToLDSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand descRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descOperands(&descRawOperand, 1); ::llvm::SMLoc descOperandsLoc;
|
|
(void)descOperandsLoc;
|
|
::mlir::Type descRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> descTypes(&descRawType, 1);
|
|
|
|
descOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(descRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(descRawType))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(descOperands, descTypes, descOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TensorLoadToLDSOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDesc();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDesc().getType();
|
|
}
|
|
|
|
void TensorLoadToLDSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::TensorLoadToLDSOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::TensorStoreFromLDSOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
TensorStoreFromLDSOpGenericAdaptorBase::TensorStoreFromLDSOpGenericAdaptorBase(TensorStoreFromLDSOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
TensorStoreFromLDSOpAdaptor::TensorStoreFromLDSOpAdaptor(TensorStoreFromLDSOp op) : TensorStoreFromLDSOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult TensorStoreFromLDSOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TensorStoreFromLDSOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute TensorStoreFromLDSOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code TensorStoreFromLDSOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> TensorStoreFromLDSOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult TensorStoreFromLDSOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value desc) {
|
|
odsState.addOperands(desc);
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value desc) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(desc)>(desc));
|
|
auto __res__ = ::llvm::dyn_cast<TensorStoreFromLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value desc) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(desc)>(desc));
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value desc) {
|
|
odsState.addOperands(desc);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value desc) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(desc)>(desc));
|
|
auto __res__ = ::llvm::dyn_cast<TensorStoreFromLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value desc) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(desc)>(desc));
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<TensorStoreFromLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<TensorStoreFromLDSOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TensorStoreFromLDSOp TensorStoreFromLDSOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult TensorStoreFromLDSOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU22(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TensorStoreFromLDSOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult TensorStoreFromLDSOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand descRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> descOperands(&descRawOperand, 1); ::llvm::SMLoc descOperandsLoc;
|
|
(void)descOperandsLoc;
|
|
::mlir::Type descRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> descTypes(&descRawType, 1);
|
|
|
|
descOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(descRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseType(descRawType))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(descOperands, descTypes, descOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDesc();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDesc().getType();
|
|
}
|
|
|
|
void TensorStoreFromLDSOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::TensorStoreFromLDSOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::TransposeLoadOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
TransposeLoadOpGenericAdaptorBase::TransposeLoadOpGenericAdaptorBase(TransposeLoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> TransposeLoadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (odsOperandsSize - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
TransposeLoadOpAdaptor::TransposeLoadOpAdaptor(TransposeLoadOp op) : TransposeLoadOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult TransposeLoadOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> TransposeLoadOp::getODSOperandIndexAndLength(unsigned index) {
|
|
bool isVariadic[] = {false, true};
|
|
int prevVariadicCount = 0;
|
|
for (unsigned i = 0; i < index; ++i)
|
|
if (isVariadic[i]) ++prevVariadicCount;
|
|
|
|
// Calculate how many dynamic values a static variadic operand corresponds to.
|
|
// This assumes all static variadic operands have the same dynamic value count.
|
|
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
|
|
// `index` passed in as the parameter is the static index which counts each
|
|
// operand (variadic or not) as size 1. So here for each previous static variadic
|
|
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
|
|
// value pack for this static operand starts.
|
|
int start = index + (variadicSize - 1) * prevVariadicCount;
|
|
int size = isVariadic[index] ? variadicSize : 1;
|
|
return {start, size};
|
|
}
|
|
|
|
::mlir::MutableOperandRange TransposeLoadOp::getSrcIndicesMutable() {
|
|
auto range = getODSOperandIndexAndLength(1);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult TransposeLoadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute TransposeLoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code TransposeLoadOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> TransposeLoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void TransposeLoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void TransposeLoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult TransposeLoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TransposeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
auto __res__ = ::llvm::dyn_cast<TransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
}
|
|
|
|
void TransposeLoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
odsState.addOperands(src);
|
|
odsState.addOperands(srcIndices);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
auto __res__ = ::llvm::dyn_cast<TransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value src, ::mlir::ValueRange srcIndices) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(src)>(src), std::forward<decltype(srcIndices)>(srcIndices));
|
|
}
|
|
|
|
void TransposeLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<TransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void TransposeLoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() >= 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<TransposeLoadOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
TransposeLoadOp TransposeLoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult TransposeLoadOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU6(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU52(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult TransposeLoadOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult TransposeLoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand srcRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> srcOperands(&srcRawOperand, 1); ::llvm::SMLoc srcOperandsLoc;
|
|
(void)srcOperandsLoc;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> srcIndicesOperands;
|
|
::llvm::SMLoc srcIndicesOperandsLoc;
|
|
(void)srcIndicesOperandsLoc;
|
|
::mlir::Type srcRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> srcTypes(&srcRawType, 1);
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
srcOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(srcRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
srcIndicesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(srcIndicesOperands))
|
|
return ::mlir::failure();
|
|
if (parser.parseRSquare())
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::MemRefType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
srcRawType = type;
|
|
}
|
|
if (parser.parseArrow())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(srcOperands, srcTypes, srcOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(srcIndicesOperands, odsBuildableType0, srcIndicesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void TransposeLoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSrc();
|
|
_odsPrinter << "[";
|
|
_odsPrinter << getSrcIndices();
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSrc().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::MemRefType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ' ' << "->";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void TransposeLoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
{
|
|
auto valueRange = getODSOperandIndexAndLength(0);
|
|
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
|
|
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::TransposeLoadOp)
|
|
|
|
namespace mlir::amdgpu {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::mlir::amdgpu::WMMAOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
WMMAOpGenericAdaptorBase::WMMAOpGenericAdaptorBase(WMMAOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
uint32_t WMMAOpGenericAdaptorBase::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t WMMAOpGenericAdaptorBase::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t WMMAOpGenericAdaptorBase::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::IntegerAttr WMMAOpGenericAdaptorBase::getSubwordOffsetAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().subwordOffset);
|
|
return attr;
|
|
}
|
|
|
|
uint32_t WMMAOpGenericAdaptorBase::getSubwordOffset() {
|
|
auto attr = getSubwordOffsetAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
::mlir::UnitAttr WMMAOpGenericAdaptorBase::getUnsignedAAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedA);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool WMMAOpGenericAdaptorBase::getUnsignedA() {
|
|
auto attr = getUnsignedAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr WMMAOpGenericAdaptorBase::getUnsignedBAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().unsignedB);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool WMMAOpGenericAdaptorBase::getUnsignedB() {
|
|
auto attr = getUnsignedBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
::mlir::UnitAttr WMMAOpGenericAdaptorBase::getClampAttr() {
|
|
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().clamp);
|
|
if (!attr)
|
|
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
|
|
return attr;
|
|
}
|
|
|
|
bool WMMAOpGenericAdaptorBase::getClamp() {
|
|
auto attr = getClampAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
WMMAOpAdaptor::WMMAOpAdaptor(WMMAOp op) : WMMAOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult WMMAOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitError(loc, "'amdgpu.wmma' op requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitError(loc, "'amdgpu.wmma' op requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitError(loc, "'amdgpu.wmma' op requires attribute 'n'");
|
|
auto tblgen_subwordOffset = getProperties().subwordOffset; (void)tblgen_subwordOffset;
|
|
auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA;
|
|
auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB;
|
|
|
|
if (tblgen_m && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_m))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_m).getInt())))))
|
|
return emitError(loc, "'amdgpu.wmma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16}");
|
|
|
|
if (tblgen_n && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_n))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({16}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_n).getInt())))))
|
|
return emitError(loc, "'amdgpu.wmma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16}");
|
|
|
|
if (tblgen_k && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_k))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({4, 16, 32, 64, 128}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_k).getInt())))))
|
|
return emitError(loc, "'amdgpu.wmma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {4, 16, 32, 64, 128}");
|
|
|
|
if (tblgen_subwordOffset && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_subwordOffset))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_subwordOffset).getType().isSignlessInteger(32)))) && ((::llvm::is_contained({0, 1}, ::llvm::cast<::mlir::IntegerAttr>(tblgen_subwordOffset).getInt())))))
|
|
return emitError(loc, "'amdgpu.wmma' op attribute 'subwordOffset' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {0, 1}");
|
|
|
|
if (tblgen_unsignedA && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedA))))
|
|
return emitError(loc, "'amdgpu.wmma' op attribute 'unsignedA' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_unsignedB && !((::llvm::isa<::mlir::UnitAttr>(tblgen_unsignedB))))
|
|
return emitError(loc, "'amdgpu.wmma' op attribute 'unsignedB' failed to satisfy constraint: unit attribute");
|
|
|
|
if (tblgen_clamp && !((::llvm::isa<::mlir::UnitAttr>(tblgen_clamp))))
|
|
return emitError(loc, "'amdgpu.wmma' op attribute 'clamp' failed to satisfy constraint: unit attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult WMMAOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
|
|
if (!dict) {
|
|
emitError() << "expected DictionaryAttr to set properties";
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.clamp;
|
|
auto attr = dict.get("clamp");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `clamp` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.k;
|
|
auto attr = dict.get("k");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `k` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.m;
|
|
auto attr = dict.get("m");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `m` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.n;
|
|
auto attr = dict.get("n");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `n` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.subwordOffset;
|
|
auto attr = dict.get("subwordOffset");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `subwordOffset` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unsignedA;
|
|
auto attr = dict.get("unsignedA");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unsignedA` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.unsignedB;
|
|
auto attr = dict.get("unsignedB");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `unsignedB` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute WMMAOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.clamp;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("clamp",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.k;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("k",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.m;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("m",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.n;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("n",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.subwordOffset;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("subwordOffset",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unsignedA;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unsignedA",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.unsignedB;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("unsignedB",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code WMMAOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.clamp.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.k.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.m.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.n.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.subwordOffset.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unsignedA.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.unsignedB.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> WMMAOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "clamp")
|
|
return prop.clamp;
|
|
|
|
if (name == "k")
|
|
return prop.k;
|
|
|
|
if (name == "m")
|
|
return prop.m;
|
|
|
|
if (name == "n")
|
|
return prop.n;
|
|
|
|
if (name == "subwordOffset")
|
|
return prop.subwordOffset;
|
|
|
|
if (name == "unsignedA")
|
|
return prop.unsignedA;
|
|
|
|
if (name == "unsignedB")
|
|
return prop.unsignedB;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void WMMAOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "clamp") {
|
|
prop.clamp = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.clamp)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "k") {
|
|
prop.k = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.k)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "m") {
|
|
prop.m = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.m)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "n") {
|
|
prop.n = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.n)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "subwordOffset") {
|
|
prop.subwordOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.subwordOffset)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unsignedA") {
|
|
prop.unsignedA = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unsignedA)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "unsignedB") {
|
|
prop.unsignedB = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.unsignedB)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void WMMAOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.clamp) attrs.append("clamp", prop.clamp);
|
|
|
|
if (prop.k) attrs.append("k", prop.k);
|
|
|
|
if (prop.m) attrs.append("m", prop.m);
|
|
|
|
if (prop.n) attrs.append("n", prop.n);
|
|
|
|
if (prop.subwordOffset) attrs.append("subwordOffset", prop.subwordOffset);
|
|
|
|
if (prop.unsignedA) attrs.append("unsignedA", prop.unsignedA);
|
|
|
|
if (prop.unsignedB) attrs.append("unsignedB", prop.unsignedB);
|
|
}
|
|
|
|
::llvm::LogicalResult WMMAOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getClampAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "clamp", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getKAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU26(attr, "k", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(attr, "m", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getNAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(attr, "n", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSubwordOffsetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU27(attr, "subwordOffset", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnsignedAAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "unsignedA", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getUnsignedBAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(attr, "unsignedB", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult WMMAOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.clamp)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.k)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.m)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.n)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.subwordOffset)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedA)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.unsignedB)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void WMMAOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.clamp);
|
|
writer.writeAttribute(prop.k);
|
|
writer.writeAttribute(prop.m);
|
|
writer.writeAttribute(prop.n);
|
|
|
|
writer.writeOptionalAttribute(prop.subwordOffset);
|
|
|
|
writer.writeOptionalAttribute(prop.unsignedA);
|
|
|
|
writer.writeOptionalAttribute(prop.unsignedB);
|
|
}
|
|
|
|
uint32_t WMMAOp::getM() {
|
|
auto attr = getMAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t WMMAOp::getN() {
|
|
auto attr = getNAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t WMMAOp::getK() {
|
|
auto attr = getKAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
uint32_t WMMAOp::getSubwordOffset() {
|
|
auto attr = getSubwordOffsetAttr();
|
|
return attr.getValue().getZExtValue();
|
|
}
|
|
|
|
bool WMMAOp::getUnsignedA() {
|
|
auto attr = getUnsignedAAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool WMMAOp::getUnsignedB() {
|
|
auto attr = getUnsignedBAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
bool WMMAOp::getClamp() {
|
|
auto attr = getClampAttr();
|
|
if (!attr)
|
|
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
|
|
return attr != nullptr;
|
|
}
|
|
|
|
void WMMAOp::setM(uint32_t attrValue) {
|
|
getProperties().m = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void WMMAOp::setN(uint32_t attrValue) {
|
|
getProperties().n = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void WMMAOp::setK(uint32_t attrValue) {
|
|
getProperties().k = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void WMMAOp::setSubwordOffset(uint32_t attrValue) {
|
|
getProperties().subwordOffset = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
|
|
}
|
|
|
|
void WMMAOp::setUnsignedA(bool attrValue) {
|
|
auto &odsProp = getProperties().unsignedA;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void WMMAOp::setUnsignedB(bool attrValue) {
|
|
auto &odsProp = getProperties().unsignedB;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void WMMAOp::setClamp(bool attrValue) {
|
|
auto &odsProp = getProperties().clamp;
|
|
if (attrValue)
|
|
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
|
|
else
|
|
odsProp = nullptr;
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (subwordOffset) {
|
|
odsState.getOrAddProperties<Properties>().subwordOffset = subwordOffset;
|
|
}
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (subwordOffset) {
|
|
odsState.getOrAddProperties<Properties>().subwordOffset = subwordOffset;
|
|
}
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(WMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = m;
|
|
odsState.getOrAddProperties<Properties>().n = n;
|
|
odsState.getOrAddProperties<Properties>().k = k;
|
|
if (subwordOffset) {
|
|
odsState.getOrAddProperties<Properties>().subwordOffset = subwordOffset;
|
|
}
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = unsignedA;
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = unsignedB;
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = clamp;
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr m, ::mlir::IntegerAttr n, ::mlir::IntegerAttr k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, ::mlir::IntegerAttr subwordOffset, /*optional*/::mlir::UnitAttr unsignedA, /*optional*/::mlir::UnitAttr unsignedB, /*optional*/::mlir::UnitAttr clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().subwordOffset = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), subwordOffset);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
odsState.addTypes(destD);
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type destD, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(destD)>(destD), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().subwordOffset = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), subwordOffset);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(WMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
odsState.addOperands(sourceA);
|
|
odsState.addOperands(sourceB);
|
|
odsState.addOperands(destC);
|
|
odsState.getOrAddProperties<Properties>().m = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), m);
|
|
odsState.getOrAddProperties<Properties>().n = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), n);
|
|
odsState.getOrAddProperties<Properties>().k = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), k);
|
|
odsState.getOrAddProperties<Properties>().subwordOffset = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), subwordOffset);
|
|
if (unsignedA) {
|
|
odsState.getOrAddProperties<Properties>().unsignedA = ((unsignedA) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (unsignedB) {
|
|
odsState.getOrAddProperties<Properties>().unsignedB = ((unsignedB) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
if (clamp) {
|
|
odsState.getOrAddProperties<Properties>().clamp = ((clamp) ? odsBuilder.getUnitAttr() : nullptr);
|
|
}
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, uint32_t m, uint32_t n, uint32_t k, ::mlir::Value sourceA, ::mlir::Value sourceB, ::mlir::Value destC, uint32_t subwordOffset, /*optional*/bool unsignedA, /*optional*/bool unsignedB, /*optional*/bool clamp) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(m)>(m), std::forward<decltype(n)>(n), std::forward<decltype(k)>(k), std::forward<decltype(sourceA)>(sourceA), std::forward<decltype(sourceB)>(sourceB), std::forward<decltype(destC)>(destC), std::forward<decltype(subwordOffset)>(subwordOffset), std::forward<decltype(unsignedA)>(unsignedA), std::forward<decltype(unsignedB)>(unsignedB), std::forward<decltype(clamp)>(clamp));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<WMMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<WMMAOp::Properties>();
|
|
::mlir::PropertyRef properties = odsState.getRawProperties();
|
|
std::optional<::mlir::RegisteredOperationName> info =
|
|
odsState.name.getRegisteredInfo();
|
|
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
|
|
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
|
|
::llvm::report_fatal_error("Property conversion failed.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(WMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties&>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void WMMAOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
assert(operands.size() == 3u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.useProperties(const_cast<Properties &>(properties));
|
|
odsState.addAttributes(discardableAttributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(WMMAOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<WMMAOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
WMMAOp WMMAOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
void WMMAOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
|
|
::mlir::Builder odsBuilder(opName.getContext());
|
|
if (!properties.subwordOffset)
|
|
properties.subwordOffset = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0);
|
|
}
|
|
|
|
::llvm::LogicalResult WMMAOp::verifyInvariantsImpl() {
|
|
auto tblgen_clamp = getProperties().clamp; (void)tblgen_clamp;
|
|
auto tblgen_k = getProperties().k; (void)tblgen_k;
|
|
if (!tblgen_k) return emitOpError("requires attribute 'k'");
|
|
auto tblgen_m = getProperties().m; (void)tblgen_m;
|
|
if (!tblgen_m) return emitOpError("requires attribute 'm'");
|
|
auto tblgen_n = getProperties().n; (void)tblgen_n;
|
|
if (!tblgen_n) return emitOpError("requires attribute 'n'");
|
|
auto tblgen_subwordOffset = getProperties().subwordOffset; (void)tblgen_subwordOffset;
|
|
auto tblgen_unsignedA = getProperties().unsignedA; (void)tblgen_unsignedA;
|
|
auto tblgen_unsignedB = getProperties().unsignedB; (void)tblgen_unsignedB;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(*this, tblgen_m, "m")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU21(*this, tblgen_n, "n")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU26(*this, tblgen_k, "k")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU27(*this, tblgen_subwordOffset, "subwordOffset")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_unsignedA, "unsignedA")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_unsignedB, "unsignedB")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU5(*this, tblgen_clamp, "clamp")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU53(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU53(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup2 = getODSOperands(2);
|
|
|
|
for (auto v : valueGroup2) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU54(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU54(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {destC, destD} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult WMMAOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult WMMAOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 2)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[2].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult WMMAOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::IntegerAttr mAttr;
|
|
::mlir::IntegerAttr nAttr;
|
|
::mlir::IntegerAttr kAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceARawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceAOperands(&sourceARawOperand, 1); ::llvm::SMLoc sourceAOperandsLoc;
|
|
(void)sourceAOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand sourceBRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceBOperands(&sourceBRawOperand, 1); ::llvm::SMLoc sourceBOperandsLoc;
|
|
(void)sourceBOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand destCRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> destCOperands(&destCRawOperand, 1); ::llvm::SMLoc destCOperandsLoc;
|
|
(void)destCOperandsLoc;
|
|
::mlir::Type sourceARawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceATypes(&sourceARawType, 1);
|
|
::mlir::Type sourceBRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> sourceBTypes(&sourceBRawType, 1);
|
|
::mlir::Type destCRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> destCTypes(&destCRawType, 1);
|
|
{
|
|
auto odsResult = parseMNKDimensionList(parser, mAttr, nAttr, kAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<WMMAOp::Properties>().m = mAttr;
|
|
result.getOrAddProperties<WMMAOp::Properties>().n = nAttr;
|
|
result.getOrAddProperties<WMMAOp::Properties>().k = kAttr;
|
|
}
|
|
|
|
sourceAOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceARawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseStar())
|
|
return ::mlir::failure();
|
|
|
|
sourceBOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(sourceBRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parsePlus())
|
|
return ::mlir::failure();
|
|
|
|
destCOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(destCRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto loc = parser.getCurrentLocation();(void)loc;
|
|
if (parser.parseOptionalAttrDict(result.attributes))
|
|
return ::mlir::failure();
|
|
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
|
|
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
|
|
})))
|
|
return ::mlir::failure();
|
|
}
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceARawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
sourceBRawType = type;
|
|
}
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
{
|
|
::mlir::Type type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
destCRawType = type;
|
|
}
|
|
result.addTypes(destCTypes[0]);
|
|
if (parser.resolveOperands(sourceAOperands, sourceATypes, sourceAOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(sourceBOperands, sourceBTypes, sourceBOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(destCOperands, destCTypes, destCOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void WMMAOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
printMNKDimensionList(_odsPrinter, *this, getMAttr(), getNAttr(), getKAttr());
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceA();
|
|
_odsPrinter << ' ' << "*";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSourceB();
|
|
_odsPrinter << ' ' << "+";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getDestC();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("m");
|
|
elidedAttrs.push_back("n");
|
|
elidedAttrs.push_back("k");
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getSubwordOffsetAttr();
|
|
if(attr && (attr == odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), 0)))
|
|
elidedAttrs.push_back("subwordOffset");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getUnsignedAAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("unsignedA");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getUnsignedBAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("unsignedB");
|
|
}
|
|
{
|
|
::mlir::Builder odsBuilder(getContext());
|
|
::mlir::Attribute attr = getClampAttr();
|
|
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
|
|
elidedAttrs.push_back("clamp");
|
|
}
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceA().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getSourceB().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getDestC().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void WMMAOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace mlir::amdgpu
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::WMMAOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::amdgpu::detail::WMMAOpGenericAdaptorBase::Properties)
|
|
|
|
|
|
#endif // GET_OP_CLASSES
|
|
|